JavaScript SDK: swarmhit.leadImports.create(params)
Kicks off a paginated import from a LinkedIn / Sales Navigator search
against the connected accountId. Returns immediately with the import
running — the worker fetches the first page within a minute. Each
stored lead counts toward the sender's daily search-import limit; when
it is reached the import waits until midnight UTC and stays running.
An unknown or disconnected accountId, a Sales Navigator search on a
sender without Sales Navigator, or an unknown listId / campaignId
is a 400 (an unknown id has code: not-found), as is sending both or
neither of url and params.
Provide either:
url: a copied LinkedIn search URL (classic or Sales Navigator), orparams: a structured filter blob ({ api, category, keywords, ... }).
Imported leads land in listId if provided; otherwise a new list is
auto-created and returned in the response. With campaignId instead,
they land in that campaign's own list (created if it doesn't exist yet)
and are enrolled in the campaign page by page, subject to its
exclusion rules.
Authorization
bearerAuth An API key created on the Access tokens page.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/lead-imports" \ -H "Content-Type: application/json" \ -d '{ "accountId": "string" }'{ "data": { "id": "string", "name": "string", "linkedinAccountId": "string", "status": "pending", "input": { "mode": "url", "url": "string", "params": {} }, "destination": { "listId": "string", "listAutoCreated": true }, "tags": [ "string" ], "maxLeads": 0, "progress": { "fetchedPages": 0, "fetchedItems": 0, "importedLeads": 0, "skippedItems": 0, "totalCount": 0 }, "nextPageAt": "2019-08-24T14:15:22Z", "error": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "startedAt": "2019-08-24T14:15:22Z", "completedAt": "2019-08-24T14:15:22Z" }}Cancel a running lead import POST
**JavaScript SDK:** [`swarmhit.leadImports.cancel(leadImportId)`](/smart-api/sdk/methods#leadImports)
Delete a terminal lead import DELETE
**JavaScript SDK:** [`swarmhit.leadImports.delete(leadImportId)`](/smart-api/sdk/methods#leadImports) Only allowed when status is `completed`, `failed` or `cancelled`.