> ## 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.

# Authentication

> One pre.dev API key for REST, the AI Gateway, the SDKs, and MCP: where to find it, how to send it, and which accounts each interface accepts.

Every pre.dev interface uses the same workspace key: specifications and browser tasks over REST, the AI Gateway, the SDKs, the MCP server, and plain-words actions in [Browser Agents Local](/browser-agents/local).

| 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` |

## Get your key

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_`.

Each workspace, your personal account or a team, has one key. The Built-in tab shows it in full with its last-used time. Keep it in your application's secret configuration and call pre.dev from a server, a script, or local development. Never ship the key in browser or mobile code.

Apps you build on pre.dev already have the key in their environment as `PREDEV_API_KEY`; see [built into every app](/coding-agent/built-in).

Keys issued before workspace keys existed keep working. Use the `pdk_` key for new integrations.

## Send the key

| 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` |

```bash theme={null}
curl --fail-with-body https://api.pre.dev/browser-agent-status \
  -H "Authorization: Bearer $PREDEV_API_KEY"
```

The OpenAI SDKs send `Authorization: Bearer` and the Anthropic SDK sends `x-api-key`. The AI Gateway accepts both, so those SDKs need only a base URL and the key.

## Rotate the key

Choose **Rotate** on the key's card. The old key keeps working for 15 minutes, so running apps can switch without a gap. Update your secret store, then confirm a request with the new key succeeds before the window closes.

## Which accounts each interface accepts

Authentication and feature access are separate checks.

| Interface | Accepts |
| - | - |
| Browser Agents REST | Every account, including Free. Task submission then applies its own trial, credit, and queue checks. |
| AI Gateway | Every account, including Free. Free workspaces have a small lifetime allowance for gateway calls. |
| Architect REST and the MCP server | Personal accounts on a paid plan, and team workspaces |

A Free account can call Browser Agents and the AI Gateway, while an Architect REST or MCP call returns `401`. Which plans can generate specifications is covered in [plans, credits, and pricing](/coding-agent/plans-and-credits#api-and-mcp-access). Read the response message for the required action.

## Account and team context

A personal key acts in your personal account. A team key selects the team's context for specifications and credit usage. Browser history is scoped to the authenticated caller. Submit and retrieve work with the same key.

## SDK setup

<CodeGroup>
  ```typescript Node.js theme={null}
  import { PredevAPI } from 'predev-api';

  const client = new PredevAPI({ apiKey: process.env.PREDEV_API_KEY! });
  ```

  ```python Python theme={null}
  import os
  from predev_api import PredevAPI

  client = PredevAPI(api_key=os.environ["PREDEV_API_KEY"])
  ```
</CodeGroup>

## MCP sign-in

The pre.dev MCP server is **`https://api.pre.dev/mcp`**, over Streamable HTTP. It runs pre.dev's specification and browser tools. Searching this documentation is a separate MCP server, `https://docs.pre.dev/mcp`, which needs no key.

Add it to your client's remote HTTP servers, then use the client's authentication flow. The browser asks you to sign in and choose the personal account or team to connect. [MCP setup](/architect-agent/mcp-setup) covers client configuration and troubleshooting.


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