> ## Documentation Index
> Fetch the complete documentation index at: https://predev.mintlify.site/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: npx -y @predotdev/mcp setup adds it to every local coding agent with every pre.dev tool plus the user's own Chrome; the hosted server is 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` |
| Hosted 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](https://predev.mintlify.site/api-reference/authentication.md) and [errors](https://predev.mintlify.site/api-reference/errors.md) before building an integration.

## Specifications

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

## Browser Agents

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

## AI Gateway

The [AI Gateway](https://predev.mintlify.site/ai-gateway/overview.md) 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](https://predev.mintlify.site/ai-gateway/quickstart.md) and [pricing](https://predev.mintlify.site/coding-agent/plans-and-credits.md#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.

![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.](https://mintcdn.com/predev/7eUhmIdZncrpx3fC/images/diagrams/async-jobs-light.svg?fit=max\&auto=format\&n=7eUhmIdZncrpx3fC\&q=85\&s=0757fee9f8466faff454904d8458ccb6)

| 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](https://predev.mintlify.site/architect-agent/sdks/node.md) and [Python SDK](https://predev.mintlify.site/architect-agent/sdks/python.md) 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](https://predev.mintlify.site/architect-agent/mcp-setup.md) 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](https://predev.mintlify.site/mcp/tools.md).

Two OpenAPI 3.1 files describe the public API, for code generation or agent ingestion: [openapi.json](https://predev.mintlify.site/api-reference/openapi.json) covers specifications, browser tasks, and the credit balance, and [ai-gateway.openapi.json](https://predev.mintlify.site/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.