# Voxplo -- Authentication

## API auth

The Voxplo Agent API uses Bearer token authentication.

Include the following header on every API request:

```
Authorization: Bearer bys_ak_YOUR_KEY
```

API keys start with the prefix `bys_ak_`.

### Getting an API key

1. Sign in at https://www.voxplo.ai/account
2. Go to Account > Developers.
3. Create a new API key and copy it. Store it securely; it is shown only once.

### Key scopes

Each key is scoped to your account and allows placing calls, retrieving call records, and listing calls. Keys inherit the outbound-minutes quota of your plan.

### Security

- Never expose your API key in client-side code or version control.
- Rotate a compromised key immediately from the dashboard.
- All API traffic must use HTTPS.

### Error codes related to auth

- `401 Unauthorized`: missing or invalid Bearer token.
- `403 Forbidden`: the key is valid but the requested resource belongs to a different account.

## MCP auth (agentic registration)

The hosted MCP server supports agentic registration, advertised via the agent_auth block in our authorization-server metadata. It uses OAuth 2.0 (dynamic client registration plus authorization code with PKCE) to connect your MCP client to your Voxplo account.

### Discover
1. GET https://mcp.voxplo.ai/.well-known/oauth-protected-resource/mcp (RFC 9728 oauth-protected-resource metadata).
2. Follow authorization_servers[0] to GET https://mcp.voxplo.ai/.well-known/oauth-authorization-server (RFC 8414), and read its agent_auth block: skill, register_uri, identity_types_supported.

### Pick a method
We advertise identity_types_supported: ["anonymous"]. Register a client, then complete the authorization-code flow. We do not require an identity_assertion such as an urn:ietf:params:oauth:token-type:id-jag (ID-JAG) or a verified_email; a human binds the connection by pasting an Agent API key at the consent step.

### Register (register_uri)
POST https://mcp.voxplo.ai/register (RFC 7591 dynamic client registration). PKCE (S256) is required.

### Use the credential and errors
Complete the authorization-code flow at https://mcp.voxplo.ai/authorize, exchange the code at https://mcp.voxplo.ai/token, then send Authorization: Bearer <access_token> on POST https://mcp.voxplo.ai/mcp. Unauthenticated requests return 401 with a WWW-Authenticate: Bearer header pointing back to the oauth-protected-resource metadata. Revoke a token at https://mcp.voxplo.ai/revoke.

### Connecting a client

MCP server URL:
```
https://mcp.voxplo.ai/mcp
```

OAuth authorization server:
```
https://mcp.voxplo.ai/
```

### Connect from Claude

1. Open Claude Settings > Connectors > Add custom connector.
2. Enter the MCP URL: `https://mcp.voxplo.ai/mcp`
3. Leave OAuth fields blank.
4. When prompted, authorize with your `bys_ak_` API key.

### Connect from Cursor or other MCP clients

Add to your MCP client config:
```json
{
  "mcpServers": {
    "voxplo": {
      "url": "https://mcp.voxplo.ai/mcp"
    }
  }
}
```

Then authorize via the OAuth consent flow that opens in your browser.

### Local stdio mode

To run the MCP server locally (Node 18+):
```bash
VOXPLO_API_KEY=bys_ak_YOUR_KEY npx voxplo-mcp
```

In local stdio mode the key is passed directly via the env var and no OAuth browser flow is needed.

## Webhook signatures

Webhooks are signed with an HMAC-SHA256 signature delivered in the `X-BYS-Signature` header.

Verify the signature against your webhook secret to authenticate inbound webhook deliveries.

Full reference: https://www.voxplo.ai/docs/agent-api/webhooks

## Key links

- Agent API overview: https://www.voxplo.ai/docs/agent-api
- API reference: https://www.voxplo.ai/docs/agent-api/api-reference
- MCP server docs: https://www.voxplo.ai/docs/agent-api/mcp
- Dashboard: https://www.voxplo.ai/account
