# Apify

> Run web-scraping and automation Actors, fetch dataset items and key-value records, and trigger saved tasks with Apify's REST API.

Lets an agent run Apify Actors - cloud programs for web scraping and browser automation - and collect their results. List Actors, start a run, run an Actor synchronously and get its scraped items back in one call, fetch datasets and key-value store records, and trigger saved tasks.

## What it can do

| Method | What it does |
| --- | --- |
| `apify_actors_list` | List Actors (optionally only your own). |
| `apify_actor_run` | Start an Actor run asynchronously with an input object; returns a run to poll. |
| `apify_actor_run_sync_get_items` | Run an Actor, wait for it to finish, and return the scraped dataset items directly. |
| `apify_run_get` | Get a run by ID - status, stats, and its default dataset / store IDs. |
| `apify_datasets_list` | List datasets. |
| `apify_dataset_get` | Get dataset metadata (item count, schema). |
| `apify_dataset_items` | Get items from a dataset, with optional clean / fields filters. |
| `apify_key_value_store_record` | Get a record from a key-value store (e.g. INPUT, OUTPUT). |
| `apify_tasks_list` | List saved tasks (Actor + input configurations). |
| `apify_task_run` | Run a saved task, optionally overriding its input. |
| `apify_request` | Generic passthrough to any Apify v2 endpoint for full API coverage. |

## How to get your token

Apify authenticates API calls with a personal API token sent as `Authorization: Bearer <TOKEN>`.

1. Sign in to the [Apify Console](https://console.apify.com).
2. Open **Settings -> Integrations** ([API token page](https://console.apify.com/settings/integrations)).
3. Copy your **Personal API token**.
4. Paste it into FlyMyAI.

## Fields to fill

| FlyMyAI field | Where it comes from |
| --- | --- |
| `APIFY_TOKEN` | Apify Console -> Settings -> Integrations -> API token |

## Troubleshooting

- **`401 Unauthorized`** - the token is wrong or rotated. Copy a fresh one from Settings -> Integrations.
- **`apify_actor_run_sync_get_items` times out** - synchronous runs block for up to ~5 minutes. For long crawls, use `apify_actor_run` and poll `apify_run_get`, then read items with `apify_dataset_items`.
- **Empty dataset items** - the run may still be in progress, or the Actor produced no output. Check the run status first with `apify_run_get`.
- **`402 Payment Required` / usage limits** - Actor runs consume Apify platform usage. Check your plan limits in the Apify Console.

## Links

- [Apify API reference](https://docs.apify.com/api/v2)
- [API token settings](https://console.apify.com/settings/integrations)
