Docs / API reference

API

API reference

Create datasets and download their tables over HTTPS with JSON. Base URL https://useground.dev
export GROUND_API_KEY=gk_…

# 1. Create a dataset
curl https://useground.dev/api/dataset-graphs \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: invoices-1" \
  -d '{ "request": "Customers, subscriptions and monthly invoices" }'
# → { "id": "8d0f…", "jobId": "…", "status": "queued", … }

# 2. Check the build: repeat until job.status is succeeded
curl https://useground.dev/api/dataset-graphs/$ID -H "Authorization: Bearer $GROUND_API_KEY"

# 3. Download every table (one file, or a zip for several)
curl -L -o dataset.zip https://useground.dev/api/dataset-graphs/$ID/download -H "Authorization: Bearer $GROUND_API_KEY"

Authentication#

Create a key in Account settings → API keys and send it as a bearer token. Keys act as you; they can't manage keys or your account. API keys need a plan that includes API access.

Terminal
curl https://useground.dev/api/dataset-graphs/$ID \
  -H "Authorization: Bearer gk_…"

Idempotency#

Send an Idempotency-Key header (1–200 characters) when you create a dataset. Retrying with the same key and body returns the original result without another charge; reusing a key with a different body is refused.

Errors#

Errors are JSON { "error": "…" } with a status:

400Invalid input
401Missing or revoked key
402Usage limit reached
403Not allowed on your plan
404Not found, or not yours
409Out of date, or not ready yet

Create a dataset#

POST/api/dataset-graphs#

Send a request with an optional row count. Ground builds the tables in the background under your plan's usage limit.

requeststringrequired
What you need, in plain words.
rowsinteger
How many rows the main table should have. Leave it out to let Ground choose.
Body
{ "request": "Customers, subscriptions and monthly invoices", "rows": 5000 }
Returns
{ "id": "8d0f…", "version": "…", "jobId": "…", "status": "queued" }

GET/api/dataset-graphs/{id}#

The dataset's current version, its tables and the state of its build. Poll it until the build finishes.

POST/api/dataset-graphs/{id}/confirm#

Give the go-ahead to a build that is waiting for confirmation.

Download#

GET/api/dataset-graphs/{id}/download#

Download one table as its file or several as a ZIP. Add ?version={version}&format=csv to download a specific saved version as CSV, or omit version for the current one. Use format=json to return download metadata.

GET/api/dataset-graphs/{id}/download/{table}#

One table.

Delete#

DELETE/api/datasets/{id}#

Move the dataset to the trash. It can be restored until it is purged with its files.

POST/api/datasets/trash/{id}#

Restore a dataset from the trash.

DELETE/api/datasets/trash/{id}#

Delete a trashed dataset and its files forever.