This page documents the canonical HTTP contract for this endpoint.
Recommended external usage
- Use this endpoint as the canonical external lead list/filter surface.
- Prefer this over the older query-string
GET /api/leadsroute for new integrations. - Use
/api/leads/query/researchwhen you need actual research row values for selected lead IDs. - The response includes research linkage metadata via
related_tablesandresearch_summary.
Body parameters
filter· optionalobject
Optional FilterDescriptor with root rule/group. Rule operators require value or values except is_empty/is_not_empty; groups require children and NOT requires exactly one child.
search· optionalstring
Optional free-text lead search.
sort· optionalarray<object>
Optional sort specs; each item is { field, direction }.
pagination· optionalobject
Optional { limit, cursor }; limit defaults to 50 and must be >=1, cursor is opaque.
scope· optionalstring
Optional scope: org or user.
source_table_id· optionalstring
Optional research table context.
source_table_scope· optionalstring
Research scope: company or lead; defaults to company.
related_tables_mode· optionalstring
Optional related-table expansion mode: linked, direct, or none.
include_research_data· optionalboolean
Optional inline research_data hydration. For external callers, the follow-up /query/research endpoint is usually cleaner.
include_placeholder_leads· optionalboolean
Optional toggle to include placeholder leads.
selection_context· optionalstring
Optional descriptor selection context.
ids_only· optionalboolean
Return ID-only query records; defaults to false.
include_count· optionalboolean
Include total_count for the matching query; defaults to false.
| Name | Type | Description |
|---|---|---|
| filter | object | Optional FilterDescriptor with root rule/group. Rule operators require value or values except is_empty/is_not_empty; groups require children and NOT requires exactly one child. |
| search | string | Optional free-text lead search. |
| sort | array<object> | Optional sort specs; each item is { field, direction }. |
| pagination | object | Optional { limit, cursor }; limit defaults to 50 and must be >=1, cursor is opaque. |
| scope | string | Optional scope: org or user. |
| source_table_id | string | Optional research table context. |
| source_table_scope | string | Research scope: company or lead; defaults to company. |
| related_tables_mode | string | Optional related-table expansion mode: linked, direct, or none. |
| include_research_data | boolean | Optional inline research_data hydration. For external callers, the follow-up /query/research endpoint is usually cleaner. |
| include_placeholder_leads | boolean | Optional toggle to include placeholder leads. |
| selection_context | string | Optional descriptor selection context. |
| ids_only | boolean | Return ID-only query records; defaults to false. |
| include_count | boolean | Include total_count for the matching query; defaults to false. |
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid descriptor payload. |
| 401 | Invalid API key or missing auth. |
| 403 | Missing leads:read scope. |
| 503 | Query/search timeout or CRM text search index unavailable. |
