Skip to main content
POST
Search persons using SQL query
Send exactly one of these with each request: Sending two is a 422 that names both. sql takes only SQL and es_query only a query object. The older query parameter still works (SQL as text, a query object as an object); new code should use the inputs above.
The same search as SQL:

Filters

Filter keys are the record’s own field names: the ones in every response and on the field reference. One grammar works for every field: Every field you give must hold. Free text (titles, names, headlines, summaries, descriptions, skills) matches the words in order, so "job_title": "vp of sales" also finds “senior vp of sales”, and abbreviations are read the way titles are stored (“vp” is also “vice president”). Every other field matches the whole value. Case never matters, and places and websites take any common spelling (TX, us-tx and Texas are the same state). Work history is a list of jobs: fields under experience given together must hold for the same job. A past job at Google is {"experience.organization.name.cleaned": "google", "experience.current": false}. A key that is not a field of the record is a 422 that names the closest real fields. Fields outside your plan are refused, as they are in SQL.

Combining Filters

To combine sets of fields, wrap them in a group, which is also how to rule something out: {"and": [...]} (all must hold), {"or": [...]} (any may hold) or {"not": {...}} (must not hold). Groups nest up to 3 levels, with up to 20 items in each.
Location fields (city, state, state_code) come with contact data; on a plan without it, a filter on them is refused with a 400.

Boolean Keywords

keywords takes a Boolean search string, written the way recruiters write one: words and "quoted phrases", with AND, OR and NOT in capitals and parentheses for grouping. Words side by side mean AND, and a lowercase “and” is just a word. NOT binds tightest, then AND, then OR, so python AND django OR flask means (python AND django) OR flask. It searches the person’s title, headline, summary and skills, and combines with every other filter.
A syntax error (an unclosed quote or parenthesis, an operator with nothing beside it) is a 422 that says where.

SQL

Write a SELECT * FROM people WHERE ... query in sql. Do not include LIMIT or OFFSET clauses; use the limit and offset parameters instead.

Response Shape

  • matches: capped at the request’s limit (default 1, max 100).
  • total: how many rows match across the whole database, not just this page, so a request with limit: 1 tells you how big a list is (“VPs of Engineering at fintech in NY”). The Total-Count-Status header says how to read it: exact (selective queries), estimate (a broad query’s count ran out of time; total is a lower bound, so show it as “141,286+”), or page (no count; total is the offset plus the rows returned). Search responses carry no match_metadata; only /person/enrich does. A broad query returns the same response shape with a lower-bound total, flagged by the header:
  • next_cursor: the cursor for the next page when more results follow (send it back as cursor, see Cursors below); null on the last page.
  • Industry filters: company_industry holds the lowercased LinkedIn industry names in Enums. A filter no stored value can match (an older LinkedIn name such as '%information technology%') returns an empty page at once, free, with a Search-Warning header naming the filter and the closest stored values.
  • Synonyms and aliases: in SQL, a job title, employer, past employer (organization_name) or place in an =, LIKE or ILIKE filter also matches its known synonyms: '%software engineer%' also finds “developer” and “programmer”, company_name = 'Meta' also finds “facebook”, city = 'NYC' also finds “new york”. filters on the same fields (job_title, company_name, experience.title.cleaned, experience.organization.name.cleaned, education.organization.name.cleaned and the places) match them too, so a search answers the same either way. The lists are short and change only with a data release. The Search-Warning header names what was also matched. IN (...) lists and query objects (es_query) match without them.
  • Case: capitalization never changes the answer: on a direct text column =, <>, IN, NOT IN, LIKE and ~ all ignore case, so first_name = 'Jane' finds “jane”. Only a regular expression that asks about case (a class such as [A-Z]) stays case-sensitive. Numbers, dates and booleans compare as written. Stored values are lowercase, except headline, summary and the uppercase codes.
  • Places and websites: write a state or country as its code or name and a website as a URL: state_code = 'TX', 'us-tx' and 'Texas' all mean 'US-TX'; country = 'US' and 'USA' mean 'united states'; country_code = 'usa' means 'US'; company_domain = 'https://www.stripe.com/' means 'stripe.com'. This holds in query objects’ term and terms too. A bare state code is a US state unless the query names another country.
  • Title abbreviations: stored titles spell abbreviations out (“registered nurse”, not “RN”), so a one- or two-letter abbreviation in a title pattern (job_title ILIKE '%RN%') is searched as the stored spelling, and the Search-Warning header says what was searched.
  • Short patterns: any other one- or two-character contains-pattern matches the whole word on titles, names and employers ('%qa%' finds “qa”, not “aquatics”) and anywhere on places (city ILIKE '%ny%' finds “albany”). The Search-Warning header says which and suggests the full term or a whole-word match (on a domain or URL column, an exact =).
  • Sort order: results come in a stable order, with legion_id as the final tie-break after your own ORDER BY, so the same request returns the same page and paging never repeats or skips a record while the data is unchanged.

Query Objects (es_query)

