# webhooks.cc agent registration (auth.md)

You are an agent. If a human is with you and your client can add a remote
MCP server (Claude Code, Cursor, VS Code, Codex, claude.ai and ChatGPT all
can), start with option 1 below: the remote server at https://webhooks.cc/mcp needs one
approval in their browser and no code.

Otherwise, register yourself: webhooks.cc implements
[auth.md v0.6](https://github.com/workos/auth.md) agent registration. Without an account you can register anonymously, solve a
short proof of work, and use a sandbox: capture webhooks on up to
3 temporary endpoints and read them back. When your
human wants to keep them, or you need their account, run the claim ceremony:
they sign in and type a code you show them. Follow the steps in order.

Human-readable guide: https://webhooks.cc/docs/agents

## Start here: use the tools you have

Take the first option that fits.

1. **Your client can add a remote MCP server, and a human is around: use
   the remote server.** This is the default for coding agents (Claude Code,
   Cursor, VS Code, Codex) as much as for hosted ones (claude.ai, ChatGPT).
   The one exception is a task that sends to a handler on this machine
   (`send_to`, `replay_request`, `targetUrl`) or shares a local site
   (`share_port`), which the remote server cannot reach: take option 2 for
   that, or send to a capture URL and forward it with `whk tunnel <port>`. The server is `https://webhooks.cc/mcp` (streamable HTTP, OAuth). Your human signs in,
   or signs up, and clicks Connect once in the browser: no code to type,
   nothing that expires after 24 hours, and their account's tools (mock
   responses, forwarding, signature checks, email). Suggest it with the line
   for your client:
   - Claude Code: `claude mcp add -s user --transport http webhooks-cc https://webhooks.cc/mcp`,
     then `/mcp` in Claude Code to sign in
   - Codex: `codex mcp add webhooks-cc --url https://webhooks.cc/mcp` (it opens the
     browser to sign in; if it does not, `codex mcp login webhooks-cc`)
   - Cursor, in `.cursor/mcp.json`:
     `{ "mcpServers": { "webhooks-cc": { "url": "https://webhooks.cc/mcp" } } }`
   - VS Code, in `.vscode/mcp.json`:
     `{ "servers": { "webhooks-cc": { "type": "http", "url": "https://webhooks.cc/mcp" } } }`
   - claude.ai and Claude Desktop: in Settings, Connectors, add a custom
     connector with the URL `https://webhooks.cc/mcp`. ChatGPT: add it as a custom
     connector (in developer mode)
   - Any other client: add `https://webhooks.cc/mcp` as a remote (streamable HTTP) server

   Then stop and hand over. Tools from a newly added server appear only
   after your client reconnects or restarts, so wait for your human there;
   do not start a sandbox claim as well. Setup for each client is at
   https://webhooks.cc/docs/mcp#remote-server. A client that can send headers may use an API
   key instead: `Authorization: Bearer whcc_...`.

Options 2 to 5 are the fallback, and they start in the sandbox. It needs
nothing from your human: it is free, anonymous, isolated from every account,
and deleted after 24 hours. It lacks more than 3 endpoints, mock responses,
forwarding, signature checks and email. Pick it when nobody wants an
account, for throwaway captures, in CI, or with no human present. Your human
can still keep what you made there through the claim; the remote server
does not move sandbox endpoints into the account.

2. **The local MCP server**, for clients that run local (stdio) servers:
   `claude mcp add webhooks-cc -- npx -y @webhooks-cc/mcp`, or
   `npx -y @webhooks-cc/mcp setup cursor` (or `vscode`, `codex`,
   `windsurf`, `claude-desktop`). No key needed: your first
   `create_endpoint` registers you. Later, `connect_account` then
   `wait_for_connection` moves everything into your human's account.
   Connected to an account (an API key or a claim), the local server is
   also the one you need to send to localhost (`send_to`,
   `replay_request`, `targetUrl`) and for its prompts and resources, which
   the remote server lacks.
3. **You run Claude Code and can install plugins:**
   `/plugin install webhooks-cc --marketplace kroqdotdev/webhooks-cc` (the
   local MCP server plus the webhooks-cc skill).
