# Overview

Copy for LLM

The Apify API client is the official library to access the [Apify REST API](https://docs.apify.com/api/v2) from your JavaScript/TypeScript applications. It runs both in Node.js and browser and provides useful features like automatic retries and convenience functions that improve the experience of using the Apify API.

The client simplifies interaction with the Apify platform by providing:

* Intuitive methods for working with [Actors](https://docs.apify.com/platform/actors), [datasets](https://docs.apify.com/platform/storage/dataset), [key-value stores](https://docs.apify.com/platform/storage/key-value-store), and other Apify resources
* Intelligent parsing of API responses and rich error messages for debugging
* Built-in [retries with exponential backoff](https://docs.apify.com/api/client/js/docs/concepts/retries.md) for failed requests
* Full TypeScript support with [types generated from the Apify OpenAPI specification](https://docs.apify.com/api/client/js/docs/concepts/typed-models.md)
* Cross-platform compatibility in [Node.js](https://nodejs.org/) v22+ and modern browsers

All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding.

## Prerequisites[](#prerequisites)

`apify-client` requires Node.js version 22.15 or higher. Node.js is available for download on the [official website](https://nodejs.org/). Check for your current Node.js version by running:

```
node -v
```

## Installation[](#installation)

You can install the client via [NPM](https://www.npmjs.com/) or any other package manager of your choice.

* NPM
* Yarn
* PNPM
* Bun

```
npm i apify-client
```

```
yarn add apify-client
```

```
pnpm add apify-client
```

```
bun add apify-client
```

The client sends its requests through the `fetch` of the runtime and compresses request bodies with brotli, so no optional packages are needed. For details, see [HTTP clients](https://docs.apify.com/api/client/js/docs/concepts/custom-http-clients.md) and [HTTP compression](https://docs.apify.com/api/client/js/docs/concepts/http-compression.md).

## Quick example[](#quick-example)

The following example shows how to run an Actor and retrieve its results:

```
import { ApifyClient } from 'apify-client';



// You can find your API token at https://console.apify.com/account/integrations.

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



// Start an Actor and wait for it to finish.

const run = await client.actor('apify/web-scraper').call({

    startUrls: [{ url: 'https://example.com' }],

    maxCrawlPages: 10,

});



// Fetch results from the Actor run's default dataset.

const { items } = await client.dataset(run.defaultDatasetId).listItems();

console.log(items);
```

> You can find your API token in the [Integrations section](https://console.apify.com/account/integrations) of Apify Console. See the [Quick start guide](https://docs.apify.com/api/client/js/docs/introduction/quick-start.md) for more details on authentication.
