apify-sdk-integration
Skill7 starsChanged 25 days agoApache-2.0View on GitHub
Integrate Apify into an existing JavaScript/TypeScript or Python application using the apify-client package. Use when adding web scraping, automation, or data extraction capabilities to an existing app via the Apify API.
- Reads credentials
- Installs packages
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- apify/apify-deepseek-harness-pluginedited, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- apify/apify-deepseek-harness-plugin★ 4100% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Add Apify Actor execution to an existing application.
- Distinctive: line 35
Before writing integration code, find the Actor that fits the user's needs.
- Very specific: line 80
Use .start() + .waitForFinish() for long-running Actors or when you need the run ID immediately.
- Very specific: line 125
When adding the dependency to requirements.txt or pyproject.toml, use apify-client>=3.
- Very specific: line 205
Paginate large datasets: Use limit and offset when retrieving dataset items.
- Very specific: line 206
Reuse clients: Create one ApifyClient instance and reuse it across calls.
- Very specific: line 207
Handle Actor-specific input: Every Actor has its own input schema.
- Very specific: line 217
If the Apify MCP server is available, use search-apify-docs and fetch-apify-docs tools for contextual documentation lookups during …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Apify SDK Integration
Add Apify Actor execution to an existing application. This skill covers the apify-client package for JS/TS and Python, plus the REST API for other languages.
When to Use This Skill
- Adding web scraping or automation to an existing app
- Calling Apify Actors programmatically from application code
- Building a product that uses Apify as a backend service
- Integrating Actor results into a data pipeline
Critical: Package Naming
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 installapifyfor integration work.
Prerequisites
The user needs an APIFY_TOKEN. Direct them to Console > Settings > Integrations at https://console.apify.com/settings/integrations to create one. If they don't have an account: https://console.apify.com/sign-up (free, no credit card).
Store the token securely — environment variable or secrets manager, never hardcoded.
Finding the Right Actor
Before writing integration code, find the Actor that fits the user's needs. Use the MCP tools if available:
search-actors— search the Apify Store by keywordfetch-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.
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,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();.call() blocks until the Actor finishes. Use for short-running Actors (under a few minutes).
Asynchronous Execution (start and poll/retrieve later)
const run = await client.actor('apify/web-scraper').start({
startUrls: [{ url: 'https://example.com' }],
});
// Poll for completion
const finishedRun = await client.run(run.id).waitForFinish();
// 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.message?.includes('not found')) {
// Actor ID is wrong or Actor was deleted
} else if (error.statusCode === 401) {
// Invalid or missing APIFY_TOKEN
}
throw error;
}Python
Install
pip install "apify-client>=3"When adding the dependency to requirements.txt or pyproject.toml, use apify-client>=3. Older versions return plain dicts, so the examples below fail on them.
Note (
apify-client3.x):.call(),.start(), and.wait_for_finish()return typed PydanticRunmodels withsnake_caseattributes (run.id,run.default_dataset_id,run.status) rather than dictionaries.
Synchronous Execution
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,
})
items = client.dataset(run.default_dataset_id).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.default_dataset_id).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.default_dataset_id).list_items()).itemsREST 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>Full API reference: https://docs.apify.com/api/v2
Best Practices
- Set timeouts: Pass
timeoutSecsin the Actor input or usewaitSecson.call()to avoid indefinite waits. - Paginate large datasets: Use
limitandoffsetwhen retrieving dataset items. Default limit is 250K 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.
Documentation
- Apify API client for JS: https://docs.apify.com/api/client/js
- Apify API client for Python: https://docs.apify.com/api/client/python
- REST API reference: https://docs.apify.com/api/v2
- Apify docs (LLM-friendly): https://docs.apify.com/llms.txt
- Apify 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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

