Guides
Data API
Run SQL from your own code: one HTTP call, an API key, JSON back.
Everything Search does is one HTTP call you can make yourself. Base URL: https://api.datasocial.ai
Get a key
Sign in, open the API keys tab and create a key. It looks like ds_live_… and is shown once, so copy it somewhere safe. Send it as a bearer token. Queries with a key are charged to your credits, exactly like Search.
Without a key the API still answers, with the free limits (1,000 rows, 10 seconds, 20 queries a minute per address).
Run a query
curl https://api.datasocial.ai/v1/data/sql \
-H "Authorization: Bearer $DATASOCIAL_KEY" \
-H 'content-type: application/json' \
-d '{"sql": "SELECT username, followers FROM tiktok.creators WHERE country = '\''US'\'' ORDER BY followers DESC LIMIT 3"}'The response
{
"columns": [{ "name": "username", "type": "String" }, { "name": "followers", "type": "UInt32" }],
"rows": [["khaby.lame", 162989705], ["charlidamelio", 160221160], ["tiktok", 95949280]],
"row_cap": 1000,
"capped": false,
"rows_read": 5029786,
"bytes_read": 65283020,
"elapsed_ms": 187
}rowsare arrays in the order ofcolumns. 64-bit integers (ids) arrive as strings.cappedis true when the result hit the row cap (row_cap).- With a key,
creditssays what the query cost and what is left:{"charged": 3, "balance": 997}.
Errors
A failed query answers with a status and {"error": "…"} in plain words. Errors are free.
| Status | Means |
|---|---|
| 400 | The SQL has a mistake; the message says where. |
| 401 | The key or session is missing, wrong or expired. |
| 402 | Out of credits (code: "insufficient_credits"). |
| 403 | Not allowed: another database, a setting, a write, or a premium column. |
| 429 | Too many queries at once or per minute. Wait a moment. |
Endpoints
| Endpoint | What it does | Status |
|---|---|---|
POST /v1/data/sql | Runs one read-only query on tiktok; body {"sql": "…"}. | Open |
GET /v1/tables | Every table and column, with live row counts. | Open |
GET /v1/live/* | Six live reads of TikTok, 2 credits each. See the Live API tab. | Opening soon |
POST /v1/ask | A question in plain English → {"sql", "table", "chart", "note"}, checked but not run; body {"question": "…"}. 30 credits. | Open |
POST /v1/ask/dashboard | One sentence → a dashboard plan: 4–6 tiles, each with its SQL (using the filter parameters), tile type and place, checked but not run; body {"prompt": "…"}. 30 credits per tile, 180 at most. Signed in only. | Open |
POST /v1/ask/tile | One tile changed by an instruction; body {"instruction": "make this weekly", "sql": "…", "chart": {…}, "filters": {…}}. 30 credits. Signed in only. | Open |