Quickstart with the API
Upload a file, create a project, run it and download the results with curl, Node or Python.
This guide runs the companies.csv file of the quickstart with the API.
The API lives at https://dataflow.piloterr.com and takes the API key of your workspace in the x-api-key header, as the Piloterr API does. Find it in the dashboard under API → API keys, and give it Dataflow access: Read and write for this guide, Admin for webhooks, cloud storage and deliveries. A key without it answers 403 api_key_scope. See What a key can do.
Find the endpoint
GET /v1/endpoints lists every endpoint you can run, with its id, parameters and credit cost.
Upload the file
POST /v1/inputs takes the file as multipart/form-data and returns the input, with its id and columns.
Create the project
POST /v1/projects with the endpoint, the input and the mapping. output_formats defaults to ["json"], the pace to 50% of your rate limit, with no cost cap and the managed Dataflow key; an endpoint billed per result or per GB needs a max_cost_per_run. Creating a project does not start a run.
To send a POST again after a network error without doing it twice, add an Idempotency-Key header: see Send a request again safely.
Start a run and wait
POST /v1/projects/{id}/runs answers 202 with the run, or 402 insufficient_credits when your balance does not cover every row. Read it with GET /v1/runs/{id} until its status is completed, failed or cancelled.
Download the results
GET /v1/runs/{id}/export?format=csv returns the file.
# Needs curl and jq.
KEY="x-api-key: YOUR_API_KEY"
API=https://dataflow.piloterr.com
ENDPOINT=$(curl -s $API/v1/endpoints -H "$KEY" \
| jq -r '.items[] | select(.path == "/v2/company") | .id')
INPUT=$(curl -s $API/v1/inputs -H "$KEY" -F file=@companies.csv | jq -r .id)
PROJECT=$(curl -s $API/v1/projects -H "$KEY" -H 'content-type: application/json' -d "{
\"name\": \"Enrich companies\",
\"endpoint_id\": \"$ENDPOINT\",
\"input\": {\"type\": \"file\", \"input_id\": \"$INPUT\"},
\"mapping\": {\"query\": {\"column\": \"website\"}},
\"output_formats\": [\"csv\"]
}" | jq -r .id)
RUN=$(curl -s -X POST $API/v1/projects/$PROJECT/runs -H "$KEY" | jq -r .id)
# Wait for the run to end.
while true; do
STATUS=$(curl -s $API/v1/runs/$RUN -H "$KEY" | jq -r .status)
echo "$STATUS"
case $STATUS in completed|failed|cancelled) break ;; esac
sleep 5
done
curl -s "$API/v1/runs/$RUN/export?format=csv" -H "$KEY" -o results.csvA run can also stop in paused when your workspace runs out of credits. It resumes on its own after a top-up, so keep waiting, or see Runs to resume it yourself. A run still paused after 7 days fails.