Skip to content
API

Standby mode

Serve HTTP from a warm Actor container, with autoscaling, billing, and errors.

Standby mode lets an Actor run as an always-on HTTP service. Instead of starting a fresh run for every request, the platform keeps a warm container alive and forwards your HTTP requests to it. It suits real-time APIs, on-demand scraping endpoints, and webhook receivers.

How it works

When you send an HTTP request to a standby-enabled Actor URL, Scrape.ly:

  1. Finds the Actor by username/actorName (the username is case-insensitive).
  2. Checks access: the Actor must be public, or yours.
  3. Checks that standby mode is enabled.
  4. Picks one of your standby runs of that Actor, or starts a new one. If the run is still starting (for example, another request just started it), Scrape.ly waits up to 5 minutes for it to become ready.
  5. Checks your effective balance (balance minus credits reserved by other running jobs).
  6. Forwards the request (method, path, query, headers, and body) to the container's web server.

Standby runs belong to the caller. Each user who calls a standby Actor gets their own runs, billed to their own account; your requests never go to another user's container.

A standby run stays alive while requests keep arriving, and stops after it has been idle for the Actor's idle timeout (5 minutes by default). Each request resets the idle timer.

The platform does not start an HTTP server for you. Your Actor process must listen on the web-server port (ACTOR_WEB_SERVER_PORT, 4321). If nothing is listening, requests fail because the container is not ready.

Endpoints

Authentication is always required, sent in the Authorization: Bearer header. All HTTP methods are accepted (GET, POST, PUT, PATCH, DELETE, HEAD, and others).

GET/v2/{username}/{actorName}
POST/v2/{username}/{actorName}
GET/v2/{username}/{actorName}/{path}
POST/v2/{username}/{actorName}/{path}

Both the Actor root and any subpath are forwarded. The subpath and query string are passed to the Actor's web server as they are.

.bash
curl "https://api.scrape.ly/v2/jane/my-api" \
  -H "Authorization: Bearer $SCRAPELY_TOKEN"

curl -X POST "https://api.scrape.ly/v2/jane/my-api/scrape?url=https://example.com" \
  -H "Authorization: Bearer $SCRAPELY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "depth": 1 }'
Path paramTypeDescription
usernamestringThe Actor owner's username (case-insensitive).
actorNamestringActor name.
pathstringOptional. Forwarded to the Actor's HTTP server.

The response is whatever the Actor returns: status code, headers, and body are passed through.

Before forwarding, the platform removes your credentials: Authorization, Proxy-Authorization, Cookie, and every X-Scrapely-* header are stripped, so the Actor never sees your API token. If your Actor needs its own authentication, use a different header or a query parameter.

These URLs share the /v2 namespace with the rest of the API, and the standby route is matched last. A username or Actor name that collides with an API path (for example /v2/actors/...) is handled by that API route instead.

Enabling standby mode

Enable standby in the Actor's settings in the dashboard, or set actorStandby with the Update Actor endpoint. Requests to an Actor that exists but doesn't have standby enabled return 400 standby-not-enabled.

actorStandby fieldDefaultDescription
isEnabledfalseTurns standby mode on.
buildlatestBuild tag or number that standby runs use. It must be a successful build. Other users' standby runs use the User Build when it's set.
memoryMbytes2048Memory for each standby run.
idleTimeoutSecs300Seconds without requests before a standby run stops.
desiredRequestsPerActorRun100Load target per run. When your runs average more than 80% of this, the next request starts another run.
maxRequestsPerActorRunnoneHard cap. A run that has served this many requests is stopped and replaced.

Standby runs have a 24-hour run timeout; the idle timeout normally ends them first.

Full-permission Actors need approval before your first standby request starts a run. Otherwise the request returns 403 full-permission-actor-not-approved.

Readiness

A GET or HEAD request to the Actor root that carries an x-scrapely-standby-readiness-probe (or x-apify-container-server-readiness-probe) header is answered by the platform itself with 200 and { "status": "ready", "timestamp": "..." }. It is not forwarded and doesn't start a run.

For real traffic, your Actor still has to bind the web-server port. See Standby mode in the JavaScript SDK for how to read the port and start a server.

Billing

Standby runs are billed to the caller like normal runs: compute time while the container is alive, plus platform usage. Requests are rejected with 402 insufficient-funds if your effective balance is zero or negative.

Errors

StatusTypeMeaning
400standby-not-enabledThe Actor exists but standby mode is off.
400actor-not-availableSomeone else's Actor has no build you can run right now.
401token-not-provided / token-not-validMissing or invalid Authorization header.
402insufficient-fundsEffective balance is zero or negative.
403forbiddenPrivate Actor you don't own.
403full-permission-actor-not-approvedThe Actor needs full permissions and you haven't approved it.
404actor-not-foundUnknown username/actorName.
500standby-errorA standby run could not be started, for example because your own Actor has no successful build or there's not enough credit. The message says why.
502proxy-errorThe request could not be forwarded to the container.
503standby-timeoutA new standby run did not become ready within 5 minutes.
503standby-not-readyAn existing standby run that was still starting did not become ready within 5 minutes.
503container-unavailableThe standby run's web server refused the connection, for example because it stopped. Retry.
503container-owner-unavailableThe server hosting the container cannot be reached. Retry.
504container-timeoutThe Actor did not respond within 5 minutes.