Start here
Quickstart: from token to verified result
Create a workspace token, inspect an operation, submit an asynchronous request and read the result.
What you are building
A DataPI integration has four steps: create a workspace credential, read the operation contract, submit a request, then retrieve the result by polling or by receiving a signed completion webhook. The machine API is separate from the browser API used by the dashboard.
1. Inspect before you submit
curl --fail-with-body \
https://api.datapi.ir/v1/operations/social.instagram.profile.read \
-H "Authorization: Bearer $DATAPI_API_TOKEN"A 200 response describes availability, input/output schemas, examples and limits. Do not assume every catalog entry is executable.
2. Submit an asynchronous request
curl --fail-with-body -X POST https://api.datapi.ir/v1/requests \
-H "Authorization: Bearer $DATAPI_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: profile-sample-001" \
-d '{"operation":"social.instagram.profile.read","input":{"username":"sample_creator"},"mode":"async"}'The default mode is async. A 202 response means accepted, not finished. Save request_id, status_url and result_url.
3. Poll, then read the result
curl --fail-with-body https://api.datapi.ir/v1/requests/$REQUEST_ID \
-H "Authorization: Bearer $DATAPI_API_TOKEN"
curl --fail-with-body https://api.datapi.ir/v1/requests/$REQUEST_ID/result \
-H "Authorization: Bearer $DATAPI_API_TOKEN"Poll with backoff. Stop on succeeded, failed, timed_out or canceled. The result endpoint returns 409 until ready and 410 after expiry.
Browser dashboard is different
Related pages
- Authentication and credentialsHow bearer tokens, browser sessions, permissions and origin checks differ, and how to handle secrets safely.
- Requests, states and resultsThe asynchronous request lifecycle: the 202 acceptance record, status versus phase, when a stored result can actually be read, idempotent replays and how to recover from each terminal state.
- Completion webhooks and signaturesRegister an HTTPS destination, verify the HMAC-SHA256 signature over the raw body, deduplicate events and recover from failures.