4. **You can run code.** Each of these registers, solves the proof of work
   and reuses the sandbox on the next run:
   - Python: `pip install webhooks-cc`, then `WebhooksCC.sandbox()`
   - Node: `npm i @webhooks-cc/sdk`, then `WebhooksCC.sandbox()`
   - Go: `go get webhooks.cc/go`, then `webhookscc.NewSandbox(ctx)`
   - Shell: `whk sandbox create --json` (install with
     `curl -fsSL https://webhooks.cc/install.sh | sh` or
     `brew install kroqdotdev/tap/whk`; without root,
     `curl -fsSL https://webhooks.cc/install.sh | WHK_INSTALL_DIR="$HOME/.local/bin" sh`)
5. **You only have HTTP:** follow Steps 1 to 6 below. Any User-Agent works.

Connected before? Options 2 to 4 keep the sandbox and your human's
connection in one file and reuse it: `~/.config/whk/agent.json` (or
`$XDG_CONFIG_HOME/whk/agent.json`; macOS
`~/Library/Application Support/whk/agent.json`; Windows
`%APPDATA%\whk\agent.json`; `WHK_AGENT_FILE` overrides it). Read it before
registering again: `WebhooksCC.connected()` in the SDKs does. Its format is in
https://webhooks.cc/docs/agents. Your human has an API key? Set `WHK_API_KEY` and skip all of
this.

For the claim email, use the address your human signs in to webhooks.cc
with (their GitHub or Google primary email if they sign in that way).

## At a glance

| Item | Value |
| --- | --- |
| Unclaimed registration, its identity assertion and its sandbox | 24 hours |
| Access token | 60 minutes, never past the registration; at most 5 live per registration |
| Sandbox endpoints | 3 at a time, each living until the registration expires |
| Sandbox captures | 25 per endpoint, 100 per registration |
| Proof-of-work challenge | valid 5 minutes, single use |
| Claim code (`user_code`) | 15 minutes, 5 wrong tries; 10 attempts per registration |
| Claimed assertion | 90 days |
| Connected agents per account | 10 |
| Anonymous registrations | 5 per hour per IP address |

## Step 1: Discover

- Protected Resource Metadata: https://webhooks.cc/.well-known/oauth-protected-resource
- Authorization Server Metadata: https://webhooks.cc/.well-known/oauth-authorization-server
- Signing keys of our identity assertions: https://webhooks.cc/.well-known/jwks.json

A 401 from the API carries `WWW-Authenticate: Bearer resource_metadata="..."`
pointing at the first document. The `agent_auth` block in the second one
lists the endpoints below.

## Step 2: Pick a method

- **anonymous**: you have neither. Gives you the sandbox right away; a
  claim is optional.
- **service_auth**: you have only your user's email. Nothing works until
  they complete the claim ceremony; no proof of work and no sandbox:

  ```http
  POST https://webhooks.cc/api/agent/identity
  Content-Type: application/json

  { "type": "service_auth", "login_hint": "user@example.com", "client_name": "my-agent" }
  ```

  The response carries `registration_id`, `claim_url`, `claim_token`,
  `claim_token_expires`, `post_claim_scopes` and the first claim attempt as
  `claim: { user_code, expires_in, verification_uri, interval }`. Continue
  at Step 4b.
- **identity_assertion** (ID-JAG): no identity provider is trusted yet; it answers `issuer_not_enabled`.

## Step 3: Register (anonymous)

Anonymous registration needs a solved proof-of-work challenge. Get one:

```http
POST https://webhooks.cc/api/agent/identity/challenge
```

```json
{
  "challenge": "pow1.eyJ2Ijox...",
  "algorithm": "sha256-zero-bits",
  "difficulty": 18,
  "count": 32,
  "expires_at": "2026-10-10T10:05:00.000Z"
}
```

For each `i` from 0 to `count - 1`, find a decimal nonce (at most 16
digits) such that SHA-256 of the UTF-8 string `<challenge>.<i>.<nonce>`
starts with `difficulty` zero bits. Expected work is `count x 2^difficulty`
hashes; difficulty rises by a bit or two while the sandbox is busy, and never
past 2^26 hashes in all. A plain solver like these takes
roughly 5 to 15 seconds on one core.

