Integrations

REST API guide

Run any Cozybit tool from your own code with Apify's REST API or its Python and JavaScript clients. You authenticate with one header, and every run can carry a spend cap.

Authentication

Create a free Apify account, then copy your API token in Apify Console under Settings, API & Integrations. Keep it in an environment variable and send it as a header:

textHeader
Authorization: Bearer $APIFY_TOKEN

Never put the token in a URL (?token=): URLs end up in logs, browser history and proxies.

The four endpoints you need

ToCall
Run a tool and get its records in one call (up to 300 s)POST /v2/acts/ACTOR_ID/run-sync-get-dataset-items
Start a run and return at oncePOST /v2/acts/ACTOR_ID/runs
Check a run, or wait up to 60 s for itGET /v2/actor-runs/RUN_ID?waitForFinish=60
Read a run's records as JSON, CSV or ExcelGET /v2/datasets/DATASET_ID/items?format=json (or csv, xlsx)

All under https://api.apify.com. The request body of a run is the tool's input as JSON.

Synchronous: a few items per call

Best for interactive use and small lookups. The call returns the dataset items directly.

curl

bashYouTube Transcripts, one video
curl -sS --max-time 310 -X POST \
  "https://api.apify.com/v2/acts/mzceZowBx7VrobetK/run-sync-get-dataset-items?maxTotalChargeUsd=0.10" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"], "languages": ["en"], "includeSegments": false}'

Python

pythonapify-client 3.x
# pip install apify-client
import os
from decimal import Decimal

from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("mzceZowBx7VrobetK").call(
    run_input={
        "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
        "languages": ["en"],
        "includeSegments": False,
    },
    max_total_charge_usd=Decimal("0.10"),  # spend cap for this run
)
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item.get("status"), item.get("title"))

JavaScript

javascriptapify-client 2.x, Node 18+
// npm install apify-client
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('mzceZowBx7VrobetK').call(
  {
    urls: ['https://www.youtube.com/watch?v=jNQXAC9IVRw'],
    languages: ['en'],
    includeSegments: false,
  },
  { maxTotalChargeUsd: 0.1 }, // spend cap for this run
);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) console.log(item.status, item.title);
  • The call waits at most 300 seconds, then answers HTTP 408; the run itself continues. Serverless functions usually stop sooner.
  • Don't retry a timed-out POST automatically; check your runs in Console first, or you may pay twice.

Asynchronous: batches and long jobs

Start the run, wait for it, then read the records. Use this for many items, whole playlists, states or registers.

bashStart, wait, read
# 1. Start a run; the answer comes back at once
curl -sS -X POST "https://api.apify.com/v2/acts/mzceZowBx7VrobetK/runs?maxTotalChargeUsd=1" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d @input.json
# The answer's data.id is RUN_ID and data.defaultDatasetId is DATASET_ID.

# 2. Wait up to 60 s per call until data.status is SUCCEEDED
curl -sS "https://api.apify.com/v2/actor-runs/RUN_ID?waitForFinish=60" \
  -H "Authorization: Bearer $APIFY_TOKEN"

# 3. Read the records as JSON, CSV or Excel (format=json, csv or xlsx)
curl -sS "https://api.apify.com/v2/datasets/DATASET_ID/items?format=csv" \
  -H "Authorization: Bearer $APIFY_TOKEN" -o results.csv

Instead of polling, you can let Apify call a webhook of yours when a run finishes, or use the Zapier and Make triggers for finished runs.

Spend control

Every run accepts maxTotalChargeUsd, as a query parameter or a client option. The run stops cleanly when the next result would exceed it, and you keep what was delivered. Each tool also has a maxResults-style input to limit rows.

During the trial until 31 Dec 2026 every result costs 0.00001 USD, so a 0.10 USD cap allows up to 10,000 results. See pricing.

Records and statuses

Every record has the fields documented on its tool page. Most tools add a status and an error message to each record; the job tools report each board's outcome in the run's RUN_SUMMARY. Failed items stay in the output so you can inspect them, and errors are never charged.

Actor IDs

ToolActor ID (never changes)Name
YouTube Transcript ScrapermzceZowBx7VrobetKcozybit/youtube-transcript-scraper
Google Trends APIG4aJjtT7Oiw6gMaAGcozybit/google-trends-scraper
Google Hotels ScraperYC0mAdrRhMBogWXUmcozybit/google-hotels-scraper
Hotel Price Comparisonz5dWV7FhZ6tlo9zgFcozybit/google-hotels-booking-prices
Google Flights ScraperrTAa68kee8wUtPb3dcozybit/google-flights-scraper
Greenhouse, Lever & Ashby Jobs ScraperNqfY1akFLdBLjtCwMcozybit/greenhouse-lever-ashby-jobs-scraper
EU Pay Transparency CheckerT1Rddpght86iXfGQmcozybit/eu-pay-transparency-checker
US Hospital Price TransparencyUOauyR6iKMKP6ZCa2cozybit/hospital-price-transparency
UK Visa Sponsor Registerxmc5KprXtajpboQQRcozybit/uk-sponsor-register
UK Gambling Licence RegisterwWvHi6YQHyk6X9raLcozybit/uk-gambling-licence-register
Peppol Directory LookupqMyzrf2IKcdsPlGOdcozybit/peppol-directory-registrations

Use the ID in code: names can be renamed, IDs cannot. The machine-readable list with example inputs is in catalog.json.