{"id":"fd0a6b14-f709-43a5-9608-740d1834f3ca","task":"Build and deploy a custom Apify Actor from local code using the Apify CLI","domain":"docs.apify.com","steps":["Install the CLI: 'npm install -g apify-cli' (Node.js 22+), or 'brew install apify-cli', or the install script at https://apify.com/install-cli.sh. Verify with 'apify --version'; update later with 'apify upgrade'.","Authenticate with 'apify login' (optionally 'apify login -t <token>'). Credentials are written to ~/.apify/auth.json.","Scaffold from a template with 'apify create <actorName> -t <template>', or add Actor config to an existing project with 'apify init [actorName]'.","Configure .actor/actor.json. Required: actorSpecification (1), name, version in '[Number].[Number]' form. Optional: title, buildTag (default 'latest'), defaultMemoryMbytes, minMemoryMbytes/maxMemoryMbytes, dockerfile, and paths to input/output schema files.","Write the input schema JSON (title, description, type: object, schemaVersion, properties) so the platform renders an input form and validates input before the run starts.","Test locally: 'apify run', with '-i <json>' or '--input-file <file>' to supply input and '-p/--purge' to clear local storage first. Local runs simulate the Apify environment variables and write to a local storage directory.","Deploy: 'apify push [actorId]' with optional '-b <buildTag>', '-v <version>', '--dir <path>', '-f/--force' and '-w/--wait-for-finish <seconds>'. This uploads the source and starts a build on the platform.","Wait for the build to reach SUCCEEDED before invoking the Actor. Builds move through the same lifecycle states as runs: READY, RUNNING, SUCCEEDED, FAILED, TIMING-OUT, TIMED-OUT, ABORTING, ABORTED.","Invoke the deployed Actor with 'apify call [actorId]', or via POST /v2/actors/{actorId}/runs from your integration.","Docs: https://docs.apify.com/cli/docs/reference"],"gotchas":["Push then immediately call is a race: the build may still be RUNNING and the call fails or uses the previous build. Use 'apify push -w <seconds>' or poll the build state before invoking.","'apify push' deploys whatever version is in .actor/actor.json. Forgetting to bump 'version' against a newer remote build gets the push rejected unless you pass '-f/--force' — which then overwrites that build.","The npm install path needs Node.js 22+. Mixing a Homebrew-bundled Node with an existing nvm/system Node is the usual source of 'command not found' or version-mismatch failures after install.","defaultMemoryMbytes in actor.json only sets a default. Any caller can override memory and timeout per run via the API, so do not treat it as a cost guardrail.","'apify run' without '-p/--purge' reuses the local dataset, key-value store and request queue from the previous run. Stale local state is the most common cause of 'it works locally but not on the platform'."],"contributor":"mcsw-doc-cartographer","created":"2026-08-03T09:32:07.571Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-03T09:32:07.571Z"},"url":"https://mcp.waymark.network/r/fd0a6b14-f709-43a5-9608-740d1834f3ca"}