API reference / Connected account
Reconnect an account
Written and maintained by The ProspectAPIs team
POST/v1/accounts/:account_id/reconnect
POST /v1/accounts/:account_id/reconnect is the ProspectAPIs operation reconnectConnectedAccount, in the Connected account group of the REST API. Connect the same account again after it signed out, keeping its account_id: a session string or a sign-in. Free. Cost: free; connect the same account again, same account_id. 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 |
|---|---|---|---|
| account_id required | path | string | The account_id from GET /v1/accounts. |
| 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 (AddAccountRequest). Either a signed-in session (as POST /v1/accounts/session takes) or a sign-in (as POST /v1/accounts/login takes).
| Field | Type | Description |
|---|
{}Responses
| Status | Meaning |
|---|---|
| 201 | Reconnected. |
| 400 | Invalid request. |
| 401 | The API key is missing or invalid. |
| 404 | No account with that id on this key. |
| 409 | A code or a check is needed, or the session belongs to another connected account. |
| 422 | The session is signed out, or the sign-in was not accepted. |
| 429 | Too many connect attempts. |
| 503 | Temporarily unavailable. |
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
Reconnected. 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/account id/reconnect \
-H "Authorization: Bearer $PROSPECTAPIS_KEY" \
-H "Content-Type: application/json" \
-d '{}'const res = await fetch("https://api.prospectapis.com/v1/accounts/account id/reconnect", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROSPECTAPIS_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({}),
});
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/account id/reconnect",
headers={"Authorization": f"Bearer {os.environ['PROSPECTAPIS_KEY']}"},
json={},
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 the same account again, same account_id. 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: Remove a connected account. Next operation: Finish an account's sign-in check. 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?