Skip to content

API quickstart

This walks the path most integrations take: count → browse → reveal → estimate → export. Steps 1, 2 and 4 are free. Set your key once:

Terminal window
export LS_KEY="ls_live_your_key_here"
  1. Count — free. Check how many people match before you spend anything.

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/search \
    -H "X-API-Key: $LS_KEY" -H "Content-Type: application/json" \
    -d '{
    "jobTitles": ["Head of Sales"],
    "exactMatch": true,
    "industry": ["Software Development"],
    "companySize": ["51-200"],
    "country": ["US"]
    }'
    {
    "firmographic_total": 179984,
    "firmographic_is_exact": true,
    "estimated_total": 382,
    "basis": "sampled",
    "note": "estimated_total is sampled: keyword/role/department filters are applied per row and cannot be counted upstream. Plan exports around estimated_total.",
    "narrowed_by": null,
    "keywords": null,
    "filters": { "jobTitles": ["Head of Sales"], "exactMatch": true, "industryNames": ["Software Development"], "companySizes": ["51-200"], "countryCodes": ["US"], "matchAny": false }
    }

    firmographic_total counts the companies-side filters exactly. estimated_total applies job titles and keywords too, from a sample, so it’s the size of the market. To size an export, use the exact estimate in step 4: it also subtracts leads you’ve already revealed and your per-company limit. filters echoes what the server understood; check it whenever a count looks wrong. It lists the filters under their internal names (industry comes back as industryNames, country as countryCodes, companySize as companySizes). A filter missing from filters was not applied; see Filter field names.

    While the count is still being worked out, estimated_total is null and basis is "pending". Send the same request again a few seconds later.

  2. Browse — free. Page through matching people with contact details masked.

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/browse \
    -H "X-API-Key: $LS_KEY" -H "Content-Type: application/json" \
    -d '{ "jobTitles": ["Head of Sales"], "exactMatch": true, "country": ["US"], "companySize": ["51-200"], "limit": 25 }'
    {
    "page": 1, "limit": 25, "returned": 25, "next_page": 2,
    "leads": [
    {
    "id": "3f1c2a90-0000-4000-8000-000000000001",
    "firstName": "Jordan", "jobTitle": "Head of Sales",
    "companyName": "Example Software Inc.", "companySize": "101 to 250",
    "industryName": "Software Development", "seniority": "Director",
    "city": "Austin", "state": "TX", "countryCode": "US",
    "email": "•••@•••.com", "phone": "+151****10"
    }
    ]
    }

    Keep the id of each lead you want. People you’ve already revealed don’t appear here.

    With several industries, pages are filled one industry at a time by default. Send "order": "mixed" to spread every page across all of them, in proportion to their size, so the first page is a sample of the whole filter.

  3. Reveal — 1 credit per new lead. Unlock the leads you picked (send their ids).

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/reveal \
    -H "X-API-Key: $LS_KEY" -H "Content-Type: application/json" \
    -d '{ "leadIds": ["3f1c2a90-0000-4000-8000-000000000001"] }'
    { "revealed": [ { "id": "3f1c2a90-…", "email": "jordan@example-software.com", "…": "…" } ],
    "credits_charged": 1, "new_reveals": 1, "already_revealed": 0 }

    Revealing the same lead again returns "credits_charged": 0, "already_revealed": 1.

  4. Estimate — free and exact. Before an export, ask what it would deliver to you, now: the same filters, limit and options you’re about to export with.

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/exports/estimate \
    -H "X-API-Key: $LS_KEY" -H "Content-Type: application/json" \
    -d '{ "jobTitles": ["Head of Sales"], "exactMatch": true, "country": ["US"], "companySize": ["51-200"],
    "maxPerCompany": 3, "dropUndeliverable": "domain", "limit": 2000 }'
    { "deliverable_estimate": 312, "basis": "exact", "more_available": false,
    "left_out": { "already_revealed": 58, "over_company_limit": 11, "duplicate_email": 0, "dead_domain": 2 },
    "rows": 312, "credits_max": 312, "seconds": 6, "requested_limit": 2000,
    "count_pending": false, "counted_in_seconds": 7,
    "note": "Exactly what this export would deliver to you now: 312 new leads." }

    The estimate runs the export without writing or charging anything, so deliverable_estimate already leaves out leads you revealed before, people over maxPerCompany, duplicate emails and (with dropUndeliverable) dead domains. left_out says how many of each. more_available: true means the limit was reached and more leads match.

    It usually answers in under 20 seconds. If it takes longer you get "count_pending": true: send the same request again after retry_after_seconds; the count keeps running meanwhile and is kept for 5 minutes. basis: "floor" means the count hit its time limit and the export may deliver more. Send "exact": false for the old sampled pool count.

  5. Export — for bulk. Instead of revealing page by page, export everyone matching your filters as a CSV (up to 50,000 per export).

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/exports \
    -H "X-API-Key: $LS_KEY" -H "Content-Type: application/json" \
    -d '{ "jobTitles": ["Head of Sales"], "exactMatch": true, "country": ["US"], "companySize": ["51-200"],
    "maxPerCompany": 3, "dropUndeliverable": "domain", "limit": 2000 }'
    { "job_id": "4fad85cd-3e37-4797-ab77-07ed02d8f408", "status": "queued", "requested_limit": 2000, "drop_undeliverable": "domain", "capped_to_max": null,
    "poll": "/api/v1/leads/exports/4fad85cd-3e37-4797-ab77-07ed02d8f408",
    "download": "/api/v1/leads/exports/4fad85cd-3e37-4797-ab77-07ed02d8f408/csv" }

    Poll until status is completed, then download:

    Terminal window
    curl https://app.leadsonar.io/api/v1/leads/exports/4fad85cd-3e37-4797-ab77-07ed02d8f408 -H "X-API-Key: $LS_KEY"
    # {"id":"4fad85cd-…","status":"completed","deliveredRows":312,"creditsCharged":312,"downloadable":true,
    # "skipped":{"alreadyRevealed":58,"perCompanyCap":11,"duplicateEmail":0,"undeliverable":2},
    # "note":"312 leads delivered — that's every match left. Left out: 58 you had already revealed, 11 over the per-company limit, 2 undeliverable emails. …"}
    curl -o leads.csv https://app.leadsonar.io/api/v1/leads/exports/4fad85cd-3e37-4797-ab77-07ed02d8f408/csv -H "X-API-Key: $LS_KEY"

    skipped explains a delivery shorter than your limit: matching leads left out because you’d already revealed them, because of maxPerCompany, because the email was a duplicate, or because dropUndeliverable removed them. Left-out leads are not charged.

    Leads you already own. By default an export holds only leads you don’t have yet, so a second export with the same filters returns new people, not the ones from last time. To get every match, including leads you revealed before, add "includeOwned": true (export and estimate). Leads you already own are free: a lead is never charged twice. In the app, it’s the Include leads I already own checkbox in the export dialog.

    Download while it runs. As soon as the status shows downloadableSoFar: true, the /csv URL returns the rows written so far. Add ?from=N to skip the first N rows, e.g. to fetch only the rest after an earlier partial download (downloadedRows on the job tells you how many you already have).

    The CSV columns: First Name, Last Name, Email, Phone, Company, Domain, Job Title, Seniority, Department, Industry, Country, State, City, Company Size, LinkedIn.

    dropUndeliverable — leave out emails that won’t arrive, before you’re charged for them:

    ValueWhat it checksCost
    "off" (default)nothing—
    "domain"the email’s domain accepts mail at allfree
    "mailbox"the domain, then each mailbox with EmailShield; only addresses it marks invalid are dropped1 credit per address checked; addresses with no verdict are kept and refunded

    Mailbox checks run at EmailShield’s pace, so a "mailbox" export takes minutes per thousand rows instead of seconds. The estimate’s seconds includes it.

