Skip to navigation

Start an asynchronous actor run

View as Markdown

Relays to https://api.apify.com/v2/acts/{actorId}/runs, rewriting Authorization to the secret Apify token; a client-sent token query parameter is discarded. The run starts and the run object comes back immediately — or, with waitForFinish, once the run has finished (up to 60 s), which covers most short jobs in one call. This replaces the retired run-sync actions.

The run and its data.defaultDatasetId are registered to your account before the response reaches you, so GET /apify/v2/actor-runs/{runId}, GET /apify/v2/datasets/{datasetId}/items, and the abort route are already authorized for you — and answer 404 for everyone else.

The create itself carries no flat charge. Once the run reaches a terminal state, it is charged once, priced from its own usageTotalUsd as read about 15 seconds after it finishes, to the account that created it.

Authentication

AuthorizationBearer

Your per-client bearer token — the API key the gateway issued to you. Present it in Authorization: Bearer <token> form. A token that is missing, unknown, or revoked draws a 401. Before the call is sent upstream the token is removed (stripped, or swapped for the upstream’s own credential); it never makes it past the gateway.

Path parameters

actorIdstringRequired

The actor, as one path segment in tilde form (e.g. apify~web-scraper). Apify’s slash-separated username/name spelling is not accepted here — it would split across path segments and miss the allowlist.

Query parameters

timeoutintegerOptional>=0
How long the run may take, in seconds, before Apify times it out. Apify's own default applies when omitted.
memoryintegerOptional

Memory for the run, in megabytes. Apify’s own default applies when omitted; more memory costs more compute.

buildstringOptional
A specific actor build tag or number to run, instead of the actor's default build.
waitForFinishintegerOptional>=0

Seconds to hold the response open waiting for the run to finish, up to Apify’s own maximum. The call still answers with the run object either way — it just may already be terminal, in which case the run’s exact usage, plus the gateway’s 5.5% fee, settles right there.

Request

The actor’s own input object, passed to Apify untouched — its shape is defined by the actor you are running, not by the gateway. See that actor’s page on Apify for its input schema.

Response

An asynchronous run was started and the run object returned. The run and its defaultDatasetId are registered to your account before this reaches you, so the very next poll or dataset read is already authorized — and no other account can make either.

Keep data.id to poll GET /apify/v2/actor-runs/{data.id}, and data.defaultDatasetId to read GET /apify/v2/datasets/{data.defaultDatasetId}/items once the run succeeds.

dataobjectOptional
The run object.

Errors

401
Unauthorized Error
404
Not Found Error
500
Internal Server Error