Python:

```python
import hashlib

def solve(challenge: str, difficulty: int, count: int) -> list[str]:
    nonces = []
    for i in range(count):
        n = 0
        while int.from_bytes(hashlib.sha256(f"{challenge}.{i}.{n}".encode()).digest(), "big") >> (256 - difficulty):
            n += 1
        nonces.append(str(n))
    return nonces
```

JavaScript (Node.js):

```js
import { createHash } from "node:crypto";

function solve(challenge, difficulty, count) {
  const nonces = [];
  for (let i = 0; i < count; i++) {
    let n = 0;
    while (BigInt("0x" + createHash("sha256").update(`${challenge}.${i}.${n}`).digest("hex")) >> BigInt(256 - difficulty)) n++;
    nonces.push(String(n));
  }
  return nonces;
}
```

Then register:

```http
POST https://webhooks.cc/api/agent/identity
Content-Type: application/json

{
  "type": "anonymous",
  "client_name": "my-agent",
  "proof_of_work": { "challenge": "pow1.eyJ2Ijox...", "nonces": ["81723", "40211", "..."] }
}
```

`client_name` is optional (at most 64 characters) and is shown to humans as
self-reported. Without `proof_of_work` the answer is 400
`proof_of_work_required` with a fresh challenge in the body, so two calls are
enough even without discovery. Response (200):

```json
{
  "registration_id": "<uuid>",
  "registration_type": "anonymous",
  "identity_assertion": "<service-signed JWT>",
  "assertion_expires": "<24 hours from now>",
  "pre_claim_scopes": ["webhooks:sandbox"],
  "claim_url": "https://webhooks.cc/api/agent/identity/claim",
  "claim_token": "clm_...",
  "claim_token_expires": "<24 hours from now>",
  "post_claim_scopes": ["webhooks:read","webhooks:write"],
  "sandbox": { "status": "available", "endpoints_url": "https://webhooks.cc/api/agent/sandbox/endpoints", ... }
}
```

`sandbox.status` is `full` when the shared sandbox has no free endpoint
slot; ask a human to sign up instead. The response also repeats these values
in the nested shape of the auth.md v0.7 proposal (`id`, `type`,
`identity`, `claim`, `scopes`).

`claim_token` is returned once. Keep it in memory for Step 4; do not persist
it.

## Step 4: Claim ceremony

A human with a webhooks.cc account (or who signs up) connects you to it.
For an anonymous registration this moves your sandbox endpoints, with what
they captured, into their account and replaces your sandbox token with
account credentials.

### 4a. Start an attempt

service_auth: the `claim` block of your Step 3 response is your first
attempt. anonymous:

```http
POST https://webhooks.cc/api/agent/identity/claim
Content-Type: application/json

{ "claim_token": "clm_...", "email": "user@example.com" }
```

```json
{
  "registration_id": "<uuid>",
  "claim_attempt_id": "cla_...",
  "status": "initiated",
  "expires_at": "<15 minutes from now>",
  "claim_attempt": {
    "user_code": "123456",
    "expires_in": 900,
    "verification_uri": "https://webhooks.cc/agent/claim?attempt=cat_...",
    "interval": 5
  }
}
```

The two ids differ on purpose: `claim_attempt_id` (`cla_`) names the
attempt, and the `cat_` value in `verification_uri` is a separate token
for the page.

`email` binds the attempt: only someone signed in with that address can
complete it. The same call starts a new attempt when a code ran out (a
service_auth registration may leave `email` out); the previous link stops
working. A registration may start 10 attempts.

### 4b. Hand off to the human

Show both in one message, for example:

> Open this link, sign in (or sign up), and enter this 6-digit code: **123456**
> https://webhooks.cc/agent/claim?attempt=cat_...

The code goes into the page, not back to you. The page shows the human your
`client_name` (labelled as self-reported), when you registered and which
sandbox endpoints will move, and lets them decline.

### 4c. Poll for completion

