Skip to content

Apify Resources & Environment

  • Memory must be a power of 2, between 128MB and 32768MB (e.g., 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 MB) [Usage and resources]
  • If not specified at run time, the Actor’s configured default memory is used
  • You can set minMemoryMbytes and maxMemoryMbytes in actor.json to constrain what users can allocate [Set memory limits]
  • Memory can also be dynamic — calculated from input before the run starts via a MathJS expression in actor.json [Dynamic memory]
  • CPU is automatically derived from memory: 1 full CPU core per 4096MB
  • On startup, an Actor may temporarily burst above its CPU allocation to start faster
  • Disk space = 2× allocated memory (e.g., 1024MB memory → 2048MB disk) [Usage and resources]

These are automatically injected into your container by the platform: [System env vars]

VariableDescription
ACTOR_MEMORY_MBYTESAllocated memory in MB (use to derive CPU allocation)
ACTOR_IDID of the Actor definition
ACTOR_RUN_IDID of this specific run
ACTOR_TASK_IDID of the task (empty if run directly via API)
ACTOR_DEFAULT_DATASET_IDDefault dataset for output
ACTOR_DEFAULT_KEY_VALUE_STORE_IDDefault key-value store (input is stored here)
ACTOR_DEFAULT_REQUEST_QUEUE_IDDefault request queue
ACTOR_INPUT_KEYKey in KV store where input is stored (usually INPUT)
ACTOR_EVENTS_WEBSOCKET_URLWebSocket URL for receiving real-time platform events
ACTOR_TIMEOUT_ATISO 8601 timestamp when the run will time out
ACTOR_STARTED_ATISO 8601 timestamp when the run started
ACTOR_WEB_SERVER_PORTTCP port for an optional HTTP server your container can expose
ACTOR_WEB_SERVER_URLPublic URL for the above server
APIFY_TOKENAPI token for calling Apify APIs
APIFY_IS_AT_HOME1 if running on Apify servers
APIFY_PROXY_PASSWORDPassword for Apify Proxy (if used)
ACTOR_MAX_PAID_DATASET_ITEMSMax items for pay-per-result Actors
ACTOR_MAX_TOTAL_CHARGE_USDMax charge for pay-per-event Actors

Connect to ACTOR_EVENTS_WEBSOCKET_URL to receive JSON messages: [System events]

{
"name": "cpuInfo",
"createdAt": "2024-01-01T00:00:00Z",
"data": { "isCpuOverloaded": false }
}
EventPayloadUse
cpuInfo{ isCpuOverloaded: bool }Detect CPU pressure, throttle concurrency
migrating{ timeRemainingSecs: float }Persist state before server migration
abortingnoneClean up before graceful abort
persistState{ isMigrating: bool }Save state at regular intervals (every ~60s)
  • Global API rate limit: 250,000 requests/minute (per authenticated user) [API limits]
  • Per-resource rate limit: 60 requests/second per resource (some endpoints: 200–400 req/s)
LimitValue
Max concurrent runs (Business plan)256
Max log size10,485,760 characters
Build timeout1,800 seconds
Max metamorphs per run10

[Platform limits]

CU = (Memory in MB / 1024) × (Duration in hours)

Example: 1024MB × 1 hour = 1 CU [Usage and resources]