API reference / Connected account
Disconnect the account
Written and maintained by The ProspectAPIs team
DELETE/v1/accounts/session
DELETE /v1/accounts/session is the ProspectAPIs operation disconnectAccount, in the Connected account group of the REST API. Disconnect your account: the stored session is deleted from our database. Safe to call again, and it works at a zero balance. Free. Cost: free; disconnect and delete the stored session. 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
This operation takes no path or query parameters.
Responses
| Status | Meaning |
|---|---|
| 200 | Disconnected. |
| 401 | The API key is missing or invalid. |
| 503 | Temporarily unavailable. Try again shortly. |
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.
200 response fields
Disconnected. The body is a AccountDisconnected.
| Field | Type | Description |
|---|---|---|
| deleted required | boolean | true when a session was stored and is now deleted; false when nothing was connected. |
| connected required | false |
| 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 DELETE https://api.prospectapis.com/v1/accounts/session \
-H "Authorization: Bearer $PROSPECTAPIS_KEY"const res = await fetch("https://api.prospectapis.com/v1/accounts/session", {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.PROSPECTAPIS_KEY}` },
});
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.delete(
"https://api.prospectapis.com/v1/accounts/session",
headers={"Authorization": f"Bearer {os.environ['PROSPECTAPIS_KEY']}"},
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: disconnect and delete the stored session. 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: Connect an account with a session. Next operation: Connect an account by signing in. 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?