Search, browse, estimate and export take the same filters. Use the names in the first column; they’re the ones in the API reference. The older names in the second column still work and give the same result.

Field names ignore case, _ and -, so excludeTitles, exclude_titles and Exclude-Titles are the same field, and so are jobTitles and job_titles.

FieldAlso acceptedTypeValues
industryindustryNames, industriesstring[]From /leads/filters?field=industry
countrycountryCodes, countryCode, countriesstring[]ISO code or name ("US", "United States")
senioritysenioritiesstring[]From /leads/filters?field=seniority
companySizecompanySizesstring[]"51-200" or the raw buckets ("51 to 100")
departmentdepartmentsstring[]From /leads/filters?field=department
revenuerevenuesstring[]From /leads/filters?field=revenue
companyTypecompanyTypesstring[]private, government, nonprofit, education
jobTitles—string[]Free text; set exactMatch: true
excludeTitles—string[]Free text
includeKeywords, excludeKeywords—string[]Free text, matched against the company description
  • excludeTitles drops anyone whose job title contains one of the terms as a whole word, ignoring case. "intern" drops “Sales Intern” but not “International Sales Manager”.
  • companyType is derived from each company’s industry, and several types combine with OR. Unlike other filters, a value outside the list is an error: "public" returns 400 COMPANY_TYPE_NOT_AVAILABLE (listed-company filtering isn’t available yet), and anything else returns 400 UNKNOWN_COMPANY_TYPE. Both messages list the supported types.
  • If you send both spellings of the same field, the name in the first column wins.

Industry and seniority values are checked against the real list. A value that matches nothing is left out and named in warnings, with suggestions, while the other values in that filter still apply:

{ "estimated_total": 339355, "…": "…",
"warnings": [ { "code": "UNKNOWN_FILTER_VALUE_IGNORED",
"ignored": { "industry": [ { "value": "Building Materials",
"suggestions": ["Wholesale Building Materials", "Building Construction"] } ] } } ] }

If every value in a filter is unknown, the request fails with 400 UNKNOWN_FILTER_VALUE instead, because dropping them all would silently widen the search to everyone. Casing and & vs and don’t matter. Ask the API for the real values:

Terminal window
curl "https://app.leadsonar.io/api/v1/leads/filters" -H "X-API-Key: $LS_KEY"
# {"filters":["industry","seniority","country","department","company_size","revenue","companyType"], ...}
curl "https://app.leadsonar.io/api/v1/leads/filters?field=seniority" -H "X-API-Key: $LS_KEY"
# {"field":"seniority","values":[{"value":"Staff","count":"46030856"},{"value":"Manager",...},{"value":"Cxo",...},{"value":"Director",...},{"value":"Vp",...}]}

jobTitles, excludeTitles, includeKeywords and excludeKeywords are free text and have no fixed list. For company size you can send either the app’s bands ("51-200") or the raw buckets the filters endpoint lists ("51 to 100", "101 to 250").