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

# Quickstart

> Make your first Prefetch API call in under 5 minutes.

## Prerequisites

You need an API key. Get one from the [dashboard](https://dashboard.prefetch.io).

## Make your first request

The simplest call is `/classify` — it costs 5 credits and returns the IAB category for any URL.

<Steps>
  <Step title="Set your API key">
    Add the `X-API-Key` header to every request:

    ```bash theme={null}
    export PREFETCH_API_KEY="your_api_key_here"
    ```
  </Step>

  <Step title="Call the API">
    ```bash theme={null}
    curl "https://api.prefetch.io/classify?url=https://stripe.com" \
      -H "X-API-Key: $PREFETCH_API_KEY"
    ```

    You'll get back a JSON response:

    ```json theme={null}
    {
      "success": true,
      "data": {
        "url": "https://stripe.com",
        "iab_id": "IAB13-11",
        "iab_parent_id": "IAB13",
        "category": "Personal Finance",
        "subcategory": "Financial Planning",
        "description": "Stripe provides payment processing infrastructure for internet businesses, enabling companies to accept payments and manage their online commerce."
      },
      "meta": {
        "requestId": "a3f2c1d4-...",
        "durationMs": 1842
      }
    }
    ```
  </Step>

  <Step title="Try the enrich endpoint">
    For a richer response, use `/enrich` — it combines brand data, company info, and classification in one call (20 credits):

    ```bash theme={null}
    curl "https://api.prefetch.io/enrich?url=https://stripe.com" \
      -H "X-API-Key: $PREFETCH_API_KEY"
    ```
  </Step>
</Steps>

## SDK examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.prefetch.io/classify?url=https://stripe.com",
    {
      headers: {
        "X-API-Key": process.env.PREFETCH_API_KEY,
      },
    }
  );

  const { success, data, error } = await response.json();

  if (!success) {
    throw new Error(error);
  }

  console.log(data.category); // "Personal Finance"
  ```

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

  response = requests.get(
      "https://api.prefetch.io/classify",
      params={"url": "https://stripe.com"},
      headers={"X-API-Key": os.environ["PREFETCH_API_KEY"]},
  )

  body = response.json()

  if not body["success"]:
      raise Exception(body["error"])

  print(body["data"]["category"])  # "Personal Finance"
  ```

  ```typescript TypeScript theme={null}
  const apiKey = process.env.PREFETCH_API_KEY!;

  const res = await fetch(
    `https://api.prefetch.io/classify?url=${encodeURIComponent("https://stripe.com")}`,
    { headers: { "X-API-Key": apiKey } }
  );

  const json = await res.json() as {
    success: boolean;
    data?: { category: string; subcategory: string; description: string };
    error?: string;
  };

  if (!json.success) throw new Error(json.error);
  console.log(json.data!.category);
  ```
</CodeGroup>

## Error handling

Every response uses the same envelope:

```json theme={null}
{
  "success": false,
  "error": "Credit limit exceeded",
  "meta": {
    "requestId": "b9e1a2f3-...",
    "durationMs": 12
  }
}
```

Check `success` before reading `data`. See [Error handling](/concepts/errors) for all error codes.

## Next steps

<CardGroup cols={2}>
  <Card title="Brand extraction" icon="palette" href="/api-reference/endpoint/brand">
    Extract colors, logos, and fonts.
  </Card>

  <Card title="Company data" icon="building" href="/api-reference/endpoint/company">
    Get legal name, emails, and addresses.
  </Card>

  <Card title="Screenshots" icon="camera" href="/api-reference/endpoint/screenshot">
    Capture full-page or viewport screenshots.
  </Card>

  <Card title="Credits & billing" icon="coins" href="/concepts/credits">
    Understand how credits work.
  </Card>
</CardGroup>
