
Apify Sdk Integration
Wire Apify Actor execution into an existing JS/TS or Python app with apify-client for scraping, automation, or extraction backends.
Overview
Apify SDK Integration is an agent skill for the Build phase that adds web scraping and Actor automation to existing apps via the apify-client API client.
Install
npx skills add https://github.com/apify/agent-skills --skill apify-sdk-integrationWhat is this skill?
- Documents apify-client for JavaScript/TypeScript and Python—explicitly not the apify Actor builder package.
- Covers programmatic Actor runs, result handling, and REST API patterns for other languages.
- Walks APIFY_TOKEN setup via Apify Console Integrations with env/secrets guidance.
- Includes Actor discovery flow (e.g. search-actors via MCP when available) before coding.
- Targets adding scraping or automation to an existing app or data pipeline, not greenfield Actor authoring alone.
Adoption & trust: 1k installs on skills.sh; 2.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need programmatic web data or automation in your app but are unsure which Apify package to install or how to call Actors securely.
Who is it for?
Indie builders extending an existing JS/TS or Python codebase with Apify-backed scraping or automation.
Skip if: Authoring new Apify Actors with the apify builder SDK only, or teams that refuse hosted third-party automation APIs.
When should I use this skill?
Adding web scraping, automation, or data extraction to an existing app via the Apify API, or calling Apify Actors programmatically.
What do I get? / Deliverables
Your codebase integrates apify-client (or REST) with a stored APIFY_TOKEN and a chosen Actor, ready to run jobs and pull results into your product or pipeline.
- Integration code using apify-client or REST to run Actors
- Documented token handling and Actor selection for the use case
Recommended Skills
Journey fit
Calling third-party automation APIs from application code is core Build work when the product needs live web data or scripted jobs. Integrations is the canonical shelf because the skill is about embedding Apify as a service boundary, not designing UI or writing Actor code inside Apify’s builder SDK.
How it compares
Integration skill for calling Actors from your app—not the Apify SDK skill path for implementing Actors inside Apify’s platform.
Common Questions / FAQ
Who is apify-sdk-integration for?
Solo builders and small teams adding Apify as a backend for scraping or automation in an application they already maintain.
When should I use apify-sdk-integration?
Use it during Build integrations when adding web scraping, calling Apify Actors from app code, or feeding Actor output into a data pipeline.
Is apify-sdk-integration safe to install?
It requires network access and API secrets; store APIFY_TOKEN in environment or a secrets manager and review the Security Audits panel on this page before production use.
SKILL.md
READMESKILL.md - Apify Sdk Integration
# 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-client`** is the API client for **calling** Actors from your app. > **`apify`** is the SDK for **building** Actors (wrong package for this use case). > > Always install `apify-client`. Never install `apify` for 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 keyword - `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. ## JavaScript / TypeScript ### Install ```bash npm install apify-client ``` ### Synchronous Execution (wait for results) ```typescript 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) ```typescript 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 ```typescript // 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 ```typescript 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 ```bash pip install apify-client ``` ### Synchronous Execution ```python 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'}