# Wake auth.md

> How an AI agent registers with Wake and authenticates to the Wake API at `https://wakeagents.ai/api/wake/v1`. Humans: sign in at https://wakeagents.ai/wake/login.

## Who this is for

Agents (coding assistants, MCP clients, scripts) acting for the owner of a website. The public tools need no credential at all: `wake_check_site` and `wake_about` over MCP at `https://wakeagents.ai/api/wake/v1/public/mcp`, and `GET https://wakeagents.ai/api/wake/v1/public/readiness?host=example.com` over HTTP. Everything about a tracked site (visits, friction, fixes, goals, the weekly brief) needs the desk's API key.

## How an agent registers

One call opens a desk for a site the owner controls and returns the credential:

```http
POST https://wakeagents.ai/api/wake/v1/public/signup
Content-Type: application/json

{ "site": "https://your-site.example", "email": "owner@your-site.example", "terms_accepted": true }
```

The answer (201) carries `desk_url`, `api_key` (`wk_live_…`), `mcp_endpoint` and the next steps (`wake_provision` for the tracker file, `wake_verify` to prove the site, `wake_fix_plan` for what to change). The same action is the `wake_signup` tool on the public MCP server. Registration sends the owner one email: the sign-in link for the desk. The 7-day trial needs no card. `GET` on the same URL returns these instructions as JSON; the call is made once per site, never from a passive scan.

Keys can also be minted and revoked by a signed-in person on the desk, under Settings → Integrations.

## How an agent authenticates

Send the key as a Bearer token, or as `X-API-Key`:

```http
GET https://wakeagents.ai/api/wake/v1/sessions?window=7d
Authorization: Bearer wk_live_…
```

A missing or revoked key answers 401 with `WWW-Authenticate: Bearer realm="wake", resource_metadata="https://wakeagents.ai/.well-known/oauth-protected-resource"` and a `how_to_fix` line. Keys are limited per minute; a 429 says when to retry. One scope exists, `desk`: a key reads and writes its own desk and nothing else.

## OAuth metadata

- Protected resource (RFC 9728): https://wakeagents.ai/.well-known/oauth-protected-resource
- Authorization server (RFC 8414): https://wakeagents.ai/.well-known/oauth-authorization-server
- Token endpoint: `POST https://wakeagents.ai/oauth/token` with `grant_type=client_credentials`; the client secret is the desk API key (HTTP Basic or `client_secret` in the form). The access token returned is a Bearer token the API accepts. There is no authorization-code or device grant: the authorization endpoint answers every request with `unsupported_response_type`.
- JWKS: https://wakeagents.ai/.well-known/jwks.json (tokens are opaque, the set is empty)

## Machine-readable summary

```json
{
  "agent_auth": {
    "skill": "https://wakeagents.ai/.well-known/agent-skills/open-a-wake-desk/SKILL.md",
    "register_uri": "https://wakeagents.ai/api/wake/v1/public/signup",
    "resource_metadata": "https://wakeagents.ai/.well-known/oauth-protected-resource",
    "authorization_server": "https://wakeagents.ai/.well-known/oauth-authorization-server",
    "identity_types_supported": [
      "verified_email"
    ],
    "verified_email": {
      "credential_types_supported": [
        "api_key"
      ],
      "claim_uri": "https://wakeagents.ai/wake/login",
      "registration": {
        "method": "POST",
        "content_type": "application/json",
        "body": {
          "site": "https://your-site.example",
          "email": "owner@your-site.example",
          "terms_accepted": true
        },
        "returns": [
          "desk_url",
          "api_key",
          "mcp_endpoint",
          "next_steps"
        ]
      }
    },
    "token_exchange": {
      "grant_type": "client_credentials",
      "token_endpoint": "https://wakeagents.ai/oauth/token",
      "client_secret": "the desk API key (wk_live_…)"
    }
  }
}
```

## Related

- API reference: https://wakeagents.ai/wake/docs/api
- MCP servers: https://wakeagents.ai/wake/docs/mcp
- API catalog (RFC 9727): https://wakeagents.ai/.well-known/api-catalog
- Agent skills: https://wakeagents.ai/.well-known/agent-skills/index.json
- Terms: https://wakeagents.ai/wake/docs/terms · Privacy: https://wakeagents.ai/wake/docs/privacy
