# Crawl a page

`POST /v1/crawls`

Fetch one page now and get its content with a receipt: where and when it was fetched, what robots.txt and the site's AI-use signals said, a content hash and the cost.

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 |

Billed at the level that delivered the page.

## Description

Runs inline and returns one task. The HTTP status follows the task: 200 completed (also for a fetched page that isn't real content, billed $0), 451 blocked by robots.txt, 502 when the site couldn't be fetched. A body with `targets` instead of `url` is treated as POST /v1/crawls/batch.

**Billing.** One page 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 page to fetch: an absolute http(s) URL on a public host. max 2000 |
| `auto_upgrade` | boolean | no | Lets a blocked page 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 page 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 |
| `output_format` | string | no | What `content` holds: Markdown text, the page HTML, or a JSON object of the page's title, text and metadata. default `markdown`; one of `markdown`, `html`, `json` |
| `engine` | string | no | The level to start at. `rendered` runs JavaScript from the first fetch and needs `max_level` rendered or protected. `browser` is accepted as an older name for `rendered`. default `standard`; one of `standard`, `rendered` |
| `render_js` | boolean | no | `true` is the same as `engine: rendered`. default `false` |
| `include_receipt` | boolean | no | Include the receipt on each task. default `true` |
| `project_id` | string\|null | no | A project in your organization to file this under. Leave it out for the default project. |

### Example request

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

## Response

| Field | Type | Description |
|---|---|---|
| `status` | string | Always `ok` for a 2xx response. |
| `cost` | number | Sum of the task costs, USD. |
| `tasks_count` | integer | Number of tasks. |
| `tasks_error` | integer | Tasks that failed or were blocked. |
| `tasks` | array<object> | The tasks. |
| `tasks.id` | string | Task id, `cr_…`. Use it with GET /v1/crawls/{id}. |
| `tasks.status` | string | Task state. one of `completed`, `failed`, `blocked`, `queued`, `processing` |
| `tasks.status_code` | integer | HTTP-style code for this task: 200 completed, 451 blocked by robots.txt, 422 invalid target or over `max_cost`, 502 upstream error, 503 level unavailable, 202 queued or processing. |
| `tasks.status_message` | string | Plain-language status. For a completed but non-substantive page, says why. |
| `tasks.cost` | number | What this task was charged, USD. |
| `tasks.fetch_level` | string\|null | The level that delivered the page. Null until a page was delivered. one of `standard`, `rendered`, `protected` |
| `tasks.upgraded` | boolean | True when Auto-upgrade moved past the requested level. |
| `tasks.upgrade_reason` | string | Why it upgraded, for example `403 at standard`. Empty when it didn't. |
| `tasks.content` | object | The page. Present when `status` is `completed`. |
| `tasks.content.title` | string | Page title. |
| `tasks.content.markdown` | string | Page as Markdown, for `output_format: markdown`. |
| `tasks.content.html` | string | Page HTML, for `output_format: html`. |
| `tasks.content.json` | object | Title, text and metadata, for `output_format: json`. |
| `tasks.error` | object | Present when `status` is `failed` or `blocked`. |
| `tasks.error.http_status` | integer | Same as `status_code`. |
| `tasks.error.code` | string | Error code, for example `blocked_by_policy` or `upstream_error`. |
| `tasks.receipt` | object | Provenance and cost. Present unless `include_receipt` is false. |
| `tasks.receipt.receipt_id` | string | Receipt id, `rc_…`. |
| `tasks.receipt.source_url` | string | The URL that was requested. |
| `tasks.receipt.fetched_at` | string\|null | When the page was fetched, ISO 8601 UTC. Null when it wasn't fetched. |
| `tasks.receipt.http_status` | integer\|null | HTTP status the site returned. |
| `tasks.receipt.content_sha256` | string\|null | SHA-256 of the content we returned, so you can prove what you saw. |
| `tasks.receipt.content_check` | string\|null | Whether the page is real content: `substantive`, or why not. one of `substantive`, `blocked`, `login_wall`, `error_page`, `empty_shell` |
| `tasks.receipt.content_check_reasons` | array<string> | Signals behind a non-substantive verdict. |
| `tasks.receipt.robots_txt` | string\|null | What the site's robots.txt says about this path for our crawler. one of `allowed`, `disallowed`, `not_found`, `unreachable` |
| `tasks.receipt.ai_use_signal` | string\|null | The site's declared stance on AI use, from robots.txt, meta tags, headers and its terms, for example `none_declared` or `opt_out`. |
| `tasks.receipt.ai_use_details` | object | Where each AI-use signal was found. |
| `tasks.receipt.engine` | string | The level you asked to start at. one of `standard`, `rendered` |
| `tasks.receipt.fetch_level` | string\|null | The level that delivered the page. Null until a page was delivered. one of `standard`, `rendered`, `protected` |
| `tasks.receipt.upgraded` | boolean | True when Auto-upgrade moved past the requested level. |
| `tasks.receipt.upgrade_reason` | string | Why it upgraded, for example `403 at standard`. Empty when it didn't. |
| `tasks.receipt.fetch_method` | string | Same as `fetch_level`, or `engine` when nothing was delivered. |
| `tasks.receipt.unit_cost_usd` | number\|null | What this page was charged, in USD. Null until the task has run. |
| `tasks.receipt.billed_usd` | number\|null | Same as `unit_cost_usd`. |
| `tasks.receipt.billed_pages` | integer\|null | 1 when the page was billed, 0 when it cost nothing. |
| `tasks.receipt.cost_breakdown` | object\|null | The charge split into the base page price and what an upgrade added. |
| `tasks.receipt.cost_breakdown.base` | number | Base page price, USD. |
| `tasks.receipt.cost_breakdown.upgrade` | number | Added by Auto-upgrade, USD. |
| `tasks.receipt.currency` | string | Always `USD`. |

### Example response

```json
{
  "status": "ok",
  "cost": 0.00011,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "cr_8cbb5b5c8e155c82995945f93cdad009",
      "status": "completed",
      "status_code": 200,
      "status_message": "Ok.",
      "cost": 0.00011,
      "fetch_level": "standard",
      "upgraded": false,
      "upgrade_reason": "",
      "content": {
        "title": "Trail running shoes",
        "markdown": "# Trail running shoes\n\nEvery trail shoe we stock comes with free gait analysis and 60-day returns."
      },
      "receipt": {
        "source_url": "https://summitrunning.example/trail-shoes",
        "fetched_at": "2026-12-03T10:42:18Z",
        "http_status": 200,
        "content_sha256": "9f2c4a1b7e0d3c58a6b1f4e2d7c9a0b3e5f8d1c4a7b0e3f6d9c2a5b8e1f4d7c0",
        "content_check": "substantive",
        "content_check_reasons": [],
        "robots_txt": "allowed",
        "ai_use_signal": "none_declared",
        "ai_use_details": {},
        "engine": "standard",
        "fetch_level": "standard",
        "upgraded": false,
        "upgrade_reason": "",
        "unit_cost_usd": 0.00011,
        "billed_usd": 0.00011,
        "currency": "USD",
        "receipt_id": "rc_8cbb5b5c8e155c82995945f93cdad009",
        "fetch_method": "standard",
        "billed_pages": 1,
        "cost_breakdown": {
          "base": 0.00011,
          "upgrade": 0
        }
      }
    }
  ]
}
```

## 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. |
| rate_limited | HTTP 429. Too many requests, or too many requests in flight for your organization. `Retry-After` says when to retry. |
| upstream_error | HTTP 502. The target or search timed out or returned an error we couldn't recover from. You weren't billed. |

## Related

- [Crawl a batch](https://dataforgaio.com/docs/api/crawls-batch.md): Queue up to 100 URLs in one request; poll the job or get it at your webhook.
- [Get a crawl](https://dataforgaio.com/docs/api/crawls-get.md): A batch job and its tasks, or one task, with content and receipts.
- [Get crawl receipts](https://dataforgaio.com/docs/api/crawls-receipt.md): Just the receipts for a job or task, one per page.
