> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go-fetch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from Apify

> gofetch-client keeps apify-client's interface. Change the import and the key; your calls stay as they are.

`gofetch-client` is a drop-in replacement for `apify-client`. Install it, change the import and the key, and
`actor.call()`, `dataset.iterate_items()` and your webhooks keep working.

```bash theme={null}
pip install gofetch-client
```

## Two lines change

```python Before (apify-client) theme={null}
import os

from apify_client import ApifyClient

client = ApifyClient(token=os.environ["APIFY_TOKEN"])

run = client.actor("apify/instagram-scraper").call(
    run_input={"directUrls": ["https://www.instagram.com/nasa/"]},
)
items = client.dataset(run["defaultDatasetId"]).iterate_items()
```

```python After (gofetch-client) theme={null}
import os

from gofetch import GoFetchClient

client = GoFetchClient(api_key=os.environ["GOFETCH_API_KEY"])

run = client.actor("apify/instagram-scraper").call(
    run_input={"directUrls": ["https://www.instagram.com/nasa/"]},
)
items = client.dataset(run["defaultDatasetId"]).iterate_items()
print(run["status"], sum(1 for _ in items))
```

The import and the client line change. `apify/instagram-scraper` runs our `instagram` scraper.

## What maps

| apify-client | gofetch-client |
| - | - |
| `ApifyClient(token=...)` | `GoFetchClient(api_key=...)`, with a key from your Go-Fetch dashboard. `token=` works too. |
| `client.actor("apify/instagram-scraper")` | Works as written; it runs `instagram`. |
| `apify/instagram-profile-scraper` · `clockworks/tiktok-profile-scraper` · `streamers/youtube-scraper` · `apify/facebook-scraper` · `apify/facebook-posts-scraper` · `apify/facebook-pages-scraper` · `scraperlink/google-search-results-serp-scraper` | `instagram_profile` · `tiktok` · `youtube` · `facebook` · `facebook_posts` · `facebook_profile` · `google_serp` |
| `.call(run_input=...)` · `.start(run_input=...)` | The same. |
| `client.run(id).wait_for_finish()` · `.abort()` · `.log()` | The same. |
| `client.dataset(run["defaultDatasetId"]).iterate_items()` · `.list_items()` | The same. |
| `webhooks=[{"event_types": ["ACTOR.RUN.SUCCEEDED", ...], "request_url": ...}]` | The same names: `SUCCEEDED`, `FAILED`, `TIMED_OUT`, `ABORTED`, `CREATED`, `RUNNING`. |
| `run["usageTotalUsd"]` | The job's final cost, also in the webhook. |

## What differs

**Your key, not a token.** Create an API key in the dashboard and pass it as `api_key`.

**Our scrapers, not the Store.** The actor names above map to our scrapers. Other Apify actors aren't available.

**Inputs.** Common Apify spellings are accepted (`directUrls`, `resultsLimit`, `startUrls`, `onlyPostsNewerThan`).
Check each scraper's inputs for the rest: a field a scraper doesn't know is ignored, not refused, and named in a
warning in the job's log.

**Results for 5 days.** Results are deleted 5 days after collection. Fetch them, or take them by webhook, before
then.

**Prepaid, per result.** Credits are bought up front and spent per result. `usageTotalUsd` reports each run's final
cost.

**Python only.** There's no JavaScript client. From JavaScript, call the REST API with `fetch`.

**Wait on `isTerminal`.** A run can read `FAILED` while an automatic retry is about to start; `call()` and
`wait_for_finish()` already wait for `isTerminal`. If you poll `client.run(id).get()` yourself, do the same.

**Not available:** key-value stores (`client.key_value_store()` raises `NotImplementedError`), deleting runs, and
Apify's build and memory options, which are accepted and ignored.

Apify and apify-client are trademarks of their owner. Go-Fetch is not affiliated with Apify.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.