diff --git a/website/versioned_docs/version-2/index.md b/docs/01_introduction/index.md
similarity index 60%
rename from website/versioned_docs/version-2/index.md
rename to docs/01_introduction/index.md
index b1c0fb285..5aba02679 100644
--- a/website/versioned_docs/version-2/index.md
+++ b/docs/01_introduction/index.md
@@ -1,6 +1,9 @@
---
-sidebar_label: 'Overview'
-title: 'Apify API client for JavaScript'
+id: introduction
+title: Overview
+sidebar_label: Overview
+slug: /
+description: 'The official JavaScript library to access the Apify API, with automatic retries, TypeScript support, and cross-platform compatibility.'
---
import Tabs from '@theme/Tabs';
@@ -12,13 +15,54 @@ 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 [exponential backoff](./getting-started.md#retries-with-exponential-backoff) for failed requests
+- Built-in [exponential backoff](../02_concepts/02_error-handling.md#retries-with-exponential-backoff) for failed requests
- Full TypeScript support with comprehensive type definitions
- Cross-platform compatibility in [Node.js](https://nodejs.org/) v16+ and modern browsers
All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding.
-> For installation instructions, check the [Getting Started Guide](./getting-started.md).
+## Pre-requisites
+
+`apify-client` requires Node.js version 16 or higher. Node.js is available for download on the [official website](https://nodejs.org/). Check for your current Node.js version by running:
+
+```bash
+node -v
+```
+
+## Installation
+
+You can install the client via [NPM](https://www.npmjs.com/) or any other package manager of your choice.
+
+
+
+
+```bash
+npm i apify-client
+```
+
+
+
+
+```bash
+yarn add apify-client
+```
+
+
+
+
+```bash
+pnpm add apify-client
+```
+
+
+
+
+```bash
+bun add apify-client
+```
+
+
+
## Quick example
@@ -29,7 +73,7 @@ import { ApifyClient } from 'apify-client';
// Initialize the client with your API token
const client = new ApifyClient({
- token: 'YOUR-APIFY-TOKEN',
+ token: 'MY-APIFY-TOKEN',
});
// Start an Actor and wait for it to finish
@@ -43,4 +87,4 @@ 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 [Getting Started Guide](./getting-started.md#authentication-and-initialization) for more details on authentication.
+> You can find your API token in the [Integrations section](https://console.apify.com/account/integrations) of Apify Console. See the [Quick start guide](./quick-start.md) for more details on authentication.
diff --git a/docs/01_introduction/quick-start.md b/docs/01_introduction/quick-start.md
new file mode 100644
index 000000000..827d41866
--- /dev/null
+++ b/docs/01_introduction/quick-start.md
@@ -0,0 +1,84 @@
+---
+id: quick-start
+title: Quick start
+sidebar_label: Quick start
+description: 'Get started with the Apify API client for JavaScript by running an Actor and retrieving results from its dataset.'
+---
+
+Learn how to authenticate, run Actors, and retrieve results using the Apify API client for JavaScript.
+
+---
+
+## Step 1: Authenticate the client
+
+To use the client, you need an [API token](https://docs.apify.com/platform/integrations/api#api-token). You can find your token under [Integrations](https://console.apify.com/account/integrations) tab in Apify Console. Copy the token and initialize the client by providing the token (`MY-APIFY-TOKEN`) as a parameter to the `ApifyClient` constructor.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+// Client initialization with the API token
+const client = new ApifyClient({
+ token: 'MY-APIFY-TOKEN',
+});
+```
+
+:::warning Secure access
+
+The API token is used to authorize your requests to the Apify API. You can be charged for the usage of the underlying services, so do not share your API token with untrusted parties or expose it on the client side of your applications.
+
+:::
+
+## Step 2: Run an Actor
+
+To start an Actor, call the [`client.actor()`](/reference/class/ActorClient) method with the Actor's ID (e.g. `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor owner's username and the Actor name. You can run both your own Actors and Actors from Apify Store.
+
+To define the Actor's input, pass a JSON object to the [`call()`](/reference/class/ActorClient#call) method that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Runs an Actor with an input and waits for it to finish.
+const { defaultDatasetId } = await client.actor('username/actor-name').call({
+ some: 'input',
+});
+```
+
+## Step 3: Get results from the dataset
+
+To get the results from the dataset, call the [`client.dataset()`](/reference/class/DatasetClient) method with the dataset ID, then call [`listItems()`](/reference/class/DatasetClient#listItems) to retrieve the data. You can get the dataset ID from the Actor's run object (represented by `defaultDatasetId`).
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Runs an Actor and waits for it to finish
+const { defaultDatasetId } = await client.actor('username/actor-name').call();
+
+// Lists items from the Actor's dataset
+const { items } = await client.dataset(defaultDatasetId).listItems();
+console.log(items);
+```
+
+:::note Dataset access
+
+Running an Actor might take time, depending on the Actor's complexity and the amount of data it processes. If you want only to get data and have an immediate response you should access the existing dataset of the finished [Actor run](https://docs.apify.com/platform/actors/running/runs-and-builds#runs).
+
+:::
+
+## Next steps
+
+### Concepts
+
+To learn more about how the client works, check out the Concepts section in the sidebar:
+
+- [Usage patterns](../02_concepts/01_usage-patterns.md) - resource clients, collection clients, and nested clients
+- [Error handling and retries](../02_concepts/02_error-handling.md) - automatic retries with exponential backoff
+- [Convenience functions](../02_concepts/03_convenience-functions.md) - `call()`, `waitForFinish()`, and more
+- [Pagination](../02_concepts/04_pagination.md) - iterating through large result sets
+
+### Guides
+
+For practical examples of common tasks, see [Code examples](../03_guides/01_examples.md).
diff --git a/docs/02_concepts/01_usage-patterns.md b/docs/02_concepts/01_usage-patterns.md
new file mode 100644
index 000000000..d7aa72206
--- /dev/null
+++ b/docs/02_concepts/01_usage-patterns.md
@@ -0,0 +1,69 @@
+---
+id: usage-patterns
+title: Usage patterns
+sidebar_label: Usage patterns
+description: 'Learn the resource client and collection client patterns used by the Apify API client for JavaScript.'
+---
+
+The `ApifyClient` interface follows a generic pattern that applies to all of its components. By calling individual methods of `ApifyClient`, specific clients that target individual API resources are created. There are two types of those clients:
+
+- [`ActorClient`](/reference/class/ActorClient): a client for the management of a single resource
+- [`ActorCollectionClient`](/reference/class/ActorCollectionClient): a client for the collection of resources
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Collection clients do not require a parameter.
+const actorCollectionClient = client.actors();
+// Creates an actor with the name: my-actor.
+const myActor = await actorCollectionClient.create({ name: 'my-actor-name' });
+// List all your used Actors (both own and from Apify Store)
+const { items } = await actorCollectionClient.list();
+```
+
+:::note Resource identification
+
+The resource ID can be either the `id` of the said resource, or a combination of your `username/resource-name`.
+
+:::
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Resource clients accept an ID of the resource.
+const actorClient = client.actor('username/actor-name');
+// Fetches the john-doe/my-actor object from the API.
+const myActor = await actorClient.get();
+// Starts the run of john-doe/my-actor and returns the Run object.
+const myActorRun = await actorClient.start();
+```
+
+## Nested clients
+
+Sometimes clients return other clients. That's to simplify working with nested collections, such as runs of a given Actor.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+const actorClient = client.actor('username/actor-name');
+const runsClient = actorClient.runs();
+// Lists the last 10 runs of your Actor.
+const { items } = await runsClient.list({
+ limit: 10,
+ desc: true,
+});
+
+// Select the last run of your Actor that finished
+// with a SUCCEEDED status.
+const lastSucceededRunClient = actorClient.lastRun({ status: 'SUCCEEDED' });
+// Fetches items from the run's dataset.
+const { items } = await lastSucceededRunClient.dataset().listItems();
+```
+
+The quick access to `dataset` and other storage directly from the run client can be used with the [`lastRun()`](/reference/class/ActorClient#lastRun) method.
diff --git a/docs/02_concepts/02_error-handling.md b/docs/02_concepts/02_error-handling.md
new file mode 100644
index 000000000..009340ac1
--- /dev/null
+++ b/docs/02_concepts/02_error-handling.md
@@ -0,0 +1,40 @@
+---
+id: error-handling
+title: Error handling and retries
+sidebar_label: Error handling and retries
+description: 'Handle API errors and configure automatic retries with exponential backoff in the Apify API client for JavaScript.'
+---
+
+Based on the endpoint, the client automatically extracts the relevant data and returns it in the expected format. Date strings are automatically converted to `Date` objects. For exceptions, the client throws an [`ApifyApiError`](/reference/class/ApifyApiError), which wraps the plain JSON errors returned by API and enriches them with other contexts for easier debugging.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+try {
+ const { items } = await client.dataset('non-existing-dataset-id').listItems();
+} catch (error) {
+ // The error is an instance of ApifyApiError
+ const { message, type, statusCode, clientMethod, path } = error;
+ // Log error for easier debugging
+ console.log({ message, statusCode, clientMethod, type });
+}
+```
+
+## Retries with exponential backoff
+
+The client automatically retries requests that fail due to network errors, Apify API internal errors (HTTP 500+), or rate limit errors (HTTP 429). By default, the client retries up to 8 times with exponential backoff starting at 500ms.
+
+To configure retry behavior, set the `maxRetries` and `minDelayBetweenRetriesMillis` options in the `ApifyClient` constructor:
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({
+ token: 'MY-APIFY-TOKEN',
+ maxRetries: 8,
+ minDelayBetweenRetriesMillis: 500, // 0.5s
+ timeoutSecs: 360, // 6 mins
+});
+```
diff --git a/docs/02_concepts/03_convenience-functions.md b/docs/02_concepts/03_convenience-functions.md
new file mode 100644
index 000000000..2aa978bd7
--- /dev/null
+++ b/docs/02_concepts/03_convenience-functions.md
@@ -0,0 +1,24 @@
+---
+id: convenience-functions
+title: Convenience functions
+sidebar_label: Convenience functions
+description: 'Use call(), waitForFinish(), and other convenience functions in the Apify API client for JavaScript.'
+---
+
+Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish (because of network timeouts). The client provides convenient `call()` and `waitForFinish()` functions that do that. If the limit is reached, the returned promise is resolved to a run object that will have status `READY` or `RUNNING` and it will not contain the Actor run output.
+
+[Key-value store](https://docs.apify.com/platform/storage/key-value-store) records can be retrieved as objects, buffers, or streams via the respective options, dataset items can be fetched as individual objects or serialized data.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Starts an Actor and waits for it to finish.
+const finishedActorRun = await client.actor('username/actor-name').call();
+
+// Starts an Actor and waits maximum 60s for the finish
+const { status } = await client.actor('username/actor-name').start({
+ waitForFinish: 60, // 1 minute
+});
+```
diff --git a/docs/02_concepts/04_pagination.md b/docs/02_concepts/04_pagination.md
new file mode 100644
index 000000000..e02bfefea
--- /dev/null
+++ b/docs/02_concepts/04_pagination.md
@@ -0,0 +1,31 @@
+---
+id: pagination
+title: Pagination
+sidebar_label: Pagination
+description: 'Paginate through large result sets and use async iteration with the Apify API client for JavaScript.'
+---
+
+Methods that return lists (such as `list()` or `listSomething()`) return a [`PaginatedList`](/reference/interface/PaginatedList) object. Exceptions include `listKeys()` and `listHead()`, which use different pagination mechanisms.
+
+The list results are stored in the `items` property. Use the `limit` parameter to retrieve a specific number of results. Additional properties vary by method—see the method reference for details.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Resource clients accept an ID of the resource.
+const datasetClient = client.dataset('dataset-id');
+
+// Maximum amount of items to fetch in total
+const limit = 1000;
+// Maximum amount of items to fetch in one API call
+const chunkSize = 100;
+// Initial offset
+const offset = 0;
+
+for await (const item of datasetClient.listItems({ limit, offset, chunkSize })) {
+ // Processs individual item
+ console.log(item);
+}
+```
diff --git a/docs/02_concepts/05_bundled-environments.md b/docs/02_concepts/05_bundled-environments.md
new file mode 100644
index 000000000..94d6663b8
--- /dev/null
+++ b/docs/02_concepts/05_bundled-environments.md
@@ -0,0 +1,22 @@
+---
+id: bundled-environments
+title: Use in bundled environments
+sidebar_label: Bundled environments
+description: 'Use the Apify API client for JavaScript in browsers, Cloudflare Workers, and other edge runtimes.'
+---
+
+:::warning Non-Node.js environments
+
+This applies only to non-Node.js environments (browsers, Cloudflare Workers, edge runtimes). If you're running on Node.js, you can skip this section.
+
+:::
+
+The package ships a pre-built browser bundle that is automatically resolved when your bundler targets a browser environment. If it isn't picked up automatically, you can import it directly:
+
+```js
+import { ApifyClient } from 'apify-client/browser';
+```
+
+For Cloudflare Workers or other edge runtimes that don't provide Node built-ins, you may need to enable Node compatibility in your runtime config (e.g. `node_compat = true`.
+
+Note that some Node-specific features (streaming APIs, proxy) are not available in the browser bundle.
diff --git a/docs/examples/index.md b/docs/03_guides/01_examples.md
similarity index 97%
rename from docs/examples/index.md
rename to docs/03_guides/01_examples.md
index bcbdf24f5..869f3d277 100644
--- a/docs/examples/index.md
+++ b/docs/03_guides/01_examples.md
@@ -1,6 +1,8 @@
---
+id: examples
+title: Code examples
sidebar_label: Examples
-title: 'Code examples'
+description: 'Practical code examples for common tasks with the Apify API client for JavaScript, including webhooks and datasets.'
---
## Passing an input to the Actor
diff --git a/docs/getting-started.md b/docs/getting-started.md
deleted file mode 100644
index 460cfc618..000000000
--- a/docs/getting-started.md
+++ /dev/null
@@ -1,292 +0,0 @@
----
-sidebar_label: 'Getting started'
-title: 'Getting started with JavaScript client'
----
-
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-
-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. All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding.
-
-## Pre-requisites
-
-`apify-client` requires Node.js version 16 or higher. Node.js is available for download on the [official website](https://nodejs.org/). Check for your current Node.js version by running:
-
-```bash
-node -v
-```
-
-## Installation
-
-You can install the client via [NPM](https://www.npmjs.com/) or any other package manager of your choice.
-
-
-
-
-```bash
-npm i apify-client
-```
-
-
-
-
-```bash
-yarn add apify-client
-```
-
-
-
-
-```bash
-pnpm add apify-client
-```
-
-
-
-
-```bash
-bun add apify-client
-```
-
-
-
-
-## Authentication and Initialization
-
-To use the client, you need an [API token](https://docs.apify.com/platform/integrations/api#api-token). You can find your token under [Integrations](https://console.apify.com/account/integrations) tab in Apify Console. Copy the token and initialize the client by providing the token (`MY-APIFY-TOKEN`) as a parameter to the `ApifyClient` constructor.
-
-```js
-// import Apify client
-import { ApifyClient } from 'apify-client';
-
-// Client initialization with the API token
-const client = new ApifyClient({
- token: 'MY-APIFY-TOKEN',
-});
-```
-
-:::warning Secure access
-
-The API token is used to authorize your requests to the Apify API. You can be charged for the usage of the underlying services, so do not share your API token with untrusted parties or expose it on the client side of your applications
-
-:::
-
-## Quick start
-
-One of the most common use cases is starting [Actors](https://docs.apify.com/platform/actors) (serverless programs running in the [Apify platform](https://docs.apify.com/platform)) and getting results from their [datasets](https://docs.apify.com/platform/storage/dataset) after they finish the job (either scraping, automation processes or data processing).
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Starts an Actor and waits for it to finish
-const { defaultDatasetId } = await client.actor('username/actor-name').call();
-
-// Lists items from the Actor's dataset
-const { items } = await client.dataset(defaultDatasetId).listItems();
-```
-
-### Running Actors
-
-To start an Actor, call the [`client.actor()`](/reference/class/ActorClient) method with the Actor's ID (e.g. `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor name and the Actor owner's username. You can run both your own Actors and Actors from Apify Store.
-
-#### Passing input to the Actor
-
-To define the Actor's input, call the [`call()`](/reference/class/ActorClient#call) method with a JSON object that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Runs an Actor with an input and waits for it to finish.
-const { defaultDatasetId } = await client.actor('username/actor-name').call({
- some: 'input',
-});
-```
-
-### Getting results from the dataset
-
-To get the results from the dataset, call the [`client.dataset()`](/reference/class/DatasetClient) method with the dataset ID, then call [`listItems()`](/reference/class/DatasetClient#listItems) to retrieve the data. You can get the dataset ID from the Actor's run object (represented by `defaultDatasetId`).
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Lists items from the Actor's dataset.
-const { items } = await client.dataset('dataset-id').listItems();
-```
-
-:::note Dataset access
-
-Running an Actor might take time, depending on the Actor's complexity and the amount of data it processes. If you want only to get data and have an immediate response you should access the existing dataset of the finished [Actor run](https://docs.apify.com/platform/actors/running/runs-and-builds#runs).
-
-:::
-
-## Usage concepts
-
-The `ApifyClient` interface follows a generic pattern that applies to all of its components. By calling individual methods of `ApifyClient`, specific clients that target individual API resources are created. There are two types of those clients:
-
-- [`ActorClient`](/reference/class/ActorClient): a client for the management of a single resource
-- [`ActorCollectionClient`](/reference/class/ActorCollectionClient): a client for the collection of resources
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Collection clients do not require a parameter.
-const actorCollectionClient = client.actors();
-// Creates an actor with the name: my-actor.
-const myActor = await actorCollectionClient.create({ name: 'my-actor-name' });
-// List all your used Actors (both own and from Apify Store)
-const { items } = await actorCollectionClient.list();
-```
-
-:::note Resource identification
-
-The resource ID can be either the `id` of the said resource, or a combination of your `username/resource-name`.
-
-:::
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Resource clients accept an ID of the resource.
-const actorClient = client.actor('username/actor-name');
-// Fetches the john-doe/my-actor object from the API.
-const myActor = await actorClient.get();
-// Starts the run of john-doe/my-actor and returns the Run object.
-const myActorRun = await actorClient.start();
-```
-
-### Nested clients
-
-Sometimes clients return other clients. That's to simplify working with nested collections, such as runs of a given Actor.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-const actorClient = client.actor('username/actor-name');
-const runsClient = actorClient.runs();
-// Lists the last 10 runs of your Actor.
-const { items } = await runsClient.list({
- limit: 10,
- desc: true,
-});
-
-// Select the last run of your Actor that finished
-// with a SUCCEEDED status.
-const lastSucceededRunClient = actorClient.lastRun({ status: 'SUCCEEDED' });
-// Fetches items from the run's dataset.
-const { items } = await lastSucceededRunClient.dataset().listItems();
-```
-
-The quick access to `dataset` and other storage directly from the run client can be used with the [`lastRun()`](/reference/class/ActorClient#lastRun) method.
-
-## Features
-
-Based on the endpoint, the client automatically extracts the relevant data and returns it in the expected format. Date strings are automatically converted to `Date` objects. For exceptions, the client throws an [`ApifyApiError`](/reference/class/ApifyApiError), which wraps the plain JSON errors returned by API and enriches them with other contexts for easier debugging.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-try {
- const { items } = await client.dataset('non-existing-dataset-id').listItems();
-} catch (error) {
- // The error is an instance of ApifyApiError
- const { message, type, statusCode, clientMethod, path } = error;
- // Log error for easier debugging
- console.log({ message, statusCode, clientMethod, type });
-}
-```
-
-### Retries with exponential backoff
-
-The client automatically retries requests that fail due to network errors, Apify API internal errors (HTTP 500+), or rate limit errors (HTTP 429). By default, the client retries up to 8 times with exponential backoff starting at 500ms.
-
-To configure retry behavior, set the `maxRetries` and `minDelayBetweenRetriesMillis` options in the `ApifyClient` constructor:
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({
- token: 'MY-APIFY-TOKEN',
- maxRetries: 8,
- minDelayBetweenRetriesMillis: 500, // 0.5s
- timeoutSecs: 360, // 6 mins
-});
-```
-
-### Convenience functions and options
-
-Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish (because of network timeouts). The client provides convenient `call()` and `waitForFinish()` functions that do that. If the limit is reached, the returned promise is resolved to a run object that will have status `READY` or `RUNNING` and it will not contain the Actor run output.
-
-[Key-value store](https://docs.apify.com/platform/storage/key-value-store) records can be retrieved as objects, buffers, or streams via the respective options, dataset items can be fetched as individual objects or serialized data.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Starts an Actor and waits for it to finish.
-const finishedActorRun = await client.actor('username/actor-name').call();
-
-// Starts an Actor and waits maximum 60s for the finish
-const { status } = await client.actor('username/actor-name').start({
- waitForFinish: 60, // 1 minute
-});
-```
-
-### Using in bundled environments
-
-:::warning Advanced
-
-This applies only to non-Node.js environments (browsers, Cloudflare Workers, edge runtimes). If you're running on Node.js, you can skip this section.
-
-:::
-
-The package ships a pre-built browser bundle that is automatically resolved when your bundler targets a browser environment. If it isn't picked up automatically, you can import it directly:
-
-```js
-import { ApifyClient } from 'apify-client/browser';
-```
-
-For Cloudflare Workers or other edge runtimes that don't provide Node built-ins, you may need to enable Node compatibility in your runtime config (e.g. `node_compat = true`.
-
-Note that some Node-specific features (streaming APIs, proxy) are not available in the browser bundle.
-
-### Pagination
-
-Methods that return lists (such as `list()` or `listSomething()`) return a [`PaginatedList`](/reference/interface/PaginatedList) object. Exceptions include `listKeys()` and `listHead()`, which use different pagination mechanisms.
-
-The list results are stored in the `items` property. Use the `limit` parameter to retrieve a specific number of results. Additional properties vary by method—see the method reference for details.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Resource clients accept an ID of the resource.
-const datasetClient = client.dataset('dataset-id');
-
-// Maximum amount of items to fetch in total
-const limit = 1000;
-// Maximum amount of items to fetch in one API call
-const chunkSize = 100;
-// Initial offset
-const offset = 0;
-
-for await (const item of datasetClient.listItems({ limit, offset, chunkSize })) {
- // Processs individual item
- console.log(item);
-}
-```
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index b0517df1e..88eb7b1bb 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -46,13 +46,8 @@ module.exports = {
{
to: 'docs',
label: 'Docs',
- activeBaseRegex: '/docs(?!/changelog|/examples)',
+ activeBaseRegex: '/docs(?!/changelog)',
},
- // {
- // to: 'docs/examples',
- // label: 'Examples',
- // activeBaseRegex: '/docs/examples',
- // },
{
to: 'reference',
label: 'Reference',
diff --git a/website/sidebars.js b/website/sidebars.js
index 57bb54308..89f7784ee 100644
--- a/website/sidebars.js
+++ b/website/sidebars.js
@@ -1,9 +1,38 @@
-module.exports = [
- [
+module.exports = {
+ sidebar: [
+ {
+ type: 'doc',
+ id: 'introduction/introduction',
+ },
+ {
+ type: 'doc',
+ id: 'introduction/quick-start',
+ },
{
type: 'category',
- label: 'API Client',
- items: ['index', 'getting-started', 'examples/index'],
+ label: 'Concepts',
+ collapsed: true,
+ items: [
+ {
+ type: 'autogenerated',
+ dirName: '02_concepts',
+ },
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Guides',
+ collapsed: true,
+ items: [
+ {
+ type: 'autogenerated',
+ dirName: '03_guides',
+ },
+ ],
+ },
+ {
+ type: 'doc',
+ id: 'changelog',
},
],
-];
+};
diff --git a/docs/index.md b/website/versioned_docs/version-2/01_introduction/index.md
similarity index 60%
rename from docs/index.md
rename to website/versioned_docs/version-2/01_introduction/index.md
index b1c0fb285..5aba02679 100644
--- a/docs/index.md
+++ b/website/versioned_docs/version-2/01_introduction/index.md
@@ -1,6 +1,9 @@
---
-sidebar_label: 'Overview'
-title: 'Apify API client for JavaScript'
+id: introduction
+title: Overview
+sidebar_label: Overview
+slug: /
+description: 'The official JavaScript library to access the Apify API, with automatic retries, TypeScript support, and cross-platform compatibility.'
---
import Tabs from '@theme/Tabs';
@@ -12,13 +15,54 @@ 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 [exponential backoff](./getting-started.md#retries-with-exponential-backoff) for failed requests
+- Built-in [exponential backoff](../02_concepts/02_error-handling.md#retries-with-exponential-backoff) for failed requests
- Full TypeScript support with comprehensive type definitions
- Cross-platform compatibility in [Node.js](https://nodejs.org/) v16+ and modern browsers
All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding.
-> For installation instructions, check the [Getting Started Guide](./getting-started.md).
+## Pre-requisites
+
+`apify-client` requires Node.js version 16 or higher. Node.js is available for download on the [official website](https://nodejs.org/). Check for your current Node.js version by running:
+
+```bash
+node -v
+```
+
+## Installation
+
+You can install the client via [NPM](https://www.npmjs.com/) or any other package manager of your choice.
+
+
+
+
+```bash
+npm i apify-client
+```
+
+
+
+
+```bash
+yarn add apify-client
+```
+
+
+
+
+```bash
+pnpm add apify-client
+```
+
+
+
+
+```bash
+bun add apify-client
+```
+
+
+
## Quick example
@@ -29,7 +73,7 @@ import { ApifyClient } from 'apify-client';
// Initialize the client with your API token
const client = new ApifyClient({
- token: 'YOUR-APIFY-TOKEN',
+ token: 'MY-APIFY-TOKEN',
});
// Start an Actor and wait for it to finish
@@ -43,4 +87,4 @@ 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 [Getting Started Guide](./getting-started.md#authentication-and-initialization) for more details on authentication.
+> You can find your API token in the [Integrations section](https://console.apify.com/account/integrations) of Apify Console. See the [Quick start guide](./quick-start.md) for more details on authentication.
diff --git a/website/versioned_docs/version-2/01_introduction/quick-start.md b/website/versioned_docs/version-2/01_introduction/quick-start.md
new file mode 100644
index 000000000..827d41866
--- /dev/null
+++ b/website/versioned_docs/version-2/01_introduction/quick-start.md
@@ -0,0 +1,84 @@
+---
+id: quick-start
+title: Quick start
+sidebar_label: Quick start
+description: 'Get started with the Apify API client for JavaScript by running an Actor and retrieving results from its dataset.'
+---
+
+Learn how to authenticate, run Actors, and retrieve results using the Apify API client for JavaScript.
+
+---
+
+## Step 1: Authenticate the client
+
+To use the client, you need an [API token](https://docs.apify.com/platform/integrations/api#api-token). You can find your token under [Integrations](https://console.apify.com/account/integrations) tab in Apify Console. Copy the token and initialize the client by providing the token (`MY-APIFY-TOKEN`) as a parameter to the `ApifyClient` constructor.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+// Client initialization with the API token
+const client = new ApifyClient({
+ token: 'MY-APIFY-TOKEN',
+});
+```
+
+:::warning Secure access
+
+The API token is used to authorize your requests to the Apify API. You can be charged for the usage of the underlying services, so do not share your API token with untrusted parties or expose it on the client side of your applications.
+
+:::
+
+## Step 2: Run an Actor
+
+To start an Actor, call the [`client.actor()`](/reference/class/ActorClient) method with the Actor's ID (e.g. `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor owner's username and the Actor name. You can run both your own Actors and Actors from Apify Store.
+
+To define the Actor's input, pass a JSON object to the [`call()`](/reference/class/ActorClient#call) method that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Runs an Actor with an input and waits for it to finish.
+const { defaultDatasetId } = await client.actor('username/actor-name').call({
+ some: 'input',
+});
+```
+
+## Step 3: Get results from the dataset
+
+To get the results from the dataset, call the [`client.dataset()`](/reference/class/DatasetClient) method with the dataset ID, then call [`listItems()`](/reference/class/DatasetClient#listItems) to retrieve the data. You can get the dataset ID from the Actor's run object (represented by `defaultDatasetId`).
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Runs an Actor and waits for it to finish
+const { defaultDatasetId } = await client.actor('username/actor-name').call();
+
+// Lists items from the Actor's dataset
+const { items } = await client.dataset(defaultDatasetId).listItems();
+console.log(items);
+```
+
+:::note Dataset access
+
+Running an Actor might take time, depending on the Actor's complexity and the amount of data it processes. If you want only to get data and have an immediate response you should access the existing dataset of the finished [Actor run](https://docs.apify.com/platform/actors/running/runs-and-builds#runs).
+
+:::
+
+## Next steps
+
+### Concepts
+
+To learn more about how the client works, check out the Concepts section in the sidebar:
+
+- [Usage patterns](../02_concepts/01_usage-patterns.md) - resource clients, collection clients, and nested clients
+- [Error handling and retries](../02_concepts/02_error-handling.md) - automatic retries with exponential backoff
+- [Convenience functions](../02_concepts/03_convenience-functions.md) - `call()`, `waitForFinish()`, and more
+- [Pagination](../02_concepts/04_pagination.md) - iterating through large result sets
+
+### Guides
+
+For practical examples of common tasks, see [Code examples](../03_guides/01_examples.md).
diff --git a/website/versioned_docs/version-2/02_concepts/01_usage-patterns.md b/website/versioned_docs/version-2/02_concepts/01_usage-patterns.md
new file mode 100644
index 000000000..d7aa72206
--- /dev/null
+++ b/website/versioned_docs/version-2/02_concepts/01_usage-patterns.md
@@ -0,0 +1,69 @@
+---
+id: usage-patterns
+title: Usage patterns
+sidebar_label: Usage patterns
+description: 'Learn the resource client and collection client patterns used by the Apify API client for JavaScript.'
+---
+
+The `ApifyClient` interface follows a generic pattern that applies to all of its components. By calling individual methods of `ApifyClient`, specific clients that target individual API resources are created. There are two types of those clients:
+
+- [`ActorClient`](/reference/class/ActorClient): a client for the management of a single resource
+- [`ActorCollectionClient`](/reference/class/ActorCollectionClient): a client for the collection of resources
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Collection clients do not require a parameter.
+const actorCollectionClient = client.actors();
+// Creates an actor with the name: my-actor.
+const myActor = await actorCollectionClient.create({ name: 'my-actor-name' });
+// List all your used Actors (both own and from Apify Store)
+const { items } = await actorCollectionClient.list();
+```
+
+:::note Resource identification
+
+The resource ID can be either the `id` of the said resource, or a combination of your `username/resource-name`.
+
+:::
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Resource clients accept an ID of the resource.
+const actorClient = client.actor('username/actor-name');
+// Fetches the john-doe/my-actor object from the API.
+const myActor = await actorClient.get();
+// Starts the run of john-doe/my-actor and returns the Run object.
+const myActorRun = await actorClient.start();
+```
+
+## Nested clients
+
+Sometimes clients return other clients. That's to simplify working with nested collections, such as runs of a given Actor.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+const actorClient = client.actor('username/actor-name');
+const runsClient = actorClient.runs();
+// Lists the last 10 runs of your Actor.
+const { items } = await runsClient.list({
+ limit: 10,
+ desc: true,
+});
+
+// Select the last run of your Actor that finished
+// with a SUCCEEDED status.
+const lastSucceededRunClient = actorClient.lastRun({ status: 'SUCCEEDED' });
+// Fetches items from the run's dataset.
+const { items } = await lastSucceededRunClient.dataset().listItems();
+```
+
+The quick access to `dataset` and other storage directly from the run client can be used with the [`lastRun()`](/reference/class/ActorClient#lastRun) method.
diff --git a/website/versioned_docs/version-2/02_concepts/02_error-handling.md b/website/versioned_docs/version-2/02_concepts/02_error-handling.md
new file mode 100644
index 000000000..009340ac1
--- /dev/null
+++ b/website/versioned_docs/version-2/02_concepts/02_error-handling.md
@@ -0,0 +1,40 @@
+---
+id: error-handling
+title: Error handling and retries
+sidebar_label: Error handling and retries
+description: 'Handle API errors and configure automatic retries with exponential backoff in the Apify API client for JavaScript.'
+---
+
+Based on the endpoint, the client automatically extracts the relevant data and returns it in the expected format. Date strings are automatically converted to `Date` objects. For exceptions, the client throws an [`ApifyApiError`](/reference/class/ApifyApiError), which wraps the plain JSON errors returned by API and enriches them with other contexts for easier debugging.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+try {
+ const { items } = await client.dataset('non-existing-dataset-id').listItems();
+} catch (error) {
+ // The error is an instance of ApifyApiError
+ const { message, type, statusCode, clientMethod, path } = error;
+ // Log error for easier debugging
+ console.log({ message, statusCode, clientMethod, type });
+}
+```
+
+## Retries with exponential backoff
+
+The client automatically retries requests that fail due to network errors, Apify API internal errors (HTTP 500+), or rate limit errors (HTTP 429). By default, the client retries up to 8 times with exponential backoff starting at 500ms.
+
+To configure retry behavior, set the `maxRetries` and `minDelayBetweenRetriesMillis` options in the `ApifyClient` constructor:
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({
+ token: 'MY-APIFY-TOKEN',
+ maxRetries: 8,
+ minDelayBetweenRetriesMillis: 500, // 0.5s
+ timeoutSecs: 360, // 6 mins
+});
+```
diff --git a/website/versioned_docs/version-2/02_concepts/03_convenience-functions.md b/website/versioned_docs/version-2/02_concepts/03_convenience-functions.md
new file mode 100644
index 000000000..2aa978bd7
--- /dev/null
+++ b/website/versioned_docs/version-2/02_concepts/03_convenience-functions.md
@@ -0,0 +1,24 @@
+---
+id: convenience-functions
+title: Convenience functions
+sidebar_label: Convenience functions
+description: 'Use call(), waitForFinish(), and other convenience functions in the Apify API client for JavaScript.'
+---
+
+Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish (because of network timeouts). The client provides convenient `call()` and `waitForFinish()` functions that do that. If the limit is reached, the returned promise is resolved to a run object that will have status `READY` or `RUNNING` and it will not contain the Actor run output.
+
+[Key-value store](https://docs.apify.com/platform/storage/key-value-store) records can be retrieved as objects, buffers, or streams via the respective options, dataset items can be fetched as individual objects or serialized data.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Starts an Actor and waits for it to finish.
+const finishedActorRun = await client.actor('username/actor-name').call();
+
+// Starts an Actor and waits maximum 60s for the finish
+const { status } = await client.actor('username/actor-name').start({
+ waitForFinish: 60, // 1 minute
+});
+```
diff --git a/website/versioned_docs/version-2/02_concepts/04_pagination.md b/website/versioned_docs/version-2/02_concepts/04_pagination.md
new file mode 100644
index 000000000..e02bfefea
--- /dev/null
+++ b/website/versioned_docs/version-2/02_concepts/04_pagination.md
@@ -0,0 +1,31 @@
+---
+id: pagination
+title: Pagination
+sidebar_label: Pagination
+description: 'Paginate through large result sets and use async iteration with the Apify API client for JavaScript.'
+---
+
+Methods that return lists (such as `list()` or `listSomething()`) return a [`PaginatedList`](/reference/interface/PaginatedList) object. Exceptions include `listKeys()` and `listHead()`, which use different pagination mechanisms.
+
+The list results are stored in the `items` property. Use the `limit` parameter to retrieve a specific number of results. Additional properties vary by method—see the method reference for details.
+
+```js
+import { ApifyClient } from 'apify-client';
+
+const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
+
+// Resource clients accept an ID of the resource.
+const datasetClient = client.dataset('dataset-id');
+
+// Maximum amount of items to fetch in total
+const limit = 1000;
+// Maximum amount of items to fetch in one API call
+const chunkSize = 100;
+// Initial offset
+const offset = 0;
+
+for await (const item of datasetClient.listItems({ limit, offset, chunkSize })) {
+ // Processs individual item
+ console.log(item);
+}
+```
diff --git a/website/versioned_docs/version-2/02_concepts/05_bundled-environments.md b/website/versioned_docs/version-2/02_concepts/05_bundled-environments.md
new file mode 100644
index 000000000..9f2263c9b
--- /dev/null
+++ b/website/versioned_docs/version-2/02_concepts/05_bundled-environments.md
@@ -0,0 +1,22 @@
+---
+id: bundled-environments
+title: Use in bundled environments
+sidebar_label: Bundled environments
+description: 'Use the Apify API client for JavaScript in browsers, Cloudflare Workers, and other edge runtimes.'
+---
+
+:::warning Advanced
+
+This applies only to non-Node.js environments (browsers, Cloudflare Workers, edge runtimes). If you're running on Node.js, you can skip this section.
+
+:::
+
+The package ships a pre-built browser bundle that is automatically resolved when your bundler targets a browser environment. If it isn't picked up automatically, you can import it directly:
+
+```js
+import { ApifyClient } from 'apify-client/browser';
+```
+
+For Cloudflare Workers or other edge runtimes that don't provide Node built-ins, you may need to enable Node compatibility in your runtime config (e.g. `node_compat = true`.
+
+Note that some Node-specific features (streaming APIs, proxy) are not available in the browser bundle.
diff --git a/website/versioned_docs/version-2/examples/index.md b/website/versioned_docs/version-2/03_guides/01_examples.md
similarity index 97%
rename from website/versioned_docs/version-2/examples/index.md
rename to website/versioned_docs/version-2/03_guides/01_examples.md
index bcbdf24f5..869f3d277 100644
--- a/website/versioned_docs/version-2/examples/index.md
+++ b/website/versioned_docs/version-2/03_guides/01_examples.md
@@ -1,6 +1,8 @@
---
+id: examples
+title: Code examples
sidebar_label: Examples
-title: 'Code examples'
+description: 'Practical code examples for common tasks with the Apify API client for JavaScript, including webhooks and datasets.'
---
## Passing an input to the Actor
diff --git a/website/versioned_docs/version-2/getting-started.md b/website/versioned_docs/version-2/getting-started.md
deleted file mode 100644
index 460cfc618..000000000
--- a/website/versioned_docs/version-2/getting-started.md
+++ /dev/null
@@ -1,292 +0,0 @@
----
-sidebar_label: 'Getting started'
-title: 'Getting started with JavaScript client'
----
-
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
-
-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. All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding.
-
-## Pre-requisites
-
-`apify-client` requires Node.js version 16 or higher. Node.js is available for download on the [official website](https://nodejs.org/). Check for your current Node.js version by running:
-
-```bash
-node -v
-```
-
-## Installation
-
-You can install the client via [NPM](https://www.npmjs.com/) or any other package manager of your choice.
-
-
-
-
-```bash
-npm i apify-client
-```
-
-
-
-
-```bash
-yarn add apify-client
-```
-
-
-
-
-```bash
-pnpm add apify-client
-```
-
-
-
-
-```bash
-bun add apify-client
-```
-
-
-
-
-## Authentication and Initialization
-
-To use the client, you need an [API token](https://docs.apify.com/platform/integrations/api#api-token). You can find your token under [Integrations](https://console.apify.com/account/integrations) tab in Apify Console. Copy the token and initialize the client by providing the token (`MY-APIFY-TOKEN`) as a parameter to the `ApifyClient` constructor.
-
-```js
-// import Apify client
-import { ApifyClient } from 'apify-client';
-
-// Client initialization with the API token
-const client = new ApifyClient({
- token: 'MY-APIFY-TOKEN',
-});
-```
-
-:::warning Secure access
-
-The API token is used to authorize your requests to the Apify API. You can be charged for the usage of the underlying services, so do not share your API token with untrusted parties or expose it on the client side of your applications
-
-:::
-
-## Quick start
-
-One of the most common use cases is starting [Actors](https://docs.apify.com/platform/actors) (serverless programs running in the [Apify platform](https://docs.apify.com/platform)) and getting results from their [datasets](https://docs.apify.com/platform/storage/dataset) after they finish the job (either scraping, automation processes or data processing).
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Starts an Actor and waits for it to finish
-const { defaultDatasetId } = await client.actor('username/actor-name').call();
-
-// Lists items from the Actor's dataset
-const { items } = await client.dataset(defaultDatasetId).listItems();
-```
-
-### Running Actors
-
-To start an Actor, call the [`client.actor()`](/reference/class/ActorClient) method with the Actor's ID (e.g. `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor name and the Actor owner's username. You can run both your own Actors and Actors from Apify Store.
-
-#### Passing input to the Actor
-
-To define the Actor's input, call the [`call()`](/reference/class/ActorClient#call) method with a JSON object that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Runs an Actor with an input and waits for it to finish.
-const { defaultDatasetId } = await client.actor('username/actor-name').call({
- some: 'input',
-});
-```
-
-### Getting results from the dataset
-
-To get the results from the dataset, call the [`client.dataset()`](/reference/class/DatasetClient) method with the dataset ID, then call [`listItems()`](/reference/class/DatasetClient#listItems) to retrieve the data. You can get the dataset ID from the Actor's run object (represented by `defaultDatasetId`).
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Lists items from the Actor's dataset.
-const { items } = await client.dataset('dataset-id').listItems();
-```
-
-:::note Dataset access
-
-Running an Actor might take time, depending on the Actor's complexity and the amount of data it processes. If you want only to get data and have an immediate response you should access the existing dataset of the finished [Actor run](https://docs.apify.com/platform/actors/running/runs-and-builds#runs).
-
-:::
-
-## Usage concepts
-
-The `ApifyClient` interface follows a generic pattern that applies to all of its components. By calling individual methods of `ApifyClient`, specific clients that target individual API resources are created. There are two types of those clients:
-
-- [`ActorClient`](/reference/class/ActorClient): a client for the management of a single resource
-- [`ActorCollectionClient`](/reference/class/ActorCollectionClient): a client for the collection of resources
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Collection clients do not require a parameter.
-const actorCollectionClient = client.actors();
-// Creates an actor with the name: my-actor.
-const myActor = await actorCollectionClient.create({ name: 'my-actor-name' });
-// List all your used Actors (both own and from Apify Store)
-const { items } = await actorCollectionClient.list();
-```
-
-:::note Resource identification
-
-The resource ID can be either the `id` of the said resource, or a combination of your `username/resource-name`.
-
-:::
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Resource clients accept an ID of the resource.
-const actorClient = client.actor('username/actor-name');
-// Fetches the john-doe/my-actor object from the API.
-const myActor = await actorClient.get();
-// Starts the run of john-doe/my-actor and returns the Run object.
-const myActorRun = await actorClient.start();
-```
-
-### Nested clients
-
-Sometimes clients return other clients. That's to simplify working with nested collections, such as runs of a given Actor.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-const actorClient = client.actor('username/actor-name');
-const runsClient = actorClient.runs();
-// Lists the last 10 runs of your Actor.
-const { items } = await runsClient.list({
- limit: 10,
- desc: true,
-});
-
-// Select the last run of your Actor that finished
-// with a SUCCEEDED status.
-const lastSucceededRunClient = actorClient.lastRun({ status: 'SUCCEEDED' });
-// Fetches items from the run's dataset.
-const { items } = await lastSucceededRunClient.dataset().listItems();
-```
-
-The quick access to `dataset` and other storage directly from the run client can be used with the [`lastRun()`](/reference/class/ActorClient#lastRun) method.
-
-## Features
-
-Based on the endpoint, the client automatically extracts the relevant data and returns it in the expected format. Date strings are automatically converted to `Date` objects. For exceptions, the client throws an [`ApifyApiError`](/reference/class/ApifyApiError), which wraps the plain JSON errors returned by API and enriches them with other contexts for easier debugging.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-try {
- const { items } = await client.dataset('non-existing-dataset-id').listItems();
-} catch (error) {
- // The error is an instance of ApifyApiError
- const { message, type, statusCode, clientMethod, path } = error;
- // Log error for easier debugging
- console.log({ message, statusCode, clientMethod, type });
-}
-```
-
-### Retries with exponential backoff
-
-The client automatically retries requests that fail due to network errors, Apify API internal errors (HTTP 500+), or rate limit errors (HTTP 429). By default, the client retries up to 8 times with exponential backoff starting at 500ms.
-
-To configure retry behavior, set the `maxRetries` and `minDelayBetweenRetriesMillis` options in the `ApifyClient` constructor:
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({
- token: 'MY-APIFY-TOKEN',
- maxRetries: 8,
- minDelayBetweenRetriesMillis: 500, // 0.5s
- timeoutSecs: 360, // 6 mins
-});
-```
-
-### Convenience functions and options
-
-Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish (because of network timeouts). The client provides convenient `call()` and `waitForFinish()` functions that do that. If the limit is reached, the returned promise is resolved to a run object that will have status `READY` or `RUNNING` and it will not contain the Actor run output.
-
-[Key-value store](https://docs.apify.com/platform/storage/key-value-store) records can be retrieved as objects, buffers, or streams via the respective options, dataset items can be fetched as individual objects or serialized data.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Starts an Actor and waits for it to finish.
-const finishedActorRun = await client.actor('username/actor-name').call();
-
-// Starts an Actor and waits maximum 60s for the finish
-const { status } = await client.actor('username/actor-name').start({
- waitForFinish: 60, // 1 minute
-});
-```
-
-### Using in bundled environments
-
-:::warning Advanced
-
-This applies only to non-Node.js environments (browsers, Cloudflare Workers, edge runtimes). If you're running on Node.js, you can skip this section.
-
-:::
-
-The package ships a pre-built browser bundle that is automatically resolved when your bundler targets a browser environment. If it isn't picked up automatically, you can import it directly:
-
-```js
-import { ApifyClient } from 'apify-client/browser';
-```
-
-For Cloudflare Workers or other edge runtimes that don't provide Node built-ins, you may need to enable Node compatibility in your runtime config (e.g. `node_compat = true`.
-
-Note that some Node-specific features (streaming APIs, proxy) are not available in the browser bundle.
-
-### Pagination
-
-Methods that return lists (such as `list()` or `listSomething()`) return a [`PaginatedList`](/reference/interface/PaginatedList) object. Exceptions include `listKeys()` and `listHead()`, which use different pagination mechanisms.
-
-The list results are stored in the `items` property. Use the `limit` parameter to retrieve a specific number of results. Additional properties vary by method—see the method reference for details.
-
-```js
-import { ApifyClient } from 'apify-client';
-
-const client = new ApifyClient({ token: 'MY-APIFY-TOKEN' });
-
-// Resource clients accept an ID of the resource.
-const datasetClient = client.dataset('dataset-id');
-
-// Maximum amount of items to fetch in total
-const limit = 1000;
-// Maximum amount of items to fetch in one API call
-const chunkSize = 100;
-// Initial offset
-const offset = 0;
-
-for await (const item of datasetClient.listItems({ limit, offset, chunkSize })) {
- // Processs individual item
- console.log(item);
-}
-```
diff --git a/website/versioned_sidebars/version-2-sidebars.json b/website/versioned_sidebars/version-2-sidebars.json
index a72166a28..83d1931c4 100644
--- a/website/versioned_sidebars/version-2-sidebars.json
+++ b/website/versioned_sidebars/version-2-sidebars.json
@@ -1,9 +1,38 @@
-[
- [
+{
+ "sidebar": [
+ {
+ "type": "doc",
+ "id": "introduction/introduction"
+ },
+ {
+ "type": "doc",
+ "id": "introduction/quick-start"
+ },
{
"type": "category",
- "label": "API Client",
- "items": ["index", "getting-started", "examples/index"]
+ "label": "Concepts",
+ "collapsed": true,
+ "items": [
+ {
+ "type": "autogenerated",
+ "dirName": "02_concepts"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Guides",
+ "collapsed": true,
+ "items": [
+ {
+ "type": "autogenerated",
+ "dirName": "03_guides"
+ }
+ ]
+ },
+ {
+ "type": "doc",
+ "id": "changelog"
}
]
-]
+}