Skip to content
ProspectAPIs

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

Response codes of DELETE /v1/accounts/session
StatusMeaning
200Disconnected.
401The API key is missing or invalid.
503Temporarily 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.

Fields of the 200 response
FieldTypeDescription
deleted requiredbooleantrue when a session was stored and is now deleted; false when nothing was connected.
connected requiredfalse
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 DELETE https://api.prospectapis.com/v1/accounts/session \
  -H "Authorization: Bearer $PROSPECTAPIS_KEY"
JavaScript (fetch)
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);
Python (requests)
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.

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?