API
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 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 and errors before building an integration.
Specifications
| Method | Path | Reference |
|---|---|---|
| POST | /fast-spec | Generate a Fast Spec |
| POST | /deep-spec | Generate a Deep Spec |
| GET | /spec-status/{specId} | Status and full artifacts |
| GET | /get-plan | A project’s verified plan |
| GET | /list-specs | List specifications |
| GET | /find-specs | Search specifications |
| GET | /credits-balance | Credit balance |
Browser Agents
| Method | Path | Reference |
|---|---|---|
| POST | /browser-agent | Submit tasks |
| GET | /browser-agent/{id} | Status and results |
| GET | /browser-agent/{id}/stream | Watch an existing run with SSE |
| GET | /browser-agent/{id}/ws | Get a live browser WebSocket URL |
| GET | /list-browser-agents | List runs |
| GET | /browser-agent-status | Your queue and in-flight limit |
| GET | /browser-agent-capacity | Service capacity |
AI Gateway
The AI Gateway 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 and pricing.
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.
| 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 and Python SDK 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 exposes twelve primary tools, including the memory 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.
Two OpenAPI 3.1 files describe the public API, for code generation or agent ingestion: openapi.json covers specifications, browser tasks, and the credit balance, and ai-gateway.openapi.json covers every AI Gateway /v1 operation.