Guides
Lists and exports
Save companies, people and documents to lists your whole workspace shares, read them back as current records, and export lists or search rows as CSV files.
A saved list keeps records you want to come back to: target accounts, a shortlist of people, a set of patents. Lists belong to the workspace, so every member and every API key of the workspace sees the same lists, and can change them with the right scope. The dashboard shows them at /lists.
Reading lists needs dsp.lists.read. Creating, renaming and deleting lists, and adding or removing records, need dsp.lists.write. Every field and error is in the lists reference and the exports reference.
Create and manage lists#
| Task | Request | Notes |
|---|---|---|
| See every list | GET /v1/lists | Not paged. Also returns saved_items, the distinct records saved across all lists. |
| Create a list | POST /v1/lists | 201 with the list. A name (1 to 120 characters) and an optional category. |
| Rename a list | PATCH /v1/lists/{list_id} | Body: { "name": "…" }. |
| Delete a list | DELETE /v1/lists/{list_id} | 204. Its records go with it. |
A list's name is unique in the workspace, ignoring case: a second list with the same name is 409 with lists.name_taken. A list holds one kind of record. Set it with category (company, person, or a document category such as patent), or leave it out and the first records added set it.
curl -X POST "https://api.sproutsdata.ai/v1/lists" \
-H "X-API-Key: $SPROUTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Target accounts", "category": "company" }'Add and remove records#
POST /v1/lists/{list_id}/items adds up to 1,000 records a request. Name each by its category and an id:
- a company: its
company_ref, its domain, or its LinkedIn page; - a person: their LinkedIn profile URL;
- a document: the
idsearch returned for it.
curl -X POST "https://api.sproutsdata.ai/v1/lists/0614e3fd-5c2b-4c8e-9a51-7a3d2e1b9f40/items" \
-H "X-API-Key: $SPROUTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{ "category": "company", "id": "stripe.com" },
{ "category": "company", "id": "adyen.com" }
]
}'Each record is looked up and saved by its stable id, so a domain and a LinkedIn page for the same company are one record. The answer counts what happened to each:
| Field | Meaning |
|---|---|
added | Saved now. |
already_present | Already on the list; nothing changed. |
suppressed | Refused: the record is on the Do-Not-Contact list. |
not_found | Named nothing that could be found. |
credits_charged | What the call cost (see What reading a record costs). |
DELETE /v1/lists/{list_id}/items takes the same body and answers how many records were removed.
Read a list's records#
GET /v1/lists/{list_id}/items returns the records newest first, limit 1 to 100 (default 25), in the envelope every read answers: results, total, has_more and next_cursor, with the list itself in saved_list. While has_more is true, send next_cursor back as cursor. GET /v1/lists answers the same envelope, every list in one page.
Each record is read again when you ask, so it is current rather than a copy from when it was saved. An item whose record can no longer be read has available: false and an unavailable_reason: not_found, or retrieval_unavailable when it could not be read right now.
What reading a record costs#
What a record shows depends on the workspace and the credential, and the answer says which in field_tier:
unlocked: the whole record. A workspace that has bought credits, calling with a credential that holdsdsp.entities.read, sees records whole.free: the fields a search row shows. Every other caller sees these, at no charge.
Seeing a record whole is paid for once. Each record shown whole that the workspace has not unlocked in the last 90 days costs the record lookup price (1 credit by default) and stays unlocked for 90 days. This applies when records are added, when they are read, and when they are exported, and credits_charged on an add, meta.credits_charged on a read (or the X-Credits-Charged header on an export) reports it. The charge is all or nothing: if the balance cannot pay for every record due, the answer is 402 with credits.insufficient and nothing is added or shown.
Export a list or search rows as CSV#
Two routes write a CSV file:
| Route | Exports | Scope |
|---|---|---|
POST /v1/lists/{list_id}/export | The list as it is now, newest first. Optional body: offset and limit. | dsp.lists.read |
POST /v1/search/export | The rows you pick, by category and id, in the order you send. | dsp.search.read or dsp.entities.read |
The size decides how the file comes back:
- Up to 1,000 rows:
200with the CSV itself (text/csv). The headers reportX-Export-Row-Count,X-Export-Skipped(records that could not be found, or are on the Do-Not-Contact list),X-Export-Field-TierandX-Credits-Charged. - More rows:
202with an export job. PollGET /v1/exports/{job_id}untilstatusisdone(orfailed), then download the file from itsfile_url,GET /v1/exports/{job_id}/file. The file is kept for 24 hours;expires_atsays when it goes. - Over 50,000 rows: refused with
422andexport.too_large. Export in ranges withoffsetandlimit.
Exports follow the same field and charge rules as reading a list. A job is checked against the balance when you ask for it (402 if it could not be paid) and charged when its file is ready; a job the balance can no longer pay for by then fails, with nothing charged. A list export includes the list as it was when you asked, so records added meanwhile are neither duplicated nor skipped. Cells that a spreadsheet would read as formulas are neutralized.
import os
import time
import requests
API = "https://api.sproutsdata.ai"
HEADERS = {"X-API-Key": os.environ["SPROUTS_API_KEY"]}
LIST_ID = "0614e3fd-5c2b-4c8e-9a51-7a3d2e1b9f40"
response = requests.post(f"{API}/v1/lists/{LIST_ID}/export", headers=HEADERS, json={}, timeout=60)
response.raise_for_status()
if response.status_code == 202: # a job: poll it, then download the file
job = response.json()
while job["status"] in ("queued", "running"):
time.sleep(5)
job = requests.get(f"{API}/v1/exports/{job['job_id']}", headers=HEADERS, timeout=30).json()
if job["status"] != "done":
raise SystemExit(f"The export failed: {job['error']}")
response = requests.get(f"{API}{job['file_url']}", headers=HEADERS, timeout=60)
response.raise_for_status()
with open("export.csv", "w", encoding="utf-8") as file:
file.write(response.text)
print("Rows:", response.headers["X-Export-Row-Count"])Limits#
| Limit | Default | When reached |
|---|---|---|
| Lists per workspace | 1,000 | 409 lists.item_cap_reached |
| Records per list | 50,000 | 409 lists.item_cap_reached |
| Records per add or remove request | 1,000 | 422 request.invalid |
| Rows per export | 50,000 | 422 export.too_large |
A workspace that has not bought credits may also have a cap on the records it saves across all its lists. GET /v1/lists reports it as saved_items_cap (null when there is none), and going over it is 409 with lists.item_cap_reached. Adding a record of another kind than the list holds is 422 with lists.category_mismatch. A list that does not exist in the workspace is 404 with lists.not_found, and an export job that does not exist or has expired is 404 with export.not_found.