Skip to main content

Query leads

Query/filter leads with descriptor payloads and cursor pagination.

POST/api/leads/query
HTTP referenceScope leads:readUpdated March 6, 2026

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/leads route for new integrations.
  • Use /api/leads/query/research when you need actual research row values for selected lead IDs.
  • The response includes research linkage metadata via related_tables and research_summary.

Body parameters

  • filter · optional

    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 · optional

    string

    Optional free-text lead search.

  • sort · optional

    array<object>

    Optional sort specs; each item is { field, direction }.

  • pagination · optional

    object

    Optional { limit, cursor }; limit defaults to 50 and must be >=1, cursor is opaque.

  • scope · optional

    string

    Optional scope: org or user.

  • source_table_id · optional

    string

    Optional research table context.

  • source_table_scope · optional

    string

    Research scope: company or lead; defaults to company.

  • related_tables_mode · optional

    string

    Optional related-table expansion mode: linked, direct, or none.

  • include_research_data · optional

    boolean

    Optional inline research_data hydration. For external callers, the follow-up /query/research endpoint is usually cleaner.

  • include_placeholder_leads · optional

    boolean

    Optional toggle to include placeholder leads.

  • selection_context · optional

    string

    Optional descriptor selection context.

  • ids_only · optional

    boolean

    Return ID-only query records; defaults to false.

  • include_count · optional

    boolean

    Include total_count for the matching query; defaults to false.

Errors

StatusMeaning
400Invalid descriptor payload.
401Invalid API key or missing auth.
403Missing leads:read scope.
503Query/search timeout or CRM text search index unavailable.

Docs