Skip to content
Docs

Connect an account (cookie)

POSTdirect.lempile.com/api/v1/accounts

Connects a LinkedIn account from its cookie, as Unipile's: no browser is ever opened for it. Lempile checks the cookie over HTTP with the browser's own user agent, language and timezone, through the account's own IP, keeps it encrypted and serves the account browserless. Keep using LinkedIn normally in that browser; signing out there ends the session (then connect again with a new cookie). Email and password go through hosted auth instead (POST /api/v1/hosted/accounts/link).

Authentication

X-API-KEY header·A Lempile Direct key, one per workspace, made in Lempile's dashboard.

Request body

  • providerstringrequired
    One ofLINKEDIN
  • access_tokenstringrequired

    The li_at cookie of the browser the person is signed in with.

  • premium_tokenstring

    The li_a cookie (Sales Navigator / Recruiter), when there is one.

  • user_agentstringrequired

    The exact user agent of the browser the cookies come from. Lempile replays it on every call: a different one makes LinkedIn end the session.

  • user_languagestring

    That browser's language, e.g. fr-FR (or several, comma separated, in its order).

  • user_timezonestring

    That browser's IANA timezone, e.g. Europe/Paris.

  • cookiesarray of objectrequired

    Lempile's own field (not Unipile's): every linkedin.com cookie of the browser li_at comes from, at least bcookie and JSESSIONID. li_at alone is refused (400 missing_browser_cookies): a new browser id for an existing session makes LinkedIn end it.

    ≤ 60 items
    ›Show fields
    • namestringrequired
    • valuestringrequired
    • domainstring
    • pathstring
    • expiresnumber
    • httpOnlyboolean
    • secureboolean

Responses

201

Connected

›

application/json

  • objectstringrequired
  • account_idstringrequired
400

A required parameter missing (errors/missing_parameters), or one that isn't valid (errors/invalid_parameters, errors/invalid_url, errors/content_too_large).

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

401

errors/missing_credentials: the X-API-KEY header is missing, wrong or revoked. errors/disconnected_account: LinkedIn signed the account out (or asks it for a security check); reconnect it.

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

403

LinkedIn refused it for this account (errors/resource_access_restricted, errors/action_required), or LinkedIn restricted the account (errors/account_restricted: every route answers it, with no LinkedIn call, until a person clears the restriction in Lempile), or the account doesn't write through Direct (errors/insufficient_permissions), or it needs Sales Navigator or Recruiter (errors/feature_not_subscribed).

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

409

errors/conflict: a write with this Idempotency-Key is still running.

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

501

errors/feature_not_implemented: Direct doesn't do this (yet). A Unipile client can fall back to Unipile.

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

503

errors/network_down: the account's proxy or browser server didn't answer. Nothing was sent.

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

504

errors/request_timeout: LinkedIn didn't answer in time. On a write: an unknown outcome (it may have been sent); it's never retried and its Idempotency-Key never writes again.

›

application/json

  • titlestringrequired

    A short title, e.g. Too many requests.

  • detailstringrequired

    What happened, in plain words. Never an account's data.

  • typestringrequired

    Unipile's error type: errors/<kind>. Branch on this, not on detail.

  • statusintegerrequired

    The HTTP status again.

  • retry_afterinteger

    Seconds to wait before trying this account again. Only on 429; the Retry-After header carries the same value.

  • account_statusstring

    Lempile's own field, on a problem about the account's state (401 errors/disconnected_account, 403 errors/account_restricted, 503 or 422 errors/network_down, 504 errors/request_timeout): the account's lifecycle.status (see Account). The type and HTTP status stay Unipile's.

    One ofrunningdegradederroreddisconnectedconnecting
  • reasonstring

    With account_status: why, as lifecycle.reason (signed_out, checkpoint, restricted, proxy_unavailable, browser_unavailable, timeout, lempile_error).

Was this page helpful?