---
hide_table_of_contents: true
sidebar_class_name: node-only
---

# Apify Dataset

This guide shows how to use [Apify](https://apify.com) with LangChain to load documents from an Apify Dataset.

## Overview

[Apify](https://apify.com) is a cloud platform for web scraping and data extraction,
which provides an [ecosystem](https://apify.com/store) of more than a thousand
ready-made apps called _Actors_ for various web scraping, crawling, and data extraction use cases.

This guide shows how to load documents
from an [Apify Dataset](https://docs.apify.com/platform/storage/dataset) — a scalable append-only
storage built for storing structured web scraping results,
such as a list of products or Google SERPs, and then export them to various
formats like JSON, CSV, or Excel.

Datasets are typically used to save results of Actors.
For example, [Website Content Crawler](https://apify.com/apify/website-content-crawler) Actor
deeply crawls websites such as documentation, knowledge bases, help centers, or blogs,
and then stores the text content of webpages into a dataset,
from which you can feed the documents into a vector index and answer questions from it.

## Setup

You'll first need to install the official Apify client:

```bash npm2yarn
npm install apify-client
```

You'll also need to sign up and retrieve your [Apify API token](https://console.apify.com/account/integrations).

## Usage

### From a New Dataset

If you don't already have an existing dataset on the Apify platform, you'll need to initialize the document loader by calling an Actor and waiting for the results.

**Note:** Calling an Actor can take a significant amount of time, on the order of hours, or even days for large sites!

Here's an example:

import CodeBlock from "@theme/CodeBlock";
import NewExample from "@examples/document_loaders/apify_dataset_new.ts";

<CodeBlock language="typescript">{NewExample}</CodeBlock>

## From an Existing Dataset

If you already have an existing dataset on the Apify platform, you can initialize the document loader with the constructor directly:

import ExistingExample from "@examples/document_loaders/apify_dataset_existing.ts";

<CodeBlock language="typescript">{ExistingExample}</CodeBlock>
