LinkedIn

Connect a LinkedIn account, answer its checkpoints, keep it signed in.

Each LinkedIn account runs on its own browser identity and its own sticky IP, in the country you choose. Swarmhit keeps it signed in and tells you when it needs you.

Connecting an account

POST /api/v1/accounts takes one of two kinds of connection:

  • Credentials: username and password, and optionally totp_secret so Swarmhit answers an authenticator 2FA by itself.
  • Cookie: access_token, the member's li_at cookie (optionally jsessionid, user_agent, browser, cookies). A cookie connect answers 201 or an error, never a checkpoint.
curl -X POST https://console.swarmhit.com/api/v1/accounts \
  -H "X-API-KEY: gw_live_…" -H "Content-Type: application/json" \
  -d '{"provider":"LINKEDIN","username":"jane.doe@example.com","password":"…","country":"FR"}'

A credentials connect signs in the way the member would, which can take up to about 150 seconds (give the call a long timeout), and answers one of:

  1. 201 AccountCreated: signed in. Store account_id.
  2. 202 Checkpoint: LinkedIn asks for something; checkpoint.type says what.
  3. 202 AccountQueued: the result arrives as events (AccountStatus OK, gateway.checkpoint or gateway.sign_in_failed). This happens only when Swarmhit queues the sign-in, or for a connect that sent "background": true (where Swarmhit enables it) and needs no typed code.

A refused connect (wrong password, throttled, no IP) keeps nothing: retrying it reuses the same device and IP.

Checkpoints

checkpoint.typeWhat to do
OTP, 2FA, PHONE_REGISTERSend the code (or phone number) with POST /api/v1/accounts/checkpoint { "account_id", "code" }. The answer is again 201, 202 (LinkedIn chains steps) or an error. …/checkpoint/resend asks for a new code.
IN_APP_VALIDATIONThe member approves the sign-in in their LinkedIn app. Poll GET /api/v1/accounts/{id}, or wait for the OK account status event.
CAPTCHA, UNKNOWNA person has to look: use the live view below.

The live view

When a person has to look, the answer carries a live view: { token, expires_at }. Open the websocket wss://console.swarmhit.com/li-live/<token>. It streams the sign-in's browser as JPEG frames ({ type: 'frame', data, meta }, then { type: 'state', state: 'live' | 'finishing' | 'ended' }) and takes the person's input ({ type: 'mouse', action, x, y }, wheel, key, text). The token is single use and lasts 10 minutes; POST /api/v1/accounts/{id}/live-view mints a new one. When the person is through, the account becomes OK, or the next checkpoint arrives as a gateway.checkpoint event.

Keeping it signed in

GET /api/v1/accounts/{id} shows where an account is at any time: status (OK, CREDENTIALS, CONNECTING, STOPPED) and, under gateway, Swarmhit's own finer status and checkpoint. Branch on status.

  • LinkedIn ended the session: the account turns CREDENTIALS. Reconnect it with POST /api/v1/accounts/{id}: same id, same device and IP.
  • Pause and resume an account with …/pause and …/resume: a paused account does nothing, and calls that act answer 409 paused.
  • Placement: the account's IP is in the country you sent (ISO code), else the country of the ip you sent, else of your server's address, else US. It keeps that IP for as long as it can; …/recover picks a new one in the same country when its exit stopped it.

What you can do with it

AreaStart with
ConversationsList chats, start a chat, send a message, InMail and Sales Navigator threads
PeopleRead a profile, invite, connections, sent and received invitations
PostsA member's posts, react, comment, publish
SearchPeople and Sales Navigator search, companies, InMail balance

Use unless_replied_since on every automated follow-up: if the recipient wrote after that time, nothing is sent and the call answers 409 recipient-replied.

On this page