Skip to main content

Apify for AI agents

Connect your AI agent or application to Apify - the platform for web scraping, data extraction, and browser automation. The typical agent workflow: find an Actor, run it, get structured data back.

Core concepts

  • Actors - Serverless cloud programs that perform scraping, crawling, or automation tasks. Thousands of ready-made Actors are available in Apify Store.
  • Datasets - Append-only storage for structured results. Every Actor run creates a default dataset. Export as JSON, CSV, Excel, XML, or RSS.
  • API - RESTful API at https://api.apify.com/v2 for all platform operations. Also accessible via MCP, CLI, and client libraries.

Prerequisites

Sign up to Apify Console. The free plan includes monthly platform usage credits with no credit card required. Get your API token from Console > Settings > Integrations.

Free exploration

The MCP server's search-actors, fetch-actor-details, and docs tools work without authentication. You can browse Actors and documentation without an account.

Run your first Actor

Every Apify Actor follows the same pattern: send input as JSON, get structured data back. The shortest path through each of the main integration methods, using the agent-optimized RAG Web Browser Actor:

After connecting the MCP server to your AI assistant, ask:

Use Apify's RAG Web Browser to find the top 3 pages about Apify documentation, then summarize.

Your agent calls search-actors, call-actor, and reads the resulting dataset items - all through MCP, no code required.

The pattern is the same across every integration method: pick an Actor, send input, receive structured data. Choose the connection method below that fits your stack.

Cost controls

When an agent calls Actors automatically, set run limits to prevent surprise bills. Pass these as query parameters on the run Actor endpoint:

  • memory (MB) - power of 2, minimum 128. Lower memory means lower cost per second.
  • timeout (seconds) - cap how long a single run can last.
  • maxTotalChargeUsd - cap total run cost for pay-per-event Actors.

See Usage and resources and Billing for details.

Choose your integration method

MethodBest forAuth
MCP serverAI agents and coding assistantsOAuth or API token
API clientBackend apps (JavaScript/Python)API token
CLIBuilding and deploying custom ActorsAPI token
REST APIAny language, HTTP integrations, no-code toolsAPI token

MCP server

The Apify MCP server connects your agent to the full Apify platform via the Model Context Protocol. No local installation needed for remote-capable clients.

Works with Claude Code, Cursor, VS Code, GitHub Copilot, and other remote-capable clients.

  1. Add the following to your MCP client's configuration:

    {
    "mcpServers": {
    "apify": {
    "url": "https://mcp.apify.com"
    }
    }
    }
  2. Restart your client and sign in when prompted. OAuth handles authentication automatically.

Local/stdio

For clients that only support local MCP servers, for example Claude Desktop.

  1. Add the following to your MCP client's configuration:

    {
    "mcpServers": {
    "apify": {
    "command": "npx",
    "args": ["-y", "@apify/actors-mcp-server"],
    "env": { "APIFY_TOKEN": "YOUR_TOKEN" }
    }
    }
    }
  2. Replace YOUR_TOKEN with your API token and restart the client.

For client-specific setup instructions, use the MCP Configurator which generates ready-to-paste configs. For details, see the MCP server documentation.

API client

For integrating Apify into your application code.

Package naming

apify-client is the API client for calling Actors. The apify package is the SDK for building Actors. For backend integration, install apify-client.

npm install apify-client
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' }],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();

Full reference: JavaScript API client docs

CLI

For running Actors and building custom ones from the command line.

Install on macOS or Linux (Windows and Homebrew alternatives in the CLI install docs):

curl -fsSL https://apify.com/install-cli.sh | bash
apify login # authenticate with your API token

Discover and inspect Actors:

apify actors search scraping                     # search Apify Store
apify actors info apify/web-scraper --readme # get Actor README
apify actors info apify/web-scraper --input # get input schema

Run an Actor and get its output:

apify actors call apify/web-scraper \
-i '{"startUrls": [{"url": "https://example.com"}]}' \
--output-dataset

Build and deploy custom Actors:

apify create my-actor                            # scaffold (JS/TS/Python)
apify run # test locally
apify push # deploy to Apify cloud

Full reference: Apify CLI documentation.

REST API

For HTTP-native integrations or languages without a dedicated client. Base URL: https://api.apify.com/v2. Authenticate with the Authorization: Bearer YOUR_TOKEN header.

Quick reference

ActionMethodEndpoint
Search Actors in StoreGET/v2/store
Get Actor detailsGET/v2/acts/{actorId}
Run an ActorPOST/v2/acts/{actorId}/runs
Run Actor (sync, get results)POST/v2/acts/{actorId}/run-sync-get-dataset-items
Get run statusGET/v2/actor-runs/{runId}
Get dataset itemsGET/v2/datasets/{datasetId}/items

The sync endpoint (run-sync-get-dataset-items) runs an Actor and returns results in a single request (waits up to 5 minutes). Use async endpoints for longer runs.

For runs that take longer than the sync timeout, prefer webhooks over polling - Apify will POST a notification to your URL when the run finishes, avoiding wasted requests.

Full reference: Apify API v2.

Agent Skills

Once you connect an agent via MCP or a coding assistant, Apify Agent Skills add pre-built workflows on top - guiding the agent through multi-step scraping pipelines and Actor development tasks. Skills are not a separate integration method; they layer over your existing connection.

Install into Claude Code, Cursor, Gemini CLI, or OpenAI Codex:

npx skills add apify/agent-skills
SkillWhat it does
apify-ultimate-scraperRoutes web scraping requests to the right Actor for multi-step data pipelines
apify-actor-developmentGuided workflow for building and deploying custom Actors
apify-actorizationConverts an existing project into an Apify Actor
apify-generate-output-schemaAuto-generates output schemas from Actor source code

For the full list and details, see the skills registry.

Documentation access for agents

Apify documentation is available in formats optimized for programmatic consumption.

ResourceHow to access
Specific doc pageAppend .md to any docs URL (for example, docs.apify.com/platform/actors.md)
Specific doc page (alt)Request with Accept: text/markdown header
Docs indexdocs.apify.com/llms.txt
Full docs (large)docs.apify.com/llms-full.txt
Actor Store pagesAppend .md to any Apify Store URL
MCP docs toolssearch-apify-docs, fetch-apify-docs

For targeted lookups, prefer .md URLs for specific pages or the MCP docs tools over the full llms-full.txt file. Agents with limited context windows may not load llms-full.txt fully.

Useful resources