# Map a site

`POST /v1/map`

The URLs a site lists in its sitemaps and on its start page, each marked with whether robots.txt lets our crawler fetch it, so you can choose what to crawl.

Family: Crawl API

## Price

Unit: page

| Mode | Price (USD) |
|---|---|
| Live | $0.00011 |

| Fetch level | Price (USD) |
|---|---|
| standard | $0.00011 |
| rendered | $0.0011 |
| protected | $0.003 |

Per billed fetch (robots.txt, each sitemap file, the start page).

## Description

Reads robots.txt, up to 10 sitemap files and the links on the page at `url`. It never follows links further. Each fetch that returned real content (a served robots.txt, a sitemap that parsed, a substantive start page) is billed at its level's page price; failed and blocked fetches cost $0. When robots.txt can't be read at all, nothing else is fetched and you get 502 at $0.

**Billing.** Each billed fetch at the price of the fetch level that delivered it (Standard $0.00011, Rendered $0.0011, Protected $0.003). Blocked, failed and non-substantive pages cost $0.

## Authentication

HTTP Basic auth: any login, with your `dg_` API key as the password. A `Bearer` token header with the key also works.

## Request

Send a JSON object.

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | The site's start page: an absolute http(s) URL on a public host. max 2000 |
| `limit` | integer | no | Most URLs to return. default `1000`; min 1; max 5000 |
| `include_subdomains` | boolean | no | Include URLs on subdomains of the start page's host. default `false` |
| `search` | string | no | Only URLs containing this text (case-insensitive). max 200 |
| `use_sitemap` | boolean | no | Read the site's sitemaps. `false` reads only the start page's links. default `true` |
| `auto_upgrade` | boolean | no | Lets a blocked fetch move to a higher fetch level, billed at the level that delivered it. `false` stops at the requested level and returns the failure at $0. default `true` |
| `max_level` | string | no | The highest fetch level Auto-upgrade may use. default `protected`; one of `standard`, `rendered`, `protected` |
| `max_cost` | number\|null | no | The most one fetch may cost, in USD, up to 6 decimal places. The wallet check reserves this instead of the worst-case price, and a fetch never upgrades past it. min 0 |

### Example request

```bash
curl -X POST "https://api.dataforgaio.com/v1/map" \
  -u "api:$DATAFORGAIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://summitrunning.example/",
  "limit": 500
}'
```

## Response

| Field | Type | Description |
|---|---|---|
| `status` | string | Always `ok`. |
| `url` | string | The start page, normalized. |
| `urls_count` | integer | Entries in `urls`. |
| `limit_reached` | boolean | True when the list stopped at `limit`. |
| `urls` | array<object> | The URLs found. |
| `urls.url` | string | The URL. |
| `urls.source` | string | Where it was found. one of `sitemap`, `link` |
| `urls.lastmod` | string | Last-modified date from the sitemap, when it gave a valid one. |
| `urls.crawler_allowed` | boolean\|null | Whether robots.txt allows our crawler to fetch it. Null for URLs on another host. |
| `sitemaps` | array<string> | Sitemap files that were read. |
| `robots_txt` | object | What the site's robots.txt says. |
| `robots_txt.found` | boolean | True when robots.txt was served. |
| `robots_txt.status` | integer\|null | HTTP status of robots.txt. |
| `robots_txt.robots_url` | string | The robots.txt URL. |
| `robots_txt.crawler_agent` | string | The user agent we crawl as. |
| `robots_txt.crawler_allowed` | boolean | Whether our crawler may fetch the start page. |
| `robots_txt.ai_agents` | array<object> | Whether each well-known AI crawler may fetch the start page. |
| `robots_txt.ai_agents.agent` | string | User agent token. |
| `robots_txt.ai_agents.allowed` | boolean | True when allowed. |
| `robots_txt.sitemaps` | array<string> | Sitemaps listed in robots.txt. |
| `robots_txt.disallowed_urls` | integer | URLs in `urls` our crawler isn't allowed to fetch. |
| `pages_fetched` | integer | Fetches made. |
| `pages_billed` | integer | Fetches that returned real content and were billed. |
| `unit_cost_usd` | number | Standard page price, USD. |
| `billed_usd` | number | Total charged, USD. |
| `fetch_level` | string\|null | The level that delivered the page. Null until a page was delivered. one of `standard`, `rendered`, `protected` |
| `upgraded` | boolean | True when Auto-upgrade moved past the requested level. |
| `upgrade_reason` | string | Why any fetch upgraded. Empty when none did. |
| `stopped_early` | boolean | True when the time limit stopped new fetches. |

