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

> ## Agent Instructions
> Agents: start with https://docs.pre.dev/agents.md, which has complete recipes, plan access, polling rules, errors and limits.
> Authenticate with the workspace API key (pdk_…) from Integrations → Built-in, sent as Authorization: Bearer <key>.
> REST API: https://api.pre.dev (OpenAPI: https://docs.pre.dev/api-reference/openapi.json). AI Gateway: https://api.pre.dev/v1, OpenAI-compatible (OpenAPI: https://docs.pre.dev/api-reference/ai-gateway.openapi.json).
> pre.dev MCP server: https://api.pre.dev/mcp. Search these docs over MCP at https://docs.pre.dev/mcp.

# API overview

> The public REST API for specifications, browser automation, AI model calls, and credit balances.

| Interface | Base URL |
| - | - |
| REST: specifications, browser tasks, and credits | `https://api.pre.dev` |
| AI Gateway | `https://api.pre.dev/v1` |
| MCP server | `https://api.pre.dev/mcp` |

REST paths are mounted at the root: use `/browser-agent`, not `/api/v1/browser-agents`. The AI Gateway is the one API under a prefix, `/v1`.

Copy your pre.dev API key from **Integrations → Built-in** in the dashboard: [pre.dev/projects/integrations](https://pre.dev/projects/integrations?tab=built-in) for your personal workspace, or the Integrations page of a team workspace. Workspace keys start with `pdk_`.

| Interface | Send the key as |
| - | - |
| REST and AI Gateway | `Authorization: Bearer <key>` (recommended) or `x-api-key: <key>` |
| MCP server | Browser sign-in (OAuth) in interactive clients, or `Authorization: Bearer <key>`, `x-api-key`, or `predev-api-key` |

Read [authentication](/api-reference/authentication) and [errors](/api-reference/errors) before building an integration.

## Specifications

| Method | Path | Reference |
| - | - | - |
| POST | `/fast-spec` | [Generate a Fast Spec](/architect-agent/api/fast-spec) |
| POST | `/deep-spec` | [Generate a Deep Spec](/architect-agent/api/deep-spec) |
| GET | `/spec-status/{specId}` | [Status and full artifacts](/architect-agent/api/spec-status) |
| GET | `/get-plan` | [A project's verified plan](/architect-agent/api/get-plan) |
| GET | `/list-specs` | [List specifications](/architect-agent/api/list-specs) |
| GET | `/find-specs` | [Search specifications](/architect-agent/api/find-specs) |
| GET | `/credits-balance` | [Credit balance](/architect-agent/api/credits-balance) |

## Browser Agents

| Method | Path | Reference |
| - | - | - |
| POST | `/browser-agent` | [Submit tasks](/browser-agents/api/run-task) |
| GET | `/browser-agent/{id}` | [Status and results](/browser-agents/api/task-status) |
| GET | `/browser-agent/{id}/stream` | [Watch an existing run with SSE](/browser-agents/api/stream-task) |
| GET | `/browser-agent/{id}/ws` | [Get a live browser WebSocket URL](/browser-agents/api/live-browser) |
| GET | `/list-browser-agents` | [List runs](/browser-agents/api/list-tasks) |
| GET | `/browser-agent-status` | [Your queue and in-flight limit](/browser-agents/api/queue-status) |
| GET | `/browser-agent-capacity` | [Service capacity](/browser-agents/api/capacity) |

## AI Gateway

The [AI Gateway](/ai-gateway/overview) is an OpenAI-compatible API for hundreds of models from every major lab, with the same key and credits. It covers chat completions, the Anthropic Messages shape, embeddings, images, video, audio, files, and a model catalog with credit prices. Point the stock OpenAI, Vercel AI, or Anthropic SDK at that base URL; see the [quickstart](/ai-gateway/quickstart) and [pricing](/coding-agent/plans-and-credits#ai-gateway-calls).

## Long-running jobs

Specifications, browser runs, and video generation run as jobs. All three follow one pattern: submit the job, save the ID it returns, poll or stream that ID, and read the result once the status is terminal.

<img className="block dark:hidden" src="https://mintcdn.com/predev/7eUhmIdZncrpx3fC/images/diagrams/async-jobs-light.svg?fit=max&auto=format&n=7eUhmIdZncrpx3fC&q=85&s=0757fee9f8466faff454904d8458ccb6" alt="The async job pattern in four steps for specs, browser runs, and video jobs: submit the job, save the ID it returns, poll or stream it, and stop at a terminal status to read the result." width="540" height="640" data-path="images/diagrams/async-jobs-light.svg" />

<img className="hidden dark:block" src="https://mintcdn.com/predev/7eUhmIdZncrpx3fC/images/diagrams/async-jobs-dark.svg?fit=max&auto=format&n=7eUhmIdZncrpx3fC&q=85&s=9c264d841f5b96c34bf98864eac9cf3f" alt="The async job pattern in four steps for specs, browser runs, and video jobs: submit the job, save the ID it returns, poll or stream it, and stop at a terminal status to read the result." width="540" height="640" data-path="images/diagrams/async-jobs-dark.svg" />

| Job | Submit | Save | Poll or stream | Terminal status |
| - | - | - | - | - |
| Specification | `POST /fast-spec` or `/deep-spec` with `async: true` | `specId` | `GET /spec-status/{specId}` | `completed` returns the Markdown, JSON, and available graphs; `failed` returns `errorMessage` |
| Browser run | `POST /browser-agent` with `async: true` | `id` | `GET /browser-agent/{id}`, or stream `GET /browser-agent/{id}/stream` | `completed` or `failed`; read each task's `status` before its data |
| Video | `POST /v1/videos` | `id` | `GET /v1/videos/{jobId}` | `completed`, then download `GET /v1/videos/{jobId}/content`; or `failed` |

## SDKs and MCP

The [Node SDK](/architect-agent/sdks/node) and [Python SDK](/architect-agent/sdks/python) wrap specification and browser operations. Use direct HTTP for endpoints or headers without a wrapper, including live browser URLs, existing-run SSE, and browser idempotency keys.

The [MCP server](/architect-agent/mcp-setup) exposes eight primary tools and three deprecated browser aliases. MCP uses JSON-RPC over HTTP; its parameter names and result envelopes differ from REST. See the [tool reference](/mcp/tools).

Two OpenAPI 3.1 files describe the public API, for code generation or agent ingestion: [openapi.json](/api-reference/openapi.json) covers specifications, browser tasks, and the credit balance, and [ai-gateway.openapi.json](/api-reference/ai-gateway.openapi.json) covers every AI Gateway `/v1` operation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.