Skip to main content

Apify API documentation

Learn how to use the Apify platform programmatically.

REST API

The Apify API is built around HTTP REST, uses predictable resource-oriented URLs, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

cURL
# Prepare Actor input and run it synchronously
echo '{ "searchStringsArray": ["Apify"] }' |
curl -X POST -d @- \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <YOUR_API_TOKEN>' \
-L 'https://api.apify.com/v2/acts/compass~crawler-google-places/run-sync-get-dataset-items'

API clients

The client libraries are a more convenient way to interact with the Apify platform than the HTTP REST API.
JavaScript
Python

JavaScript API client

For web browser, JavaScript/TypeScript applications, Node.js, Deno, or Bun.Star
npm install apify-client
// Easily run Actors, await them to finish using the convenient .call() method, and retrieve results from the resulting dataset.
const { ApifyClient } = require('apify-client');

const client = new ApifyClient({
token: 'MY-APIFY-TOKEN',
});

// Starts an actor and waits for it to finish.
const { defaultDatasetId } = await client.actor('john-doe/my-cool-actor').call();

// Fetches results from the actor's dataset.
const { items } = await client.dataset(defaultDatasetId).listItems();

Related articles