```http
POST https://webhooks.cc/api/oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=urn:workos:agent-auth:grant-type:claim
&claim_token=clm_...
```

| Answer | Meaning |
| --- | --- |
| `authorization_pending` | Not done yet. Poll again after `interval` seconds. |
| `slow_down` | You polled faster than `interval`. Wait longer. |
| `expired_token` | The code ran out (or 5 wrong codes were entered). Start a new attempt (4a); if that answers `claim_expired`, register again. |
| `access_denied` | The human declined. |
| `invalid_grant` | Unknown, revoked or already collected claim token. |

Success is an OAuth token response plus a claimed identity assertion:

```json
{
  "access_token": "whcc_...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "webhooks:read webhooks:write",
  "identity_assertion": "<service-signed JWT>",
  "assertion_expires": "<90 days from now>"
}
```

The claim token works once: the first successful poll uses it up, so keep
the response. Your pre-claim tokens and assertion stop working. The access
token acts for the human on the whole API (`https://webhooks.cc/api/`), except
account settings such as API keys and billing. Mint new ones from the
claimed assertion (Step 5); when it expires, the human repeats the claim.

## Step 5: Exchange the assertion

```http
POST https://webhooks.cc/api/oauth2/token
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&assertion=<identity_assertion>
&resource=https://webhooks.cc/api/
```

Response (200):

```json
{ "access_token": "whcc_...", "token_type": "Bearer", "expires_in": 3600, "scope": "webhooks:sandbox" }
```

A claimed assertion (Step 4c) gets `"scope": "webhooks:read webhooks:write"`
instead. The same assertion mints new tokens until it expires. `invalid_grant` means
the registration expired or was revoked: register again (Step 3). There is
no refresh token.

## Step 6: Use the access token

Send `Authorization: Bearer whcc_...`. A claimed agent's token works on the
whole API at `https://webhooks.cc/api/` (except account settings such as API keys and
billing). An unclaimed registration's token works only on the sandbox:

| Call | Result |
| --- | --- |
| `POST https://webhooks.cc/api/agent/sandbox/endpoints` | 201, a new endpoint with its capture `url`. 409 `sandbox_endpoint_limit` at 3 live; 503 `sandbox_full` when the shared pool is full. |
| `GET https://webhooks.cc/api/agent/sandbox/endpoints` | This registration's live endpoints and its remaining budget. |
| `GET https://webhooks.cc/api/agent/sandbox/endpoints/{slug}` | One endpoint; 404 when it is not this registration's. |
| `DELETE https://webhooks.cc/api/agent/sandbox/endpoints/{slug}` | 204. Frees a slot; the request budget is not refunded. |
| `GET https://webhooks.cc/api/agent/sandbox/endpoints/{slug}/requests?since=<ms>&limit=<n>` | Captured requests, newest first, at most 100. |
| `GET https://webhooks.cc/api/agent/sandbox/requests/{id}` | One captured request. |

Send webhooks to the endpoint's `url` (`https://go.webhooks.cc/w/<slug>`).
Each endpoint stores 25 requests and the
registration 100 in all; past that the capture URL
answers 429. Sandbox endpoints answer every capture with a plain 200: there
are no mock responses, notifications, signature checks, email or forwarding.
Only this registration's token can read its captures.

On a 401 with a previously working token, exchange the assertion again
(Step 5) once; if that returns `invalid_grant`, register again.

## Revocation

- `POST https://webhooks.cc/api/oauth2/revoke` with `token=<access_token>` (form-encoded) drops one
  access token. Always 200. Your assertion still works.
- Every token, endpoint and capture of an unclaimed registration is deleted
  within minutes after it expires.
- The human can disconnect a claimed agent under Account, Connected agents:
  your tokens stop working and the assertion answers `invalid_grant`.
- An identity provider can revoke an ID-JAG identity with a Security Event
  Token at https://webhooks.cc/api/agent/event/notify. Its registration and tokens go, and the assertion
  answers `invalid_grant`.

## Errors

`https://webhooks.cc/api/agent/identity` and the sandbox answer `{ "error", "error_description" }`;
`https://webhooks.cc/api/oauth2/token` uses the OAuth envelope (RFC 6749).

