Installation
Authentication
Get an API key by signing up for free; it’s available in your dashboard as soon as you sign up. The same key works across the API, SDKs, MCP server, and CLI.Person
Enrichment
Look up a person by email, phone, name, LinkedIn, or other identifiers.titlecase: true for title case.
Bulk Enrichment
Enrich up to 50 people in one request. Each item takes the same identifiers asenrich(), plus an optional metadata object echoed back with its result; the other parameters are defaults every item can override.
Search
Query people with exactly one of three inputs (0.15.0+; see Person Search):filters keyed by the record’s own field names, a SQL SELECT against the people table as sql, or a query object as es_query. SQL must start with SELECT and must not include a LIMIT clause; pass limit as a parameter. The older query argument still works and is deprecated.
next_cursor as cursor (0.13.0+). The last page
has no next_cursor. Each record returned costs a credit, so cap how many you collect.
city, state, state_code) come with contact data; on a plan without it, a filter on them is refused with a 400.
Count
How many people a search would match, rounded, with no records returned (0.15.0+). Counts are free and work with no credits left; fields that identify one record are refused. See Person Search Count.Discover (Beta)
Find people using natural language.query with the previous page’s next_cursor as cursor.
Company
Enrichment
Look up a company by domain, name, ticker, or LinkedIn.Search
Query companies withfilters, sql or es_query, exactly one, as for people; client.company.count() takes the same.
cursor as for people (0.13.0+).
Discover (Beta)
Find companies using natural language.cursor as for people (0.14.0+).
Utility Endpoints
Utility endpoints are free and don’t consume credits.Clean Fields
Hash Email
Validate Data
Report a Data Issue
Found something wrong in a record? Report it against itslegion_id. See Report a Data Issue for the issue_type/issue_level rules.
client.utility.reportCompany() with the same parameters.
Response Metadata
After each request, response metadata is available on the client.search/discover, totalCountStatus tells you how the response total was derived: "exact" (true count), "estimate" (on broad queries where the exact count runs out of time: the matches counted by then, a lower bound, so read it as “at least”), or "page" (count unavailable; total is the offset plus the rows returned).
searchWarning carries the Search-Warning header when a search flags one of its filters, and says what to change or what was searched instead.
Field Filtering
Control which fields are returned in the response.Error Handling
The SDK throws a typed error class for each error status. Every one extendsDataLegionError.
The client doesn’t retry. On a 429,
client.retryAfter holds the seconds to wait.
Sandbox
Passsandbox: true to build and test without spending credits. Enrichment, Search, Bulk Enrichment and Discover (Beta) then call the sandbox and return sample records with every field a real record has; the utilities, which are free, call the real API.