Machine API · Data API
POST /v1/requests
Accepts an operation request. With mode=async (the default) it returns 202 and URLs for status and result. Idempotency-Key prevents duplicate work when the same request is retried. Synchronous execution is not supported by current operations.
Contract identity
- Contract version
- 1.0.0
- Last verified
- Public surface
- Machine API
- Executable operations
- 11 / 40
Verified means the contract snapshot on this date was read and matched to the page. It is not a promise that an operation is live for your workspace.
Goal and how to use this API
Collect data through a stable operation contract without maintaining a separate client for every source.
Practical example
Submit a public-profile operation with its concrete input, persist the acceptance record — including request_id, phase and the result block — and add a request-scoped webhook when the job should report back instead of being polled.
Integration steps
- Define the user decision and target entity, then check input requirements and access.
- Prepare the parameters and model below, then call POST /v1/requests with this page’s authentication method.
- Persist the acceptance response and its identifier, then follow the status or run route this response returns until it reaches a terminal state before reading the successful result.
A 202 acceptance is not completion and its result.available is false. Keep the same idempotency key and payload when retrying the same intended submission, and store the webhook signing secret from this response before it is gone.
At a glance
- Audience
- Machine API
- Pagination
- No
- Asynchronous
- Yes
- Idempotency
- Yes
Authentication
Workspace bearer token: Authorization: Bearer $DATAPI_API_TOKEN. The token must have the permission required by this route.
Open the matching dashboard featureParameters and constraints
| Name | In | Type | Required | Constraints / default |
|---|---|---|---|---|
| Idempotency-Key | header | string | null | Optional | — |
Request body
application/json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| constraints | object | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1] | object | Optional | additional properties: false | Per-request overrides; they narrow, never widen, the profile. |
| constraints [anyOf 1].max_cost | number | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_cost [anyOf 1] | number | Optional | min: 0 | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_cost [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_cost_per_1000 | number | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_cost_per_1000 [anyOf 1] | number | Optional | min: 0 | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_cost_per_1000 [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_duration_seconds | number | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_duration_seconds [anyOf 1] | number | Optional | greater than: 0 | Field description is not supplied by the contract. |
| constraints [anyOf 1].max_duration_seconds [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_fields | integer | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_fields [anyOf 1] | integer | Optional | min: 0 | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_fields [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_quality | number | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_quality [anyOf 1] | number | Optional | min: 0 · max: 1 | Field description is not supplied by the contract. |
| constraints [anyOf 1].min_quality [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| constraints [anyOf 1].official_only | boolean | Optional | default: false | Field description is not supplied by the contract. |
| constraints [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| data_mode | string | Optional | enum: "localdata", "freshdata" · default: "localdata" | Field description is not supplied by the contract. |
| input | object (fields not enumerated) | Optional | additional properties: true | Field description is not supplied by the contract. |
| mode | string | Optional | enum: "sync", "async" · default: "async" | Field description is not supplied by the contract. |
| operation | string | Required | — | Field description is not supplied by the contract. |
| preference | string | null | Optional | — | Field description is not supplied by the contract. |
| preference [anyOf 1] | string | Optional | enum: "cheapest", "balanced", "best-quality", "max-data", "fastest" | Field description is not supplied by the contract. |
| preference [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| webhook | object | null | Optional | — | Field description is not supplied by the contract. |
| webhook [anyOf 1] | object | Optional | — | A signed completion endpoint that belongs to this request only. |
| webhook [anyOf 1].event_types | array<string> | null | Optional | — | Field description is not supplied by the contract. |
| webhook [anyOf 1].event_types [anyOf 1] | array<string> | Optional | — | Field description is not supplied by the contract. |
| webhook [anyOf 1].event_types [anyOf 1][] | string | Required | — | Field description is not supplied by the contract. |
| webhook [anyOf 1].event_types [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
| webhook [anyOf 1].url | string | Required | min length: 1 · max length: 2048 | Field description is not supplied by the contract. |
| webhook [anyOf 2] | null | Optional | — | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/CreateRequest"
}Required means required within the containing object; an optional parent can still be omitted.
Request example
Examples are illustrative contract samples, not live results. Replace sample identifiers and inspect availability before executing a request.
curl --fail-with-body -X POST "https://api.datapi.ir/v1/requests" \
-H "Authorization: Bearer $DATAPI_API_TOKEN" \
-H "Idempotency-Key: example-request-001" \
-H "Content-Type: application/json" \
-d ' {
"operation": "social.instagram.profile.read",
"input": {
"username": "sample_creator"
},
"mode": "async"
}'Try it
Responses and errors
| Status | Description | Schema |
|---|---|---|
| 200 | Synchronous operation result (mode=sync) | object (fields not enumerated) |
| 202 | Asynchronous request accepted (default mode=async) | unspecified |
| 400 | Invalid request fields or operation input | unspecified |
| 401 | Authentication required or expired | unspecified |
| 404 | Resource or operation not found | unspecified |
| 409 | Conflicting request state | unspecified |
| 429 | Request allowance limit reached | unspecified |
| 503 | Operation or service unavailable | unspecified |
{
"data": {
"created_at": "2026-10-24T08:30:00+00:00",
"operation": "social.instagram.profile.read",
"phase": "queued",
"request_id": "0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0",
"result": {
"available": false,
"expired": false,
"expires_at": "2026-10-25T08:30:00+00:00",
"retention_hours": 24,
"url": "https://api.datapi.ir/v1/requests/0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0/result"
},
"result_url": "https://api.datapi.ir/v1/requests/0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0/result",
"status": "queued",
"status_url": "https://api.datapi.ir/v1/requests/0f1e2d3c-4b5a-6978-8796-a5b4c3d2e1f0",
"webhook": {
"configured": true,
"endpoint_id": "9c8b7a65-4321-4fed-8cba-0987654321fed",
"event_type": "request.completed",
"signature_headers": [
"X-DataPI-Signature",
"X-DataPI-Timestamp",
"X-DataPI-Event-Id",
"X-DataPI-Delivery-Attempt"
],
"signing_secret": "dapi_whsec_example"
}
},
"meta": {
"request_id": "req_example"
}
}Complete response models
200 · application/json
The runtime contract does not enumerate this response. An example is not a guaranteed model; this response remains a contract documentation gap.
Full contract schema
{
"additionalProperties": true,
"title": "Response Create Request V1 Requests Post",
"type": "object"
}202 · application/json
The runtime contract does not enumerate this response. An example is not a guaranteed model; this response remains a contract documentation gap.
Full contract schema
{}400 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}401 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}404 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}409 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}429 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}503 · application/problem+json
| Field | Type | Required | Constraints / default | Description |
|---|---|---|---|---|
| (body) | object | Required | — | Field description is not supplied by the contract. |
| code | string | Required | — | Field description is not supplied by the contract. |
| detail | string | Required | — | Field description is not supplied by the contract. |
| error | object | Required | — | Field description is not supplied by the contract. |
| error.error | object | Required | — | Field description is not supplied by the contract. |
| error.error.code | string | Required | — | Field description is not supplied by the contract. |
| error.error.details | unspecified | Optional | — | Field description is not supplied by the contract. |
| error.error.message | string | Required | — | Field description is not supplied by the contract. |
| error.error.request_id | string | Required | — | Field description is not supplied by the contract. |
| instance | string | Optional | — | Field description is not supplied by the contract. |
| request_id | string | Required | — | Field description is not supplied by the contract. |
| status | integer | Required | — | Field description is not supplied by the contract. |
| title | string | Required | — | Field description is not supplied by the contract. |
| type | string (uri) | Required | format: uri | Field description is not supplied by the contract. |
Full contract schema
{
"$ref": "#/components/schemas/DataPIProblem"
}Operational notes
- The base URL is https://api.datapi.ir. Prefer the exact path shown; do not add a trailing slash.
- Supply Idempotency-Key for retry-safe creation. Reusing the key with a different payload can produce a conflict rather than duplicate work.
- A 202 response means the work was accepted, not completed. Poll the status URL or wait for the signed completion webhook before reading the result.
- Contract version 1. Responses use the stable DataPI error envelope; unknown optional fields should be ignored by clients.
Related pages
- All endpointsPublic HTTP API at api.datapi.ir. Authenticate with a workspace bearer token from the dashboard.
- Data operations and requestsThe core public machine API: operation directory, asynchronous request creation, request status and stored results.
- Related operation IDsRelated operation IDs
- Request lifecycleRequest lifecycle
- Error envelopeError envelope