Skip to content
ProspectAPIs

API reference / Connected account

Connect an account with a session

Written and maintained by The ProspectAPIs team

POST/v1/accounts/session

POST /v1/accounts/session is the ProspectAPIs operation connectAccountSession, in the Connected account group of the REST API. Connect your own account with its signed-in session string. The session is checked live once, then stored encrypted in our database, used only to perform the actions you request, never shown to another customer, and deleted when you disconnect. It replaces any account connected before. Free. Rate limit: 10 connect or sign-in attempts a minute per account. Cost: free; connect your own account with its session string, 10 attempts a minute. Send your API key as a Bearer token in the Authorization header.

How this fits with the rest of the connected account API, with worked examples, is in the connected accounts guide.

Parameters

Parameters of POST /v1/accounts/session
NameInTypeDescription
Idempotency-KeyheaderstringOptional, 1 to 255 printable ASCII characters. A retry with the same key and body within 24 hours gets the first answer back with Idempotent-Replayed: true and is never charged again. The same key with a different body is 422; a retry while the first call is still running is 409.

Request body

JSON (ConnectSessionRequest). The signed-in session string of the account you connect. It is checked live once, stored encrypted and never returned.

Request body of POST /v1/accounts/session
FieldTypeDescription
session requiredstringThe account's session string, 1 to 8192 printable characters.
proxy_urlstring (uri)Optional: your own http, https or socks5 proxy for this account. Must be a public address. At most 2048 characters.
user_agentstringOptional: the browser user agent the session was created with. At most 512 characters.
Example body
{
  "session": "your-session-string"
}

Responses

Response codes of POST /v1/accounts/session
StatusMeaning
201Connected. What is connected, never the session.
400The request was invalid (e.g. a bad filter or input); nothing was charged.
401The API key is missing or invalid.
422session_logged_out: that session is signed out. Sign in to the account again and send a fresh session.
429Too many requests; retry after the window.
501session_connect_not_available_yet: this way of connecting is switched off on this server. Nothing was stored.
503temporarily_unavailable (nothing was stored; retry shortly), or egress_unavailable when no dedicated and no shared IP is free and no proxy_url was sent: No dedicated connection is free for a new account right now. Nothing was stored. Try again shortly, or connect with your own proxy_url.

Every error answers with the same JSON body, an error string and sometimes a code; the errors page lists each status and when it happens. A per-key 429 carries Retry-After; see rate limits.

201 response fields

Connected. What is connected, never the session. The body is a ConnectedAccount.

Fields of the 201 response
FieldTypeDescription
connected requiredbooleantrue when an account is connected.
statusstring: active, dead, connectingactive; connecting while a sign-in waits for a code or a check; or dead when the session has signed out and needs connecting again. Absent when nothing is connected.
accountobjectThe connected account as the platform names it.
account.handlestring or nullThe account's public handle.
account.namestring or nullThe account's display name.
egressstring: dedicated, shared_fallback, customer_proxy, noneHow the account reaches the platform. Every connected account acts through its own dedicated IP unless you bring your own proxy: dedicated (an IP leased to this account alone), shared_fallback (a shared IP, used only while every dedicated IP is taken), customer_proxy (your own proxy_url) or none.
created_atstring (date-time) or null
updated_atstring (date-time) or null
last_used_atstring (date-time) or nullWhen an action last ran on it.
account_idstring or nullThis account's id. Name it with account_id on any route that acts on a connected account; optional while the key has exactly one.
Response headers
HeaderMeaning
RateLimit-LimitRequests this API key may make per minute.
RateLimit-RemainingRequests left in the current one-minute window.
RateLimit-ResetSeconds until the current window resets.

Code samples

Each sample sends the same request. Set PROSPECTAPIS_KEY in your environment first. Values come from the spec's examples; replace them with your own.

curl
curl -X POST https://api.prospectapis.com/v1/accounts/session \
  -H "Authorization: Bearer $PROSPECTAPIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "session": "your-session-string" }'
JavaScript (fetch)
const res = await fetch("https://api.prospectapis.com/v1/accounts/session", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROSPECTAPIS_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "session": "your-session-string"
  }),
});
if (!res.ok) throw new Error(`${res.status}: ${(await res.json().catch(() => ({}))).error ?? res.statusText}`);
const data = await res.json();
console.log(data);
Python (requests)
import os, requests

res = requests.post(
    "https://api.prospectapis.com/v1/accounts/session",
    headers={"Authorization": f"Bearer {os.environ['PROSPECTAPIS_KEY']}"},
    json={
        "session": "your-session-string",
    },
    timeout=30,
)
res.raise_for_status()
data = res.json()
print(data)

Billing

The call itself is free, and what it sets up is billed as it runs: connect your own account with its session string, 10 attempts a minute. Metered spend on the same key is reported after each response in X-Credits-Remaining, and GET /v1/account shows the balance at any time.

The connected accounts guide covers this area end to end. Previous operation: Check the connected account. Next operation: Disconnect the account. Every operation, grouped by area, is on the API reference index.

Create a free account to get a key, then run the samples above with your own values (this call acts for real, so use real inputs).

Was this page helpful?