---
name: auth-md
description: Agent registration and authentication protocol (auth.md) for Tohu (`tohu` by Taki Labs), detailing two-hop OAuth Protected Resource & Authorization Server discovery, the `agent_auth` metadata block, anonymous/user-claimed and assertion-based registration flows, API Keys (`sdk_...`), scopes, and token revocation.
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://tohu.takilabs.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Agent Authentication & Registration (`auth.md`) — Tohu

> Canonical Agent Auth Skill (`auth.md`): `https://tohu.takilabs.io/auth.md`  
> Protected Resource Metadata (RFC 9728): `https://tohu.takilabs.io/.well-known/oauth-protected-resource`  
> Authorization Server Metadata (RFC 8414): `https://tohu.takilabs.io/.well-known/oauth-authorization-server`  
> OpenID Connect Discovery: `https://tohu.takilabs.io/.well-known/openid-configuration`

**Tohu (`tohu` by Taki Labs)** implements the open **`auth.md`** protocol (`https://workos.com/auth-md`, `https://github.com/workos/auth.md`) so autonomous AI agents, Model Context Protocol (MCP) clients, and non-human identities can discover authentication requirements, register for workspace credentials, initiate user-claim ceremonies, and authenticate against MCP (`/api/mcp`, `/mcp`) and REST v1 (`/api/v1/envelopes`, `/api/v1/templates`, `/api/v1/webhook-deliveries`) endpoints without manual form filling.

---

## 1. Two-Hop Machine Discovery Architecture

When an AI agent interacts with Tohu without prior credentials, it can discover registration and token endpoints in two standard hops:

1. **Hop 1 — Protected Resource Metadata (RFC 9728)**:
   Fetch `GET https://tohu.takilabs.io/.well-known/oauth-protected-resource` (also referenced in `401 Unauthorized` `WWW-Authenticate` response headers):

   ```json
   {
     "resource": "https://tohu.takilabs.io",
     "resource_name": "Tohu API & MCP Server",
     "authorization_servers": ["https://tohu.takilabs.io"],
     "auth_md": "https://tohu.takilabs.io/auth.md",
     "agent_auth_skill": "https://tohu.takilabs.io/auth.md",
     "jwks_uri": "https://tohu.takilabs.io/.well-known/jwks.json",
     "scopes_supported": ["openid", "profile", "email", "mcp", "read", "draft", "write"],
     "bearer_methods_supported": ["header"]
   }
   ```

2. **Hop 2 — Authorization Server Metadata & `agent_auth` Block (RFC 8414)**:
   Fetch `GET https://tohu.takilabs.io/.well-known/oauth-authorization-server` and inspect the `agent_auth` object:
   ```json
   {
     "issuer": "https://tohu.takilabs.io",
     "authorization_endpoint": "https://tohu.takilabs.io/api/oauth/authorize",
     "token_endpoint": "https://tohu.takilabs.io/api/oauth/token",
     "registration_endpoint": "https://tohu.takilabs.io/api/oauth/register",
     "revocation_endpoint": "https://tohu.takilabs.io/api/oauth/revoke",
     "introspection_endpoint": "https://tohu.takilabs.io/api/oauth/introspect",
     "agent_auth": {
       "skill": "https://tohu.takilabs.io/auth.md",
       "auth_md": "https://tohu.takilabs.io/auth.md",
       "register_uri": "https://tohu.takilabs.io/api/oauth/agent/register",
       "identity_endpoint": "https://tohu.takilabs.io/api/oauth/agent/register",
       "claim_uri": "https://tohu.takilabs.io/api/oauth/agent/claim",
       "claim_endpoint": "https://tohu.takilabs.io/api/oauth/agent/claim",
       "revocation_uri": "https://tohu.takilabs.io/api/oauth/revoke",
       "token_uri": "https://tohu.takilabs.io/api/oauth/token",
       "identity_types_supported": [
         "anonymous",
         "identity_assertion",
         "service_auth"
       ],
       "credential_types_supported": ["api_key", "bearer"],
       "scopes_supported": [
         "openid",
         "profile",
         "email",
         "mcp",
         "read",
         "draft",
         "write"
       ]
     }
   }
   ```

---

## 2. Agent Registration, Claim & Revocation Flows

1. **Initiate Registration (`POST /api/oauth/agent/register`)**:

   ```bash
   curl -s -X POST "https://tohu.takilabs.io/api/oauth/agent/register" \
     -H "Content-Type: application/json" \
     -d '{
       "identity_type": "anonymous",
       "agent_name": "E-Signature Workflow Agent",
       "credential_type": "api_key",
       "scopes": ["mcp", "read", "write"]
     }'
   ```

2. **Claim the Registration (`POST /api/oauth/agent/claim`)**:

   ```bash
   curl -s -X POST "https://tohu.takilabs.io/api/oauth/agent/claim" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sdk_<existing_or_session_token>" \
     -d '{
       "registration_id": "reg_...",
       "claim_code": "CLAIM-..."
     }'
   ```

3. **Revoke a Token (`POST /api/oauth/revoke` — RFC 7009)**:
   ```bash
   curl -s -X POST "https://tohu.takilabs.io/api/oauth/revoke" \
     -H "Content-Type: application/json" \
     -d '{"token": "sdk_<your_api_key>"}'
   ```