| Code | Where | What to do |
| --- | --- | --- |
| `proof_of_work_required` (400) | identity | Solve the challenge in the body and send it. |
| `invalid_challenge` (400) | identity | The proof was wrong, expired or reused. Solve the fresh challenge in the body. |
| `anonymous_not_enabled` (400) | identity | Anonymous registration is off. Ask a human to sign up. |
| `invalid_login_hint` (400) | identity, claim | Give one plain email address; addresses at the capture domain are refused. |
| `invalid_claim_token` (401) | claim | Unknown or revoked claim token. Register again. |
| `claimed_or_in_flight` (409) | claim | Already claimed. Poll the claim grant. |
| `claim_expired` (410) | claim | The registration expired. Register again. |
| `too_many_attempts` (429) | claim | 10 attempts used. Register again. |
| `issuer_not_enabled` (400) | identity | Your identity provider is not trusted here. |
| `login_required` (401) | identity (ID-JAG) | `auth_time` is missing or older than `max_age`. Re-authenticate the user at your provider and mint a fresh ID-JAG. |
| `interaction_required` (401) | identity (ID-JAG) | The email belongs to an existing account. Run the claim ceremony from Step 4b with the `claim` block in the body. |
| `invalid_request` (400) | any | Fix the request body. |
| `rate_limited` (429) | any | Wait for `Retry-After` seconds. |
| `temporarily_unavailable` (503) | identity | Retry after `Retry-After` seconds. |
| `invalid_grant` (400) | token | Register again. |
| `authorization_pending`, `slow_down`, `expired_token`, `access_denied` (400) | token, claim grant | See 4c. |
| `unsupported_grant_type` (400) | token | Use the jwt-bearer or the claim grant (the token endpoint also takes `authorization_code` and `refresh_token`, for OAuth clients). |
| `invalid_target` (400) | token | `resource` must be https://webhooks.cc/api/, https://webhooks.cc/mcp or left out. |
| `sandbox_endpoint_limit` (409) | sandbox | Delete an endpoint first. |
| `sandbox_full` (503) | sandbox | Retry later, or ask a human to sign up. |
| `sandbox_closed` (403) | sandbox | The registration was claimed, revoked or expired. |
| `sandbox_only` (403) | sandbox | The sandbox takes agent tokens, not API keys. |
| `not_found` (404) | sandbox | Not this registration's endpoint or request. |

## Older clients (auth.md v0.1)

The v0.1 endpoints under `https://webhooks.cc/api/agent/auth` answer 410
`endpoint_moved`, except the `verified_email` flow, which keeps working for
older SDK and MCP versions until 2026-11-30. Its
answers carry `Deprecation` and `Sunset` headers. New agents should follow
the steps above.

## For identity providers (ID-JAG)

Trusted issuers are deployment configuration (`AGENT_IDJAG_PROVIDERS`),
never changeable at runtime. An assertion must use `typ: oauth-id-jag+jwt`,
come from a trusted issuer, target audience `https://webhooks.cc/api/`, carry a unique
`jti`, an `iat` within the last hour, an `auth_time` within the last
3600 seconds and a verified email (`email_verified: true`), and be
unexpired.

An identity `(iss, sub)` links to an account in this order: the account it
was linked to before; else, when an account has the verified email, nothing
links until the human signed in to it confirms (`interaction_required`);
else a new account is created for the email.

To revoke an identity, POST a Security Event Token (RFC 8417) to
https://webhooks.cc/api/agent/event/notify with `Content-Type: application/secevent+jwt`: `typ:
secevent+jwt`, signed with the same keys, `aud` `https://webhooks.cc`, a unique
`jti`, `iat` within the last 24 hours, the identity's `sub`, and
`events` containing `https://schemas.workos.com/events/agent/auth/identity/assertion/revoked`. Every registration of
that identity is revoked with its tokens, and the next ID-JAG for it links
again as above. The answer is 202 with no body (also for a SET already
received), or 400 with `{ "err", "description" }` (RFC 8935).
