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

# Fetch API quickstart

> Set up the Bright Data Fetch API and fetch your first web page as Markdown, plain text, HTML and JSON-LD in under 5 minutes with cURL, Python or Node.js.

This tutorial shows you how to fetch a web page and get it back as Markdown, plain text and HTML using the Bright Data Fetch API.

## Prerequisites

* A [Bright Data account](https://brightdata.com/?hs_signup=1\&utm_source=docs)
* cURL, Python 3.9+, or Node.js 18+ installed

<Steps>
  <Step title="Get your API key">
    Go to the [user settings page](https://brightdata.com/cp/setting/users) in your Bright Data account and create an API key, or use one you already have.

    If you don't have an account yet, [sign up at brightdata.com](https://brightdata.com/?hs_signup=1\&utm_source=docs). New accounts get 5,000 free credits every month, no credit card required. See the [free tier](/general/account/billing-and-pricing/free-tier).

    <Warning>
      Your API key is shown only once when created. Copy and store it securely.
    </Warning>
  </Step>

  <Step title="Send a request">
    We'll fetch `https://example.com` with the **Collect by URL** endpoint, using a synchronous request. Replace `YOUR_API_KEY` with your API key:

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST \
        "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m6gjtfmeh43we6cqc&format=json" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '[{"url": "https://example.com"}]'
      ```

      ```python Python theme={null}
      import requests

      response = requests.post(
          "https://api.brightdata.com/datasets/v3/scrape",
          params={"dataset_id": "gd_m6gjtfmeh43we6cqc", "format": "json"},
          headers={
              "Authorization": "Bearer YOUR_API_KEY",
              "Content-Type": "application/json",
          },
          json=[{"url": "https://example.com"}],
      )

      data = response.json()
      if response.status_code == 202:
          print(f"Job running. Snapshot ID: {data['snapshot_id']}")
      else:
          print(data)
      ```

      ```javascript Node.js theme={null}
      const response = await fetch(
        "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m6gjtfmeh43we6cqc&format=json",
        {
          method: "POST",
          headers: {
            "Authorization": "Bearer YOUR_API_KEY",
            "Content-Type": "application/json",
          },
          body: JSON.stringify([
            { url: "https://example.com" }
          ]),
        }
      );

      const data = await response.json();
      if (response.status === 202) {
        console.log(`Job running. Snapshot ID: ${data.snapshot_id}`);
      } else {
        console.log(data);
      }
      ```
    </CodeGroup>

    You should see a `200` status code and a JSON array with one record. A `202` means the fetch needs longer than 1 minute; see the note below. Processing time varies with target-site conditions.

    <Note>
      A synchronous request waits up to 1 minute. If the Bright Data Fetch API needs longer, the response is HTTP `202` with a `snapshot_id` instead of page data, and collection continues asynchronously. Fetch the result with the [async workflow](/products/scrapers/scrapers-library/async-requests) or have it pushed to you with [webhook delivery](/products/scrapers/scrapers-library/data-delivery).
    </Note>
  </Step>

  <Step title="Review the response">
    The Bright Data Fetch API returns a JSON array with one record per URL:

    ```json theme={null}
    [
      {
        "markdown": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for testing and monitoring purposes.",
        "url": "https://example.com/",
        "final_url": "https://example.com/",
        "html2text": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for\ntesting and monitoring purposes.",
        "page_html": "<!doctype html><html lang=en><head><meta charset=utf-8>...<title>Example Domain</title>...</head><body><p>This domain is for use in documentation examples without needing permission. ...</p></body></html>\n",
        "page_title": "Example Domain",
        "country": null,
        "timestamp": "2026-10-19T18:10:21.213Z",
        "input": {
          "url": "https://example.com"
        }
      }
    ]
    ```

    The `page_html` value is trimmed here. Use `markdown` for an LLM prompt, `html2text` for plain text and `page_html` when you need the full source. See the [full response schema](/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url).
  </Step>
</Steps>

You've fetched your first web page using the Bright Data Fetch API.

## Common questions

### Can I fetch multiple URLs in one request?

Yes. Add more objects to the input array. The URLs can be on different domains. Bright Data recommends 20 URLs or fewer per synchronous request, a best practice rather than a hard limit. For larger batches, use the [async `/trigger` endpoint](/products/scrapers/scrapers-library/async-requests).

```json theme={null}
[
  {"url": "https://example.com"},
  {"url": "https://en.wikipedia.org/wiki/Web_scraping"},
  {"url": "https://www.python.org"}
]
```

### Getting a 401 or 403 error?

Verify your API key is correct and hasn't expired. Create a new API key in [Account settings](https://brightdata.com/cp/setting/users). See the [authentication guide](/api-reference/authentication) for details.

### Request is timing out?

Synchronous requests have a 1-minute timeout. If the request exceeds this limit, the API returns HTTP `202` with a `snapshot_id` and finishes the job asynchronously. Use the [async workflow](/products/scrapers/scrapers-library/async-requests) for large batches.

### Why is a field missing from the record?

A field with no value can be left out. For example, `ld_json` is missing when the page has no JSON-LD metadata. Check that the URL is public and returns a page in a browser.

## Next steps

<CardGroup cols={3}>
  <Card title="Endpoints" icon="bolt" href="/products/scrapers/fetch-api/send-first-request">
    Country targeting, field selection and batch requests.
  </Card>

  <Card title="Async batch requests" icon="layer-group" href="/products/scrapers/scrapers-library/async-requests">
    Fetch hundreds of URLs in a single batch job.
  </Card>

  <Card title="Set up webhooks" icon="webhook" href="/products/scrapers/scrapers-library/data-delivery">
    Receive results automatically when fetching completes.
  </Card>
</CardGroup>
