# Baker authentication

## Discover

Baker offers a public Events API and authorized company marketing workflows through MCP, A2A and a background task API. Read the [Events API description](https://withbaker.com/docs/openapi.json) and [task API guide](https://withbaker.com/tasks.md). Events sending keys and OAuth grants are different credentials with different permissions. The OAuth resource metadata is at https://mcp.withbaker.com/.well-known/oauth-protected-resource/mcp; follow its authorization_servers entry for discovery. MCP, A2A and tasks share this resource and consent.

## Pick a method

For sending conversions from your server, use an Events only sending key. For working with Baker from an assistant, connect to https://mcp.withbaker.com/mcp and sign in with your Baker account. Never ask a person to paste a password or secret into a conversation.

## Register

An existing customer creates a sending key in Settings → API keys. New companies start through [Book a call](https://withbaker.com/contact). To test event validation without an account, use the public key `bk_test_public`: it belongs to no company and stores nothing.

## Claim

For MCP, the person signs in and approves the connection in Baker. Baker does not currently offer the WorkOS agent_auth identity_endpoint, identity_assertion, service_auth or id-jag registration protocol. No anonymous agent may claim access to a company.

## Exchange

Let your MCP client's OAuth flow obtain its token. Sending keys are used directly; they are not exchanged for OAuth tokens.

Request `baker:read` for company reads, or `baker:prepare` to read and prepare changes for review, including work that uses Baker credits. Add `offline_access` if the client needs refresh tokens. The legacy `baker` scope grants both permissions. Company roles still apply: a preparation grant cannot give a viewer editing rights. The consent screen shows the requested permissions, and revoking the app stops subsequent tool calls, including calls from an already issued turn.

## Use the access_token

The MCP client sends its access token as a Bearer credential. For the Events API, send Authorization: Bearer YOUR_SENDING_KEY to POST https://api.withbaker.com/v1/events. Rehearse with X-Baker-Mode: test. See [Authentication](https://withbaker.com/docs/authentication.md) and [safe retries](https://withbaker.com/docs/deduplication.md).

## Errors

Treat a 401 as an authentication failure. Inspect WWW-Authenticate when present and reconnect through the client. A 403 is a permission refusal; do not retry with broader access automatically. Event API failures contain structured JSON; follow the [error reference](https://withbaker.com/docs/errors.md). Honor Retry-After on 429 responses.

## Revocation

Revoke a sending key in Baker's API key settings, or remove an assistant's connection in connected apps. Keep credentials out of public files, logs and prompts. Access remains limited by the connected person's role and company permissions.
