Apify

Run Apify actors and saved tasks synchronously through a single gateway route
View as Markdown

Fronts run-sync execution for Apify actors and tasks on https://api.apify.com: trigger a saved task or an actor and receive its output — or its dataset items — in the same response. Whatever follows /apify/ is relayed to Apify, provided it names one of the run-sync actions:

POST /apify/<api path> → https://api.apify.com/<api path>

Admission is default-deny against a fixed allowlist: only the run-sync actions listed below get through, and every other path draws a 404 until the endpoint concerned is added to the allowlist. Mounted methods: POST.

Common paths

PathPurpose
POST /apify/v2/acts/{actorId}/run-sync-get-dataset-itemsRun an actor and get its dataset items inline
POST /apify/v2/acts/{actorId}/run-syncRun an actor and get the run output inline
POST /apify/v2/actor-tasks/{actorTaskId}/run-sync-get-dataset-itemsRun a saved task and get its dataset items inline
POST /apify/v2/actor-tasks/{actorTaskId}/run-syncRun a saved task and get the run output inline

Give {actorId} / {actorTaskId} in tilde form as one path segment (e.g. apify~web-scraper); the slash-separated username/name form is not accepted.

Credential handling

Apify will take its token through two channels — a token query parameter or an Authorization: Bearer header — and the gateway closes off both:

  • Authorization is overwritten with Apify’s secret token (Apify reads the very header that carries your gateway token). The gateway consumes your token itself; Apify never receives it.
  • A token supplied by the client in the query is discarded (any encoding), so nothing can displace the injected token.

Examples

$curl -X POST "$GATEWAY/apify/v2/acts/apify~website-content-crawler/run-sync-get-dataset-items" \
> -H "Authorization: Bearer $TOKEN" \
> -H "Content-Type: application/json" \
> -d '{"startUrls": [{"url": "https://example.com"}]}'

Responses arrive as Apify’s JSON, untouched. Field-level request and response detail lives in Apify’s API reference; the gateway modifies neither.