Guides
Usage history
See which billable calls were made, by which credential, how they ended and what they cost, replay a past search for free, and read daily totals.
Every billable call is recorded in the workspace's usage history: what was asked, when, by which kind of credential, how it ended and what it cost. Use it to reconcile spend, to find a request you want to report, or to look at a past search's records again without paying for them twice. The dashboard shows the same history at /usage.
All three routes need the dsp.usage.read scope and are free. Every field is in the usage history reference.
Who sees which runs#
The history a call returns depends on who makes it:
| Caller | Sees |
|---|---|
| An API key | Its own runs. |
| A signed-in person, or an app connected over OAuth | The person's own runs, and the runs of the API keys the person created. |
| A workspace admin | Every run of the workspace. |
So a key never reads another key's spend. To see the whole workspace's, an admin uses the dashboard's Usage screen.
List what was called#
GEThttps://api.sproutsdata.ai/v1/usage/history
curl "https://api.sproutsdata.ai/v1/usage/history?action_type=dsp.search&limit=50" \
-H "X-API-Key: $SPROUTS_API_KEY"Runs come newest first, each with:
id,occurred_atandaction_type: what kind of call it was.actor_type: the kind of credential that made it.status:pending,okorfailed, witherror_codewhen it failed.query,result_countandlatency_ms.credits_charged: what it cost, as a decimal string, ornullwhen nothing was metered.
The query parameters:
| Parameter | What it does |
|---|---|
action_type | Only runs of one kind (see below). |
from, to | An ISO 8601 window. The default is the last 30 days; a window is at most 90 days. |
limit | 1 to 100 (default 25). |
cursor | The next_cursor of the previous page. next_cursor is null on the last page. |
The action_type values are dsp.search, dsp.similar, dsp.entities (record lookup), dsp.relationships, dsp.org_chart, dsp.agents (agent runs), dsp.enrichment (lookups and jobs) and dsp.tools.run (Tools API runs).
Runs are kept for 90 days; a window that starts earlier is refused with 422.
Work that ends later#
An agent run, an enrichment job or a Tools run is recorded when it starts, as pending, and updated with its outcome and cost once it has been settled. One that can no longer be running but was never settled reads as failed, with error_code: "unsettled".
Open one run, and replay a search#
GEThttps://api.sproutsdata.ai/v1/usage/history/{run_id}
run_id is the run's id from the list. A Tools API run is read by its own run id (run_ and 32 hexadecimal characters), which is the id the list shows for it.
The detail adds what was sent and what came back:
request: the request as it was sent.resolved_search: how a search was read (its filters, query and category), as it was served.snapshotandsnapshot_state: for the first page of a search,snapshotholds that page's records again andsnapshot_stateispresent. For a later page of a search it iscontinuation, and for calls with nothing to replay,absent.
The replay is free. The records are looked up again, so they are current and can differ slightly from what was first served, while resolved_search is exactly what was served. A run you may not read, or one past the 90 days, is 404 with history.not_found.
Daily totals#
GEThttps://api.sproutsdata.ai/v1/usage/metrics
GET /v1/usage/metrics takes the same from and to (default the last 30 days) and returns totals for the window (total_requests, total_ok, total_failed, total_pending, total_credits) and buckets, one per day and action type, each with its requests, outcomes and credits. It covers the same runs the history shows the caller.
For the workspace's balance and every credit in and out, see Credits and usage.