Instead of SQL, send es_query: a query object in the Elasticsearch query syntax. It suits code that builds filters, and it uses the field names of the response itself.
This example filters on state (contact data) and seniority_level (Premium); on a plan without them it is refused with a 400.
  • Supported: bool (must, should, filter, must_not, minimum_should_match), term, terms, match, match_phrase, range, exists, prefix, wildcard and nested. Anything else, such as scripts, aggregations, regexp, fuzzy, query_string or boosts, returns a 400; so does a parameter a supported type doesn’t take (such as boost inside term).
  • Fields: the response’s own paths (job_title, experience.title.cleaned), on fields your contract covers. A trial account searches only the fields its responses include.
  • Case: term, terms, prefix and wildcard ignore case. match and match_phrase search the words of a text field. wildcard takes * and ?, but not at the start of the pattern.
  • experience (work history) is an array of jobs: a filter on experience.* matches when any one job matches, and wrapping several filters in nested makes them hold for the same job (above: a past job at Google).
  • Limits: up to 10 levels deep, 100 leaf filters and 1,000 values in one terms; at most 1,020 conditions once lists are expanded. minimum_should_match is a count up to 100 or a percentage.
  • As text: a query object can also be sent as JSON text, which is how a GET request carries one (?es_query={"term":{"city":"austin"}}, URL-encoded); filters works the same way. Prefer POST: a GET puts the query in the URL. A whole Elasticsearch search body, {"query": {...}}, is read as the query inside it.
  • Refused: keys other than the documented parameters (such as aggs, sort or size) are a 422 that names them, and any query type or parameter not listed above is a 400.
Everything else works as it does with SQL: the sort order, limit, offset and cursor, field selection, credits and the response shape.

Pagination

To page through results beyond the first 100, set offset to the number of rows to skip. Maximum offset is 10,000.
Order is stable within a data build (see Sort order above) and can change with a new build, so finish paging within one session rather than across days.

Cursors

To read deeper than offset allows, or to export a whole result set, page with a cursor. A page with more results after it carries next_cursor; send it back as cursor, without offset, with the same search. On the last page next_cursor is null, even when the page is full.
A cursor belongs to one search on one dataset build. A cursor from a different query, or from before a new build, returns a 400 saying so: start again from the first page. A cursor works for SQL, query objects and filters alike.

Available Columns

Text Columns

Use ILIKE for partial matching or = for exact matching.

Numeric Columns

Enum Columns

Use = or IN for exact matching.

Boolean Columns

Cross-Table Columns

These columns search across work history, education, certifications, contact data, skills, languages and the profile’s headline and summary: A cross-table column matches when any one of the person’s related rows matches. school together with field_of_study or graduation_date (or two education keys ANDed in filters) answers 400 unsupported_filter: the two could match different education entries, so a Stanford degree in economics would also find someone who studied economics elsewhere. Search on one of them. Cross-table columns support these filter forms:
  • To exclude, wrap the filter: NOT (organization_name ILIKE '%cisco%').
  • To match several patterns, join ILIKE filters with OR.
  • Inside a value, double an apostrophe as standard SQL requires: organization_name ILIKE '%mcdonald''s%'.
  • LIKE matches as ILIKE does.
  • IS NULL and other operators on these columns, such as NOT ILIKE or NOT IN (...), return a 400 that lists the supported forms.
'%text%' matches where a word begins: '%cisco%' matches “Cisco Systems” and “Cisco Meraki”, never “San Francisco”.

Job Dates and Past Jobs

Dates are compared as stored: jobs by month ('2026-05'), education mostly by year. A full date is read as its month. Keep a filter on a direct column (such as job_title, company_name or city) alongside a cross-table filter. A cross-table filter over a broad population, such as everyone in a metro, checks every person’s related rows and can exceed the time limit.

Example Queries

Some of these name fields that not every plan carries, and a query naming a field outside your plan is refused with a 400: location fields (city, state) come with contact data, and seniority_level, job_function and is_decision_maker with Premium.

Authorizations

API-Key
string
header
required

Body

application/json

Request model for Person Search: sql, es_query or filters, and the page.

query
deprecated

Deprecated: send sql or es_query. A SQL SELECT statement when text, a query object when an object (or text starting with "{"); still accepted as before.

sql
string | null

A SQL SELECT statement (no LIMIT or OFFSET clause: use limit and offset).

es_query
Es Query · object | null

A query object in the Elasticsearch query DSL, naming the response's field paths (bool, term, terms, match, match_phrase, range, exists, prefix, wildcard, nested). A GET may send it as JSON text.

filters
Filters · object

The person record's own field names; every one given must hold.

limit
integer
default:1

Maximum number of results to return (replaces LIMIT in query) (default: 1, max: 100)

Required range: 1 <= x <= 100
offset
integer
default:0

Number of results to skip for pagination (0-10000). Stable within a build; ordering may change across builds.

Required range: 0 <= x <= 10000
cursor
string | null

Continue a search from the previous page's next_cursor: the next page in the same order, past offset's 10,000-row reach, for deep pages and exports. Send the same query, and no offset. A cursor works for the dataset build it came from; after a new build, start again.

Maximum string length: 65536
titlecase
boolean
default:false

If true, format text fields in title case (names, job titles, company names, locations, skills, headlines). Raw fields, IDs, URLs, codes, and confidence fields are excluded.

include_fields
string | null

Comma-separated list of fields to include in response (e.g., 'full_name,emails,phones'). If omitted, all fields are returned.

exclude_fields
string | null

Comma-separated list of fields to exclude from response (e.g., 'skills,education'). Applied after include_fields filter.

pretty_print
boolean
default:false

If true, pretty-print JSON response with indentation.

Response

Success - query executed and results returned

Person Search response: a page of matches.

matches
PersonMatchResponse · object[]
required

List of matches sorted by confidence (descending).

total
integer
required

For /person/search and /person/discover, the total number of rows matching the query's WHERE clause across the database (not just this page). On search/discover, if the exact count exceeds its time budget (broad, low-selectivity queries) it falls back to the matches counted before the budget ran out (a lower bound), and if that does not cover this page, to the offset plus the rows returned; the response header Total-Count-Status reports which (exact, estimate, or page).

next_cursor
string | null

The cursor for the next page when more results follow: send it as cursor, with the same query (on Discover it reruns the same search). Null on the last page.