API reference / Connected account
Connect an account by signing in
Written and maintained by The ProspectAPIs team
POST/v1/accounts/login
POST /v1/accounts/login is the ProspectAPIs operation connectAccountLogin, in the Connected account group of the REST API. Connect your own account by signing in with its email or phone and password. When the account asks for a two-factor code, an emailed code or a check a person must finish, the answer is a 409 with a challenge_id (and a handoff_url for a check); send the same request again with code and challenge_id within 15 minutes. On success the session is stored exactly as with POST /v1/accounts/session: encrypted, used only for the actions you request, deleted when you disconnect. Free. Rate limit: 10 connect or sign-in attempts a minute per account. Cost: free; connect by signing in, with a code or a check when the account asks. 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
| Name | In | Type | Description |
|---|---|---|---|
| Idempotency-Key | header | string | Optional, 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 (AccountLoginRequest). Connect by signing in. Unless remember is true, the password is used for this sign-in only. When the account asks for a code or a check, send the same request again with code and the challenge_id from the 409. With totp_secret the two-factor code is typed for you; with remember: true a later sign-out is signed back in automatically.
| Field | Type | Description |
|---|---|---|
| identifier required | string | The account's sign-in email or phone. At most 320 characters. |
| password required | string | The account's password. At most 1024 characters. |
| code | string | The two-factor or emailed code, 4 to 12 letters or digits, on a resumed sign-in. |
| challenge_id | string | The challenge_id from the 409 that asked for a code or a check. Valid for 15 minutes. |
| proxy_url | string (uri) | Optional: your own http, https or socks5 proxy for this account. At most 2048 characters. |
| user_agent | string | Optional: the browser user agent to sign in with. At most 512 characters. |
| totp_secret | string | Optional: the authenticator app's setup key (the base32 text shown under the QR code, 16 to 128 characters). The two-factor code is then typed during the sign-in, with no 409. |
| remember | boolean | Optional opt-in to automatic re-login: keep the sign-in details (and totp_secret) encrypted so a session the platform signs out is signed back in on the account's own dedicated connection. Deleted when you disconnect. A connect without it clears an earlier opt-in. Default false. |
{
"identifier": "jane@example.com",
"password": "your-password"
}Responses
| Status | Meaning |
|---|---|
| 201 | Connected. What is connected, never the session. |
| 400 | The request was invalid (e.g. a bad filter or input); nothing was charged. |
| 401 | The API key is missing or invalid. |
| 409 | two_factor_required, email_code_required or captcha_required: one more step, see challenge_id and handoff_url. |
| 410 | challenge_expired: start the sign-in again. |
| 422 | bad_credentials (the sign-in details were not accepted) or account_restricted (the platform has restricted the account; only its holder can resolve that). |
| 429 | Too many requests; retry after the window. |
| 501 | login_not_available_yet: this way of connecting is switched off on this server. Nothing was stored. |
| 503 | temporarily_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.
| Field | Type | Description |
|---|---|---|
| connected required | boolean | true when an account is connected. |
| status | string: active, dead, connecting | active; 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. |
| account | object | The connected account as the platform names it. |
| account.handle | string or null | The account's public handle. |
| account.name | string or null | The account's display name. |
| egress | string: dedicated, shared_fallback, customer_proxy, none | How 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_at | string (date-time) or null | |
| updated_at | string (date-time) or null | |
| last_used_at | string (date-time) or null | When an action last ran on it. |
| account_id | string or null | This account's id. Name it with account_id on any route that acts on a connected account; optional while the key has exactly one. |
| Header | Meaning |
|---|---|
| RateLimit-Limit | Requests this API key may make per minute. |
| RateLimit-Remaining | Requests left in the current one-minute window. |
| RateLimit-Reset | Seconds 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 -X POST https://api.prospectapis.com/v1/accounts/login \
-H "Authorization: Bearer $PROSPECTAPIS_KEY" \
-H "Content-Type: application/json" \
-d '{ "identifier": "jane@example.com", "password": "your-password" }'const res = await fetch("https://api.prospectapis.com/v1/accounts/login", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROSPECTAPIS_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"identifier": "jane@example.com",
"password": "your-password"
}),
});
if (!res.ok) throw new Error(`${res.status}: ${(await res.json().catch(() => ({}))).error ?? res.statusText}`);
const data = await res.json();
console.log(data);import os, requests
res = requests.post(
"https://api.prospectapis.com/v1/accounts/login",
headers={"Authorization": f"Bearer {os.environ['PROSPECTAPIS_KEY']}"},
json={
"identifier": "jane@example.com",
"password": "your-password",
},
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 by signing in, with a code or a check when the account asks. 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.
Related
The connected accounts guide covers this area end to end. Previous operation: Disconnect the account. Next operation: List conversations (live). 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?