Apify Integration Development
ApifyOfficialPublished by Apify
- Skill
- Tool integration
- Automation and integrations
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach for developers to build official Apify integrations across various platforms, including workflow automation tools, AI agent plugins, and framework packages. It outlines the Apify model, cross-cutting design rules such as asynchronous run flows, cost control mechanisms, and authentication standards. The skill emphasizes using the Apify MCP server for research and provides specific reference paths for different integration shapes to ensure consistency and correct API usage.
What it does
- Defines the Apify domain model including Actors, Runs, Datasets, and Key-Value stores.
- Provides design rules for asynchronous run flows and bounded polling.
- Establishes standards for cost control, attribution headers, and error handling.
- Offers guidance on choosing an integration shape based on the target platform.
- Details the implementation of high-level convenience operations like Web Fetch.
- Provides a definition-of-done checklist for integration validation.
When to use it
- When planning or building an official integration for a workflow automation app like Zapier or n8n.
- When developing an AI agent plugin or harness that requires access to Apify Actors.
- When creating a client-side package for AI frameworks like LangChain or LlamaIndex.
- When building a direct application client that interacts with the Apify REST API.
Advantages
- Ensures consistent integration behavior across different platforms.
- Provides clear architectural patterns for client-side and agent-based integrations.
- Includes specific guidance on cost management and error taxonomy.
- Facilitates easier review and validation by the Apify team.
Usage examples
- “How do I structure an integration for an AI agent harness?”
- The skill directs you to the ai-harness-plugin.md reference to choose between a coding agent plugin (MCP-based) or a custom tool registry plugin.
- “What are the requirements for polling an Actor run?”
- The skill mandates bounded polling using the run's timeout settings and forbids infinite while-true loops.
- “How should I handle cost controls in my integration?”
- The skill requires exposing maxTotalChargeUsd and maxItems as query parameters rather than embedding them in the Actor input.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/apify/apify-integration-development/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip apify-integration-development.zip -d .agents/skills
Documentation by Apify
Apify Integration Development
Design and build an official Apify integration for a company's product, with minimal help from Apify. This skill covers every integration shape Apify supports - workflow-automation apps, AI agent plugins (coding agents and harnesses), AI framework packages, and direct application clients - so a partner team can ship a first-class Apify integration end to end. The cross-cutting rules below apply to all of them, and one category-specific reference file carries the rest.
Building an official integration? Once you publish it, contact [email protected] so the Apify team can review, test, and validate your integration before it reaches users. We'll check the capability surface, cost controls, error handling, and attribution headers, and help you close any gaps.
Step 0 - Learn the Apify model first (required)
Before designing anything, fetch and read https://apify.com/agents.md. It is the canonical quickstart for AI agents and the single source of truth for vocabulary, the run flow, and the cost rule. If the fetch fails, the mini-glossary below keeps the skill usable.
Apify vocabulary (always written with a capital A on the platform):
Actor - a serverless cloud program that takes JSON input, performs a task, and produces structured output. Not an AI agent.
Actor Run - one execution of an Actor. Each run has its own dataset, key-value store, and request queue, and ends in a terminal status (
SUCCEEDED,FAILED,TIMED-OUT,ABORTED).Dataset - append-only structured storage for a run's results. An Actor call returns the dataset ID, not its contents.
Key-Value Store - unstructured/file storage (screenshots, HTML, OUTPUT).
Actor Task - a saved, parameterized configuration for running an Actor.
Apify Store - the marketplace of Actors at
https://apify.com/store.md.Apify Console - the web UI at
https://console.apify.com.Compute Unit (CU) - billing unit: memory (MB) x duration (hours).
Server Actor - an Actor that runs as an always-ready HTTP server on its own stable URL (may be still called Standby in the API and docs). You send a request and get the result in the response - no run to start, no dataset to read.
Further terms (build, request queue, proxy, pricing models): https://docs.apify.com/llms.txt.
Use Apify MCP for live context while planning
The Apify MCP server is the fastest way to research Actors, schemas, pricing, and docs during integration design. See https://docs.apify.com/integrations/mcp (append .md for a markdown version).
If Apify MCP tools are already available in this environment, use them:
search-actors- find Actors by platform/product keyword (search by product name, not end goal).fetch-actor-details- read an Actor's input schema, output format, README, and pricing before you encode its shape into the integration.search-apify-docs/fetch-apify-docs- pull contextual documentation pages.
The anonymous discovery subset (search-actors, fetch-actor-details, search-apify-docs, fetch-apify-docs) works without an account, so you can research even before the developer has connected their token.
Pick your integration shape
Read exactly one reference file based on the product you are integrating into. Each reference carries the category-specific UX design, a canonical capability matrix, and a definition-of-done checklist.
| Product shape | Examples | Read |
|---|---|---|
| Workflow automation platform | Zapier, n8n, Make, Pipedream, Activepieces | references/workflow-automation.md |
| AI agent plugin (coding agent or harness) | Cursor, Claude Code, Codex, GitHub Copilot (coding agents); OpenClaw-style runtimes, Hermes-style harnesses (harnesses) | references/ai-harness-plugin.md |
| AI framework package (PyPI/npm for LLM frameworks) | LangChain, LlamaIndex, Haystack, Vercel AI SDK | references/ai-framework-package.md |
| Application integration (direct client) | A backend service, scheduled job, product feature calling Actors via apify-client or REST | references/sdk-integration.md |
Paths are relative to this skill folder. If your product spans two shapes (e.g. an AI harness built on top of a framework package), read both - the rules compose. The AI agent plugin reference covers two approaches with different trade-offs: a lightweight skills + MCP bundle for skills/MCP-aware coding agents, and a custom tool-registry plugin for OpenClaw/Hermes-style harnesses.
Cross-cutting design rules (true for every integration type)
These invariants were extracted from every existing Apify integration. Apply them regardless of shape.
Vocabulary mirroring
Model the integration's resources on Apify's domain (Actor / Run / Dataset / KV Store / Task). Users coming from Apify Console should find the same concepts under the same names.
Asynchronous run flow with bounded polling
Actors can run for seconds to hours. Use the asynchronous flow, never the 300-second synchronous endpoint for anything but short jobs:
POST /v2/actors/{actorId}/runs -> start, return runId
GET /v2/actor-runs/{runId} -> poll until terminal status
GET /v2/datasets/{datasetId}/items -> fetch results on SUCCEEDEDPolling must be bounded: use the run's own timeoutSecs plus a grace buffer, with an absolute ceiling fallback. Never while (true). On a non-terminal status, surface the run ID so the user/agent can poll again or inspect the failure.
Cost is first-class
Every path that starts a run must expose a cost control. The canonical control is maxTotalChargeUsd (caps the run's total charge on most pricing models) and maxItems (caps billed items on pay-per-result Actors). Send them as options / query parameters, never as Actor input - inside input they are either an Actor-declared field or simply invalid. 0 / empty / null means no limit. For LLM-facing integrations, the ceilings are developer-controlled; an LLM cannot widen them. A Server Actor request such as Web Fetch (below) starts no run and takes neither option.
Attribution headers
Stamp an integration header on every outbound request so Apify can attribute traffic: x-apify-integration-platform: <your-platform>. When a request is driven by an AI tool (not a human in a UI), also send x-apify-integration-ai-tool: true. If the integration was built using this skill, add x-apify-integration-origin: apify-integration-development-skill so Apify can distinguish skill-generated integrations from custom ones. One line, big telemetry payoff.
Authentication
Browser / consumer-facing (a human completes a sign-in): OAuth2 with PKCE. Do not ask for raw tokens.
Headless / server / CI (no human present): API token as
Authorization: Bearer <APIFY_TOKEN>, stored in an env var or secret manager, never hardcoded or logged.
Both paths are real - pick by who is present at auth time, not by which is easier.
Centralized HTTP layer
One base-URL constant, shared between credentials and the HTTP layer. A Server Actor lives on its own host (https://web-fetch.apify.actor) - route it through the same layer so auth and attribution headers still apply. Retries with exponential backoff on 429 and 5xx. Never retry non-idempotent POST /runs on network errors - a duplicate Actor run is a real, billed, side-effecting operation. This is the single most important correctness invariant in the HTTP layer.
Error taxonomy
Map Apify errors to the host platform's error categories (retryable vs auth vs permanent). Surface the API's actual error text, not a generic HTTP message. For permission-approval failures (a full-permission Actor needs explicit approval), include the approval URL after validating it is an absolute http(s) URL. For LLM consumers, return errors as data (JSON error objects), never as raised exceptions - the model needs something to read and reason about.
Webhooks over polling for run-finished events
When the host supports inbound webhooks, register an Apify webhook scoped to actorId or actorTaskId with the terminal statuses the user picked. Make registration idempotent (a re-activated workflow should not create duplicate webhooks), persist the webhook ID so deactivation can clean it up, and always provide sample/fallback data so users can test the trigger without waiting for a real run.
Generate from OpenAPI where the host allows it
If the host platform can generate UI fields from an OpenAPI spec, use Apify's spec (https://apify.com/openapi.json) and a tag allowlist. Hand-write only what the spec cannot express: convenience wrappers, bill-cap fields, lean AI-tool output contracts.
High-level convenience operations alongside generic runs
Generic "run Actor" serves power users. Add a few opinionated, high-level actions for the common case so non-power users get a 2-field form instead of a full Actor configuration. The canonical one is Web Fetch: one URL in, page content out, built on the apify/web-fetch Server Actor - POST https://web-fetch.apify.actor/ with {"url": "...", "formats": ["markdown"]} returns the content in the response. No run is started, so the run rules above (asynchronous flow, polling, maxTotalChargeUsd) do not apply; the cost is one fetch event per successful request. Three things to get right: always send formats, check fetch.httpStatusCode (HTTP 200 only means Web Fetch itself succeeded), and handle both error shapes - flat {code, error} from the Actor, nested {error: {message}} from the platform - without auto-retrying its 502/504. Full contract: https://apify.com/apify/web-fetch.md. Do not build this on a crawler run with maxCrawlDepth: 0 - that is the legacy "Scrape single URL" pattern.
Testing and release
Keep two test modes: mocked (hermetic, no credentials) and live E2E (real API, CI-gated). Automate releases through the host platform's CI on Git tags / GitHub Releases. Never hand-edit versions or changelogs if a release workflow manages them.
Top anti-patterns to refuse on review
Retrying
POST /runson a network error - duplicates a billed run.Unbounded
while (true)polling - ties up the host with no ceiling.Putting
maxTotalChargeUsd/maxItemsinside Actor input instead of options - silently not a cap.Dumping a full dataset into an LLM context without size caps or untrusted-content fencing - prompt-injection and context blowout.
One monolithic tool list for an LLM agent - routing accuracy degrades past ~8 tools; curate subsets.
Surfacing a raw HTTP status/message instead of Apify's actual error text - users can't act on "400".
Minimal API surface every integration needs
| Purpose | Method + path |
|---|---|
| Start an Actor run | POST /v2/actors/{actorId}/runs |
| Start a Task run | POST /v2/actor-tasks/{taskId}/runs |
| Poll a run | GET /v2/actor-runs/{runId} |
| List runs | GET /v2/actor-runs |
| Dataset items | GET /v2/datasets/{datasetId}/items |
| KV record | GET /v2/key-value-stores/{storeId}/records/{key} |
| Set KV record | PUT /v2/key-value-stores/{storeId}/records/{key} |
| Store search | GET /v2/store |
| Webhook CRUD | POST/GET/DELETE /v2/webhooks |
| Validate token / current user | GET /v2/users/me |
| Fetch one URL (Web Fetch, Server Actor) | POST https://web-fetch.apify.actor/ |
REST reference: https://docs.apify.com/api/v2. OpenAPI spec: https://apify.com/openapi.json.
Working workflow
Fetch
https://apify.com/agents.mdand internalize the model.Pick the integration shape above and read the matching reference file.
Use Apify MCP (if available) to research the concrete Actors, schemas, and pricing the integration will expose.
Draft the capability matrix for the chosen category (each reference has one) and the UX spec (resource -> operation -> fields -> errors).
Scaffold the integration following the category-specific rules in the reference.
Verify against the definition-of-done checklist at the end of that reference.
Reference implementations to study
Real, public integrations per category - read their source when in doubt:
Workflow automation:
@apify/n8n-nodes-apify(npm), the Apify Zapier app.AI agent plugins (coding agents): the Apify plugin bundle (MCP server + skills + router + slash commands) shipped for Cursor, Claude Code, Copilot, and similar tools.
AI agent plugins (harnesses):
apify-hermes-agent-plugin(PyPI),@apify/apify-openclaw-plugin.AI framework packages:
langchain-apify(PyPI).Application integration: see
references/sdk-integration.mdfor the canonicalapify-clientusage in JS/TS, Python, and over REST.
Support for integration questions: [email protected]. Contact us both for design guidance while you build and for review/testing once you publish - we validate the capability surface, cost controls, error handling, and attribution before the integration reaches users.
Files
- ATTRIBUTION.mdAdded by AutoGineer981 B
- LICENSEAdded by AutoGineer10.0 KiB
- SKILL.md13.3 KiB
- references/ai-framework-package.md13.6 KiB
- references/ai-harness-plugin.md17.8 KiB
- references/sdk-integration.md8.6 KiB
- references/workflow-automation.md13.3 KiB
references/sdk-integration.md
SDK integrations
Design guide for integrating Apify into an existing application by calling Actors directly with apify-client (JS/TS or Python) or the REST API. This is the lightest integration shape: no host platform, no tool registry, no plugin lifecycle - just your code calling Apify as a backend service. Apply the cross-cutting rules from SKILL.md on top.
1. Wrap apify-client, never the Actor SDK
apify-clientis the API client for calling Actors from your app.apifyis the SDK for building Actors (wrong package for this use case).
Always install apify-client. Never install apify for integration work. Keep the dependency footprint small to minimize version conflicts and keep install time short.
Stamp a custom user-agent suffix or the attribution header (x-apify-integration-platform: <your-app>) on the client so Apify can attribute traffic. If the integration was built using the Apify integration development skill, also set x-apify-integration-origin: apify-integration-development-skill.
2. Token handling
Get an APIFY_TOKEN from Console > Settings > Integrations at https://console.apify.com/settings/integrations. Account sign-up: https://console.apify.com/sign-up (free, no credit card). Store the token in an environment variable or a secrets manager - never hardcoded, never in chat logs or command output, never in URLs (query-string tokens leak through browser history and server logs).
The token is a normal Bearer credential:
Authorization: Bearer <APIFY_TOKEN>Use scoped tokens where possible and rotate them periodically.
3. Find the right Actor before writing code
Before writing integration code, find the Actor that fits the need. Use the MCP tools if available in your environment:
search-actors- search the Apify Store by keyword (search by platform/product name, not end goal).fetch-actor-details- get the Actor's input schema, output format, and pricing.
Alternatively, browse https://apify.com/store. Append .md to any Actor's Store URL to get its docs in markdown (e.g. https://apify.com/apify/web-scraper.md). Build input from the schema rather than guessing field names.
4. JavaScript / TypeScript
Install
npm install apify-clientSynchronous execution (wait for results)
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('apify/web-scraper').call({
startUrls: [{ url: 'https://example.com' }],
maxPagesPerCrawl: 10,
}, { maxTotalChargeUsd: 5 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();.call() blocks until the Actor finishes. Use for short-running Actors (under a few minutes). Pass maxTotalChargeUsd in the options argument - never in the input.
Asynchronous execution (start and poll)
const run = await client.actor('apify/web-scraper').start({
startUrls: [{ url: 'https://example.com' }],
});
// Poll for completion
// Derive waitSecs from the run's timeoutSecs + a grace buffer, never unbounded.
const finishedRun = await client.run(run.id).waitForFinish({ waitSecs: 120 });
// Retrieve results
const { items } = await client.dataset(finishedRun.defaultDatasetId).listItems();Use .start() + .waitForFinish() for long-running Actors or when you need the run ID immediately.
Retrieving results
// Dataset items (structured data from pushData)
const { items } = await client.dataset(run.defaultDatasetId).listItems({
limit: 100,
offset: 0,
});
// Key-value store (files, screenshots, etc.)
const record = await client.keyValueStore(run.defaultKeyValueStoreId).getRecord('OUTPUT');Error handling
try {
const run = await client.actor('apify/web-scraper').call(input);
if (run.status !== 'SUCCEEDED') {
const log = await client.log(run.id).get();
throw new Error(`Actor failed with status ${run.status}: ${log}`);
}
const { items } = await client.dataset(run.defaultDatasetId).listItems();
} catch (error) {
if (error.type === 'record-not-found') {
// Actor ID is wrong or Actor was deleted
} else if (error.statusCode === 401) {
// Invalid or missing APIFY_TOKEN
}
throw error;
}5. Python
Install
pip install apify-clientSynchronous execution
from decimal import Decimal
from apify_client import ApifyClient
import os
client = ApifyClient(token=os.environ['APIFY_TOKEN'])
run = client.actor('apify/web-scraper').call(
run_input={
'startUrls': [{'url': 'https://example.com'}],
'maxPagesPerCrawl': 10,
},
max_total_charge_usd=Decimal('5'),
)
items = client.dataset(run['defaultDatasetId']).list_items().itemsAsynchronous execution
run = client.actor('apify/web-scraper').start(run_input={
'startUrls': [{'url': 'https://example.com'}],
})
# Poll for completion
finished_run = client.run(run['id']).wait_for_finish()
items = client.dataset(finished_run['defaultDatasetId']).list_items().itemsAsync client (asyncio)
from apify_client import ApifyClientAsync
client = ApifyClientAsync(token=os.environ['APIFY_TOKEN'])
run = await client.actor('apify/web-scraper').call(run_input={
'startUrls': [{'url': 'https://example.com'}],
})
items = (await client.dataset(run['defaultDatasetId']).list_items()).items6. REST API (any language)
For languages without an official client, use the REST API directly.
Start a run
POST https://api.apify.com/v2/actors/{actorId}/runs
Authorization: Bearer <APIFY_TOKEN>
Content-Type: application/json
{ "startUrls": [{ "url": "https://example.com" }] }Get run status
GET https://api.apify.com/v2/actor-runs/{runId}
Authorization: Bearer <APIFY_TOKEN>Get dataset items
GET https://api.apify.com/v2/datasets/{datasetId}/items?format=json
Authorization: Bearer <APIFY_TOKEN>The cost rule applies on the HTTP paths too: maxItems (pay-per-result) and maxTotalChargeUsd (other pricing models) go as query parameters, never in the JSON body where they are read as Actor input.
For runs expected to finish within 300 seconds, the synchronous endpoint returns dataset items directly:
POST https://api.apify.com/v2/actors/{username}~{actor-name}/run-sync-get-dataset-itemsLonger work must use the asynchronous flow: POST /runs -> poll GET /actor-runs/{id} -> GET /datasets/{id}/items.
REST reference: https://docs.apify.com/api/v2. OpenAPI spec: https://apify.com/openapi.json.
7. Best practices
Set timeouts: pass
timeoutSecsas a run option / query parameter on.call()or.start(), or usewaitSecson.call(). Never puttimeoutSecsin Actor input — it is a run option and an Actor whose schema rejects unknown fields will fail on it.Paginate large datasets: use
limitandoffsetwhen retrieving dataset items.Reuse clients: create one
ApifyClientinstance and reuse it across calls.Handle Actor-specific input: every Actor has its own input schema. Use
fetch-actor-detailsMCP tool or append.mdto the Actor's Store URL to get the schema before constructing input.Bound polling: never
while (true)- use the run's own timeout + a grace buffer, with an absolute ceiling.
8. Documentation pointers
API client for JS:
https://docs.apify.com/api/client/jsAPI client for Python:
https://docs.apify.com/api/client/pythonREST API reference:
https://docs.apify.com/api/v2Apify docs (LLM-friendly):
https://docs.apify.com/llms.txtApify docs (full):
https://docs.apify.com/llms-full.txt
If the Apify MCP server is available, use search-apify-docs and fetch-apify-docs tools for contextual documentation lookups during development.
Definition-of-done checklist
[ ] Depends on
apify-client, neverapify.[ ] Token stored in env var / secret manager; never hardcoded or logged.
[ ] Actor input built from the schema (MCP
fetch-actor-detailsor.mdURL), not guessed.[ ] Sync
.call()used for short runs; async.start()+.waitForFinish()for long ones.[ ] Attribution header / user-agent suffix set on the client; skill-origin header included if built from this skill.
[ ] Cost cap (
maxTotalChargeUsd/max_total_charge_usd) passed in options, never input.[ ] Run status checked before consuming dataset; failed runs raise, not return empty.
[ ] Dataset and KV store retrieval covered; pagination on large datasets.
[ ] Errors mapped to actionable app-level messages.
[ ] REST API fallback documented for languages without a client.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs network access
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Apify
- Publisher
- Apify (Official)
- Source
- apify/agent-skills · skills/apify-integration-development · commit f22557f
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (written by AutoGineer)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Apify or Apify.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download apify-integration-development.zip