### Example response

```json
{
  "status": "ok",
  "url": "https://summitrunning.example/",
  "urls_count": 4,
  "limit_reached": false,
  "urls": [
    {
      "url": "https://summitrunning.example/",
      "source": "sitemap",
      "lastmod": "2026-11-28",
      "crawler_allowed": true
    },
    {
      "url": "https://summitrunning.example/trail-shoes",
      "source": "sitemap",
      "lastmod": "2026-12-03T10:42:18+00:00",
      "crawler_allowed": true
    },
    {
      "url": "https://summitrunning.example/cart/checkout",
      "source": "sitemap",
      "crawler_allowed": false
    },
    {
      "url": "https://summitrunning.example/stores",
      "source": "link",
      "crawler_allowed": true
    }
  ],
  "sitemaps": [
    "https://summitrunning.example/sitemap.xml"
  ],
  "robots_txt": {
    "found": true,
    "status": 200,
    "robots_url": "https://summitrunning.example/robots.txt",
    "crawler_agent": "DataForGAIO",
    "crawler_allowed": true,
    "ai_agents": [
      {
        "agent": "GPTBot",
        "allowed": true
      },
      {
        "agent": "ClaudeBot",
        "allowed": true
      },
      {
        "agent": "Google-Extended",
        "allowed": true
      },
      {
        "agent": "CCBot",
        "allowed": true
      },
      {
        "agent": "PerplexityBot",
        "allowed": true
      },
      {
        "agent": "Applebot-Extended",
        "allowed": true
      },
      {
        "agent": "anthropic-ai",
        "allowed": true
      },
      {
        "agent": "Claude-Web",
        "allowed": true
      },
      {
        "agent": "OAI-SearchBot",
        "allowed": true
      },
      {
        "agent": "ChatGPT-User",
        "allowed": true
      },
      {
        "agent": "Bytespider",
        "allowed": true
      },
      {
        "agent": "Meta-ExternalAgent",
        "allowed": true
      },
      {
        "agent": "Amazonbot",
        "allowed": true
      },
      {
        "agent": "cohere-ai",
        "allowed": true
      }
    ],
    "sitemaps": [
      "https://summitrunning.example/sitemap.xml"
    ],
    "disallowed_urls": 1
  },
  "pages_fetched": 3,
  "pages_billed": 3,
  "unit_cost_usd": 0.00011,
  "billed_usd": 0.00033,
  "fetch_level": "standard",
  "upgraded": false,
  "upgrade_reason": "",
  "stopped_early": false
}
```

## Errors

| Code | When |
|---|---|
| invalid_request | HTTP 400. The body failed validation. `error.details` maps each field to its problem. |
| unauthorized | HTTP 401. Missing, malformed or revoked API key. |
| balance_required | HTTP 402. Your wallet balance is below the most this request could cost. Nothing ran. |
| invalid_target | HTTP 422. A URL is not an absolute public http(s) URL. Nothing was fetched. |
| max_cost_exceeded | HTTP 422. `max_cost` is below the price of the cheapest allowed fetch. Nothing was fetched. |
| rate_limited | HTTP 429. Too many requests, or too many inline requests in flight for your organization. Honor `Retry-After`. |
| upstream_error | HTTP 502. robots.txt couldn't be read, so nothing else was fetched. $0. |
