Getting started

Make your first Swarmhit API request in a few minutes.

The Smart API lets you run LinkedIn and email outreach programmatically: campaigns whose sequences mix LinkedIn and email steps, leads, lists and LinkedIn search imports, LinkedIn sender accounts, mailboxes (connect existing ones, or buy domains and mailboxes through Swarmhit), the B2B people and company database, one-off LinkedIn actions, your inbox, and the workspaces of an organization. Webhooks deliver events in real time, and an MCP server exposes most of the API to AI agents.

Smart API or Raw API?

The Smart API is Swarmhit's outreach engine: it paces, sequences and follows up for you. Need direct, one-call-one-action access to LinkedIn, WhatsApp and email accounts, with your own pacing? That is the Raw API. One Swarmhit login opens both.

Base URL

https://app.swarmhit.com/api/v1

Create an API key

Create and revoke keys on the Access tokens page in Swarmhit (the API keys card). Keys start with swh_live_. A key's full value is shown only once, at creation, so store it securely. Each key is scoped to the workspace it was created in. See Authentication for the details.

Your first request

curl https://app.swarmhit.com/api/v1/campaigns \
  -H "Authorization: Bearer swh_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Responses are JSON with the result under data; list endpoints add paging. A workspace with no campaigns yet answers:

{ "data": [], "paging": { "limit": 50, "offset": 0 } }

To check which workspace a key acts on, call GET /: it returns that workspace with its plan and seat usage.

Request bodies

Send request bodies as JSON with Content-Type: application/json; without that header the body is ignored. A body can be up to 100 KB: a larger one is refused with 413, and malformed JSON with 400, before the request reaches the API, so those two responses do not carry the JSON error body described below. Adding leads to a list or a campaign accepts up to 1000 leads per request; split a batch that would go over 100 KB.

Pagination

List endpoints accept limit (1-100, default 50) and offset query parameters, and return a paging object alongside data. paging echoes the limit and offset that were applied; most lists carry no total, so request the next page (offset + limit) until one comes back with fewer than limit items. A limit above 100 is treated as 100.

Database searches page with a cursor instead (see Database), and a few short lists, such as the reference data and an organization's workspaces, return everything in one response, without paging.

Errors

Errors use standard HTTP status codes with a JSON body:

{ "error": { "status": 404, "message": "Campaign not found." } }

When present, code is a stable, machine-readable identifier (for example unauthorized, unknown_endpoint or profile_not_found): branch on it rather than on message, whose wording may change. Some errors also carry a details object, such as the limit and its reset time on a sender 429.

StatusMeaning
400Invalid request: a missing or malformed field, or a rule the request breaks (for example connecting a sender when the workspace has no seat left, code seat-limit-reached)
401Missing or invalid key, or an X-Swarmhit-Workspace value the key cannot use (code unauthorized)
402A payment for bought mailboxes or domains failed, or there is no card to charge
403Not allowed for this workspace: the /workspaces endpoints (other than the list) on a workspace that is not an organization, a feature not enabled for it (email, buying mailboxes), or an action that needs billing rights the key's creator lacks
404Missing resource, or no endpoint for that method and path (code unknown_endpoint). A LinkedIn profile that cannot be resolved returns code profile_not_found
409Conflict with the current state, for example the workspace's cap of 25 webhooks, a LinkedIn invitation already pending to that profile, a paused sender, or a sender LinkedIn rejected (it may need reconnecting)
422An action LinkedIn could not complete on the target profile
429A rate limit: a sender's daily, weekly or pending-invitation limit (details gives limit, used, scope and, when known, resetAt), a sender out of InMail credits, or a service that is busy
500Server error (code internal_error)
502, 503LinkedIn, the database search or the mailbox provider failed or is unavailable; retry later

Next steps

On this page