Authentication & Rate Limits
Create an API key in the Developer Console → Settings. Keys start with dsapi_ and are stored solely as SHA-256 digests. Pass your key via Authorization: Bearer dsapi_... or X-API-Key: dsapi_....
curl -s "https://api.datasetapi.ai/v1/me" \
-H "Authorization: Bearer dsapi_YOUR_KEY"
Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. Anonymous catalog reads allow 60 req/min; authenticated keys start at 180 req/min (Free), 1,200 req/min (Pro), and 6,000 req/min (Scale).
1. Push Records Directly (`POST /v1/datasets/push`)
Ideal for Python pipelines, evaluation harnesses, scrapers, and edge workers. Send either a structured JSON body with records or stream raw newline-delimited JSON (`application/x-ndjson`). Set publish: true to automatically list the validated dataset on the public Hub, and wait: 10 (0–30s) to await completion synchronously.
import httpx
r = httpx.post(
"https://api.datasetapi.ai/v1/datasets/push",
headers={"Authorization": "Bearer dsapi_YOUR_KEY"},
json={
"name": "rag-hybrid-eval-2026",
"task": "text-retrieval",
"license": "apache-2.0",
"description": "Evaluation pairs comparing RRF hybrid retrieval against dense-only search.",
"tags": ["rag", "benchmark", "retrieval"],
"publish": True,
"wait": 15,
"records": [
{
"question": "When does BM25 + dense RRF outperform pure dense embeddings?",
"answer": "On exact SKU codes, error identifiers, and rare domain acronyms where subword tokenizers dilute exact lexical matches.",
"source": "https://example.org/rag-eval"
}
],
},
timeout=30.0,
)
print(r.json())
Streaming Raw NDJSON From Shell / Logs
cat clean_traces.jsonl | curl -X POST \
"https://api.datasetapi.ai/v1/datasets/push?name=agent-traces-2026&task=text-generation&wait=15" \
-H "Authorization: Bearer dsapi_YOUR_KEY" \
-H "Content-Type: application/x-ndjson" \
--data-binary @-
2. Upload Dataset Files (`POST /v1/datasets/upload`)
Streams binary or text files (.parquet, .jsonl, .ndjson, .csv, .tsv, .json, .md, .txt) directly to disk in 1 MB chunks, then runs schema role inference, exact/near-duplicate flagging, and PII profiling.
curl -X POST "https://api.datasetapi.ai/v1/datasets/upload" \
-H "Authorization: Bearer dsapi_YOUR_KEY" \
-F "file=@./dataset.parquet" \
-F "name=sql-optimization-corpus" \
-F "task=code-generation" \
-F "license=mit" \
-F "publish=true" \
-F "wait=15"
3. Pull From Remote URL (`POST /v1/datasets/from-url`)
Point DatasetAPI at any public HTTPS object URL (S3 presigned URL, Cloudflare R2, GCS, or GitHub release asset) to ingest without downloading and re-uploading through your client machine.
curl -X POST "https://api.datasetapi.ai/v1/datasets/from-url" \
-H "Authorization: Bearer dsapi_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://storage.example.com/exports/incidents_2026.jsonl",
"name": "k8s-incidents-2026",
"task": "text-classification",
"publish": false,
"wait": 15
}'
4. Incremental Batch Append (`POST /v1/projects/{id}/append`)
Append daily or hourly batches to an existing JSONL dataset. DatasetAPI appends the new records, re-runs cross-batch deduplication so overlapping runs never create duplicate training rows, and updates public catalog row counts automatically.
curl -X POST "https://api.datasetapi.ai/v1/projects/42/append" \
-H "Authorization: Bearer dsapi_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"records": [{"prompt": "New daily sample", "completion": "Verified output"}], "wait": 10}'
5. Stream Compiled Exports (`GET /v1/projects/{id}/export/{fmt}`)
Download any private or public dataset in rows.jsonl, rows.csv, qa.jsonl, alpaca.jsonl, chatml.jsonl, sharegpt.jsonl, chunks.jsonl, report.json, or all.zip. Add ?mask_pii=1 on private exports to redact personal identifiers.
curl -L "https://api.datasetapi.ai/v1/projects/42/export/chatml.jsonl?mask_pii=1" \
-H "Authorization: Bearer dsapi_YOUR_KEY" -o train_chatml.jsonl
6. Querying the Public Dataset Catalog
# Search public datasets
curl -s "https://api.datasetapi.ai/v1/datasets?task=question-answering&sort=rows" | jq .
# Inspect dataset schema, quality score & export URLs
curl -s "https://api.datasetapi.ai/v1/datasets/datasetapi/localllama-finetuning-qa-2026" | jq .
# Paginate verified rows as JSON
curl -s "https://api.datasetapi.ai/v1/datasets/datasetapi/localllama-finetuning-qa-2026/rows?limit=10&q=lora" | jq .