# Authenticate an agent with Pitchlane

Pitchlane creates personalised video outreach campaigns. Agents act on behalf
of the account or organisation whose credentials they use.

## Connect

- Setup and client instructions: https://app.pitchlane.com/mcp
- Create a Pitchlane account: https://app.pitchlane.com/sign-up
- MCP endpoint: https://mcp.pitchlane.com/mcp
- Transport: Streamable HTTP (POST), not legacy SSE.
- API reference: https://docs.pitchlane.com
- Campaign skills: https://github.com/pitchlane-video/leadgen-skills

## Discover authentication

Fetch the protected-resource metadata:

https://mcp.pitchlane.com/.well-known/oauth-protected-resource/mcp

The protected resource identifier is `https://mcp.pitchlane.com/mcp`.
`https://pitchlane.com` is the public website, not the protected resource.

Fetch the authorization-server metadata:

https://mcp.pitchlane.com/.well-known/oauth-authorization-server

The issuer is `https://mcp.pitchlane.com`. Discover endpoints from this metadata.
An unauthenticated MCP request returns 401 with a `WWW-Authenticate` header
pointing to the protected-resource metadata.

## OAuth: interactive clients

1. Add the MCP endpoint to your client's remote MCP configuration.
2. Use OAuth authorization code flow with PKCE `S256`. Use the MCP resource
   identifier. For renewable access, the client's registration or Client ID
   Metadata Document must allow both `authorization_code` and `refresh_token`
   in `grant_types`; then request `public_api offline_access`. Clients registered
   for `authorization_code` only must request only `public_api`. Asking for
   `offline_access` without the `refresh_token` grant fails with `invalid_scope`
   before sign-in.
3. Clients supporting Client ID Metadata Documents can use their HTTPS client
   metadata URL as `client_id`. Clients requiring Dynamic Client Registration
   can use the advertised `registration_endpoint` (RFC 7591). Client registration
   registers the OAuth application; it does not create a Pitchlane customer account.
4. Give the user the authorization flow to sign in and approve access.
   Continue only after the OAuth flow completes.
5. Send the access token as `Authorization: Bearer <access_token>` on MCP requests.
   Use the advertised token endpoint to refresh access when a refresh token was issued.

## API keys: automation without an interactive sign-in

An existing user can supply a Pitchlane API key using the setup instructions.
Send it on MCP requests in either of these headers:

```http
Authorization: Bearer <pitchlane_api_key>
```

or:

```http
X-API-Key: <pitchlane_api_key>
```

Use one credential header. If Authorization is present, it takes precedence.
For direct REST API calls, follow the API reference rather than reusing an MCP
OAuth token with a different audience.

## Failed access and revocation

- On 401, check the authentication challenge and reconnect or obtain a valid key.
- On 503, retry later; an unavailable authentication dependency is not a bad password.
- OAuth clients can use the advertised revocation endpoint to revoke refresh tokens.
- A deleted API key stops working on subsequent requests. Revoke a key in Pitchlane
  when it should no longer be available to an automation.

## Protocol support

This guide describes Pitchlane's existing MCP OAuth and API-key authentication.
Pitchlane does not currently implement the WorkOS auth.md `agent_auth` identity
assertion or claim-ceremony protocol. Do not assume ID-JAG, device-code, anonymous
agent-account creation, or agent-specific credential issuance is available.
