Skip to content

docs: Refactor documentation structure and add new guides#824

Open
patrikbraborec wants to merge 3 commits intomasterfrom
apify-docs-agent-refactor
Open

docs: Refactor documentation structure and add new guides#824
patrikbraborec wants to merge 3 commits intomasterfrom
apify-docs-agent-refactor

Conversation

@patrikbraborec
Copy link
Contributor

Summary

  • Reorganized documentation into a clearer three-tier structure (introduction, concepts, guides)
  • Added comprehensive new documentation for authentication, client architecture, error handling, and dataset retrieval
  • Updated sidebar navigation to reflect the new structure

Test plan

  • Review the new documentation structure
  • Verify all internal links work correctly
  • Check that the sidebar navigation is logical and easy to follow
  • Ensure code examples are accurate and complete

🤖 Generated with Claude Code

patrikbraborec and others added 3 commits November 27, 2025 13:09
Reorganized documentation into a clearer three-tier structure:
- 01_introduction: Overview, installation, and quick start
- 02_concepts: Core concepts like authentication, client architecture, error handling, retries, pagination, and nested clients
- 03_guides: Practical guides for common use cases

Added comprehensive new documentation:
- Authentication guide with API token management
- Client architecture explanation
- Error handling and retry strategies
- Dataset retrieval guide

Updated sidebar navigation to reflect the new structure.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@patrikbraborec patrikbraborec requested a review from TC-MO as a code owner January 16, 2026 11:02
@B4nan B4nan requested a review from janbuchar January 20, 2026 15:13
Copy link
Contributor

@janbuchar janbuchar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the direction this is going!


## 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this use copy from the original guide or is it generated anew? I think it could use some proofreading - I'd expect a "the" before "Integrations tab", and I've seen several other grammar issues in this doc.


:::note Resource identification

The resource ID can be either the `id` of the said resource, or a combination of your `username/resource-name`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this only applies to Actors?

const myActor = await actorClient.get();
// Starts the run of john-doe/my-actor and returns the Run object.
const myActorRun = await actorClient.start();
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe link to client architecture concepts page from here for a more detailed description?

description: 'Get started with the Apify client for JavaScript by running your first Actor and retrieving results.'
---

Learn how to start Actors and retrieve their results using the Apify Client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide should make it clear that the client essentially allows doing everything you can do in the console, and running Actors and fetching the results is just the tip of the iceberg.


## Step 2: Running your first Actor

To start an Actor, you need its ID (e.g., `john-doe/my-cool-actor`) and an API token. The Actor's ID is a combination of the Actor name and the Actor owner's username. Use the [`ActorClient`](/reference/class/ActorClient) to run the Actor and wait for it to complete. You can run both your own Actors and [Actors from Apify Store](https://docs.apify.com/platform/actors/running/actors-in-store).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth mentioning that the API tab in the store gives you a code snippet for running that specific Actor - https://apify.com/apify/website-content-crawler/api/javascript

Comment on lines +174 to +177
if (result.retryable) {
// Implement retry logic
console.log('This error is retryable. Consider retrying...');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just drop this - at this point, the client already retried the request extensively.

}
```

## Retry Logic with Exponential Backoff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is unnecessary, the client does this out of the box.

Comment on lines +241 to +302
## Validation Errors

The API returns validation errors when input doesn't meet requirements:

```js
try {
await client.actors().create({
// Missing required 'name' field
});
} catch (error) {
if (error.statusCode === 400) {
console.error('Validation error:', error.message);
// Handle validation failure
}
}
```

## Graceful Degradation

Implement graceful degradation for non-critical operations:

```js
async function getActorWithFallback(actorId) {
try {
return await client.actor(actorId).get();
} catch (error) {
console.warn(`Failed to fetch actor: ${error.message}`);

// Return fallback data
return {
id: actorId,
name: 'Unknown Actor',
unavailable: true
};
}
}
```

## Debugging Tips

Enable detailed logging to debug errors:

```js
const client = new ApifyClient({
token: 'MY-APIFY-TOKEN',
// Add custom request interceptor for debugging
});

try {
await client.actor('my-actor').start();
} catch (error) {
// Log full error details
console.error('Full error:', JSON.stringify({
message: error.message,
statusCode: error.statusCode,
type: error.type,
clientMethod: error.clientMethod,
path: error.path,
stack: error.stack
}, null, 2));
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also just filler - the docs don't exist to lecture people on the general principles of working with HTTP APIs in Javascript

title: 'Pagination'
---

Most methods named `list` or `listSomething` return a [`Promise<PaginatedList>`](/reference/interface/PaginatedList).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return values also typically return an AsyncIterator so you can just use a for await (...) loop without worrying about pagination.

---

The fastest way to get results from an Actor is to pass input directly to the `call` function.
Input can be passed to `call` function and the reference of running Actor (or wait for finish) is available in `runData` variable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, would be great to mention the API tab in the Store - the snippets include a prefilled input object, which is nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants