> ## Documentation Index
>
> Fetch the complete documentation index at: https://conciergeprotocol.org/llms.txt
> Use this file to discover all available pages before exploring further.
>
> Full text of every page: https://conciergeprotocol.org/llms-full.txt
> This page: https://conciergeprotocol.org/spec.md

# Specification

**Status: Draft. Version 1.0.** Breaking changes are listed in the [changelog](https://conciergeprotocol.org/changelog.md). Feedback is welcome in [GitHub issues](https://github.com/conciergeprotocol/cap/issues).

CAP lets an agent ask a company's agent a question and get the answer back. The company's tools, prompts, and keys stay with the company. There is one object, the **message**, and two endpoints. How to call it: [Usage](https://conciergeprotocol.org/usage.md).

## Front door

A company publishes one text file at `https://{domain}/agent.txt`, next to `robots.txt`. It lives at the root rather than under `/.well-known/` so that any site owner can publish it the same way they publish `robots.txt`, on hosts that do not serve dot-directories. The `Protocol` line tells it apart from other files with the same name.

```text
Protocol: CAP/1.0
Name: Harbor Goods
Ask: This site's agent answers questions for the company. POST your question to the CAP URL plus /messages, as JSON {"message": "..."}, with headers CAP-Version: 1.0 and CAP-From: agent:{your-id}. If you can only open URLs, open the CAP URL. If the reply is 202, see Spec.
Chat: https://harborgoods.example/chat
CAP: https://harborgoods.example/cap/v1
OAuth: https://harborgoods.example/oauth
Spec: https://conciergeprotocol.org/cap.txt
```

`Protocol` and `CAP` are required. The other lines are optional, and a caller ignores a line it does not know.

`Protocol` is the first line. It names this format, so a caller can tell this file apart from an unrelated `agent.txt`. A caller that finds no `Protocol` line uses the file only when it has a `CAP` line. `Name` is the public agent. `Ask` is one fixed sentence for an agent that does not know CAP. Without it, such an agent tends to read the file, skip `Spec`, and go back to reading the site. Owners SHOULD include it, copied exactly as written. It has no URL or name in it, so it is the same on every door and never drifts from the `CAP` line. It describes the door rather than instructing the agent, and it is part of the format, not a prompt. A caller that knows CAP ignores it. `Chat` is the page a person opens. `CAP` is the base URL for the two endpoints. `OAuth` is the authorization server for questions about a customer's account. Leave it off when the agent answers only public questions. `Spec` is a short caller card. Use the hosted card at `https://conciergeprotocol.org/cap.txt`. It covers every CAP 1.x door and is updated in one place, so do not copy it to your own domain. A caller may skip fetching it when it already knows CAP. Notes for your door belong in your agent's replies, not in a separate card or in `Ask`. The file lists no tools, MCP servers, door-specific prompts, or credentials.

One domain has one agent. A person uses the chat page. An agent fetches the file. Both reach the same agent and get the same answers.

The chat page and the CAP URL may be hosted for the company. The company's domain is what a caller trusts. The file itself may be hosted elsewhere when that domain points at it.

A caller looks for the file in this order and stops at the first valid one:

1. `GET https://{domain}/agent.txt`. A redirect is followed, including one to another https host. The company's domain is vouching for the target by redirecting to it. A redirect within the same site, such as `example.com` to `www.example.com`, is followed too.
2. When that request is not a front door (a missing file, an HTML page, or a file with no `CAP` line), the caller reads the homepage, `GET https://{domain}/`. A redirect of the homepage is followed only within the same site. The caller reads at most the first 256 KB, and only through `</head>`. When `</head>` is missing, it stops at `<body>`. It takes the first of these:
   - a `Link` header: `Link: <https://cdn.example/agent.txt>; rel="agent"`
   - a tag in the head: `<link rel="agent" href="https://cdn.example/agent.txt">`

The caller fetches that URL once and does not follow a pointer from the target. It treats an HTML body, a redirect to a URL that is not https, or a file without a `CAP` line as no front door. When `/agent.txt` is a valid front door, the homepage is ignored. The door belongs to the domain the caller asked, not to the host that served the file.

An owner also points at the door from the pages an agent already reads. CAP callers still try `/agent.txt` first. The link is how every other agent finds the door, and it remains the fallback when the root file is missing.

- On the homepage, including when `/agent.txt` is a valid door: `<link rel="agent" href="https://{domain}/agent.txt">` in `<head>`, or `Link: <https://{domain}/agent.txt>; rel="agent"` on that response.
- In `llms.txt`, one line that points at `/agent.txt` and says to ask there.
- Optionally, one entry in `/.well-known/ai-catalog.json` whose `url` is the `agent.txt` file and whose `type` is `text/plain`. A site that also publishes `/.well-known/ard.json` lists the same entry there. The entry is a link to the file. CAP has no catalog type of its own.

## Message

| Field         | Notes                                                                    |
| ------------- | ------------------------------------------------------------------------ |
| `id`          | Assigned by the owner                                                    |
| `status`      | `working`, `done`, or `failed`                                           |
| `reply`       | Text. Set only when `status` is `done`. Links go in the text             |
| `error`       | `{ code, message }`. Set only when `status` is `failed`                  |
| `confirmation` | Optional. Set with `done` when an action waits for the person (see [Confirm an action](#confirm-an-action)) |
| `items`       | Optional. Set with `done`. Typed records the reply mentions (see [Structured results](#structured-results)) |
| `as_of`       | Optional. When the owner read the data behind `items`, RFC 3339. Required when any item has a price |
| `created_at`  |                                                                          |
| `finished_at` | Set when `status` is `done` or `failed`                                  |

| Status    | Meaning                                    | Final |
| --------- | ------------------------------------------ | ----- |
| `working` | The owner has the message and is answering | No    |
| `done`    | `reply` is set                             | Yes   |
| `failed`  | `error` is set                             | Yes   |

`error.message` is written for the person. It never names a tool, a vendor, or an internal id. `login_required` is the one defined failure code: the answer needs the person's account and no grant was sent. Owners may use other codes. A caller treats any failure as final for that message.

## Operations

```
POST /cap/v1/messages
GET  /cap/v1/messages/{id}
GET  /cap/v1/confirmations/{id}   (only for owners that confirm actions)
GET  /cap/v1                      (plain-text help, see below)
GET  /cap/v1/messages             (the same help)
GET  /cap/v1/messages?from=agent:{id}&message=...   (a public question, see Ask with a GET)
```

Every request carries `CAP-Version: 1.0` and `CAP-From: agent:{id}`, naming the calling agent. A request for a logged-in person also carries `Authorization: Bearer` with an OAuth access token. There are two exceptions: the help needs no headers, and a `GET` may name the caller with `from` in the query instead.

### Help

An agent that only browses often opens the CAP URL from `agent.txt` with a `GET`. An error page there sends it back to reading the site. So a `GET` on the CAP URL, or on `{CAP}/messages`, with or without the CAP headers, returns `200` with `Content-Type: text/plain` and this text, with the owner's name and CAP URL filled in:

```text
Harbor Goods answers questions for this company through the Concierge Agent Protocol (CAP).

POST https://harborgoods.example/cap/v1/messages
CAP-Version: 1.0
CAP-From: agent:{your-id}
Content-Type: application/json

{"message": "your question"}

If you can only open URLs, ask a public question with a GET:
https://harborgoods.example/cap/v1/messages?from=agent:{your-id}&message={your question, URL-encoded}

200 means the reply is ready. 202 means it is still working: wait Retry-After seconds, then GET the Location URL.
Spec: https://conciergeprotocol.org/cap.txt
```

The help is the same on every door, except one line. A door that supports [structured results](#structured-results) adds this line before `Spec`:

```text
Items: add "accept": ["items"] to the JSON, or accept=items to the GET, to also receive typed results.
```

The status is `200`, not `405`, because many agent fetch tools drop the body of an error.

### Ask with a GET

Many agents can only open a URL. They cannot send a `POST` or set headers. For them, a public question can be a `GET`:

```
GET /cap/v1/messages?from=agent:example-assistant&message=Do%20you%20ship%20to%20Canada%3F
```

- `from` stands in for `CAP-From`, and `CAP-Version` is implied. `message` is required. `previous_message_id` continues a conversation, as in a `POST`. There is no `context`.
- It is for public questions only. A `GET` with an `Authorization` header returns `400`. Account questions and actions use `POST`.
- The response is the same as for a `POST`. A `202` sets `Location` with `from` in its query, so the caller reads it back with a `GET` too: `GET /cap/v1/messages/{id}?from=agent:example-assistant`.
- Fetch tools retry and prefetch a `GET`. The owner treats the same `from`, `message`, `previous_message_id`, and `accept` within one minute as one message, so a retry is answered once. Asking again with `accept=items` is a different message.
- Responses are `Cache-Control: no-store`. The owner applies the same rate limits as for a `POST`.

A `GET` without `message` is the help.

### Send a message

```json
{ "message": "Black running shoes in size 12", "context": { "style": "minimal, all black" } }
```

`message` is required text. `context` is an optional object: a short brief from the caller, such as sizes, dates, or preferences. It is not a vendor API payload and not the person's whole profile. `accept` is an optional array of strings. `"items"` asks for [structured results](#structured-results). A door ignores a value it does not know. A value that is not an array of strings, and not a comma-separated list on a GET, is `400`.

- `200` with the message when the owner finished within its own wait. The status is `done` or `failed`.
- `202` with the message when it did not. The status is `working`. The response sets `Location: /cap/v1/messages/{id}` and `Retry-After` in seconds.

`Location` is on the same origin as the CAP URL. The owner sends a path, as above, or an absolute URL on that origin. The caller resolves it against the request URL. If the result has another origin, the caller does not send a token or `CAP-From` there, and reads `{CAP}/messages/{id}` instead. The same holds for an HTTP redirect from any CAP endpoint: the caller does not carry `Authorization` or `CAP-From` to another origin.

The owner picks the wait, and it SHOULD be under 30 seconds. The caller sends nothing extra to get it.

`Idempotency-Key` is optional. The same key from the same `CAP-From`, with the same grant or none, returns the original message and does not answer again.

### Follow up

```json
{ "message": "Something cheaper?", "previous_message_id": "msg_c1fac527668c6694" }
```

`previous_message_id` is optional. It continues the conversation that message belongs to, so the owner answers with every earlier turn in mind. The caller sends only the new message and never resends earlier turns or replies. The owner rebuilds the thread from its own records, so a caller cannot put words in the owner's mouth.

The previous message must be visible to the caller, under the same rules as a read. A thread may move from no grant to a grant, such as after the person logs in. It never moves from one account to another, and it never drops a grant it had. A thread lasts as long as its messages are kept.

The previous message must be final. If it is still `working`, the owner returns `409`. The owner may cap how many turns a thread keeps and returns `409` past that cap. The caller then starts a new thread without `previous_message_id`.

### Read a message

`GET /cap/v1/messages/{id}` returns `200` with the message. While it is `working`, the response sets `Retry-After`. An owner may hold a read open, under 30 seconds, and answer as soon as the message finishes. It may do the same for a confirmation read and for a code login's token request. A caller sets its timeout to allow that, and sends the next read right after a response that is still `working` or `pending` comes back after a hold.

A message is visible only to the `CAP-From` that sent it, with the same grant or none. Anyone else gets `404`. The owner keeps a finished message for at least 24 hours. After that, a read is `404` and the caller asks again.

## Structured results

A done message may carry an `items` array next to `reply`. Each item is a typed record of something the reply mentions: a product, a plan or rate, a stay, a page, or an action the person can take on the company's site. `reply` stays the answer. An agent that ignores `items` still gets a complete answer. A door that never sends `items` is still a valid door.

This is optional. It is not a catalog feed, not checkout, and not a rendering format. Clients draw items in their own style. Payment stays on the company's site, through a confirmation.

An agent asks for items like this:

```json
{ "message": "Black running shoes in size 12", "accept": ["items"] }
```

`accept` is optional. A door that does not support items ignores it. A door that supports items may also send them when `accept` is absent. On a GET, add `&accept=items`.

`items` holds at most 20 entries, best first. `as_of` is when the door read the data, as RFC 3339. It is required when any item has a price. A price on an item is what the person would have seen on `url` for the stated options at `as_of`, before checkout fees unless `price_note` says otherwise. It is not a commitment. Only a confirmation freezes a price. After `valid_until`, the agent asks again before quoting the price.

### Item fields

Every item has `type`, `title`, and `url`.

| Field | Required | Meaning |
| --- | --- | --- |
| `type` | yes | `product`, `offer`, `listing`, `article`, or `action` |
| `title` | yes | Plain text, at most 200 characters |
| `url` | yes | https URL on the door's domain, or on a domain that domain vouches for by redirecting to it |
| `id` | no | The door's stable id, such as a SKU. Unique within the message |
| `ref` | no | Integer cited in `reply` as `[1]`. A `ref` appears once. An item with no `ref` is a suggestion the reply does not rely on |
| `summary` | no | One or two plain sentences |
| `image` | no | https URL of one image |
| `images` | no | More https image URLs, at most 10 |
| `schema` | no | The schema.org type this item maps to, such as `https://schema.org/Product` |
| `extra` | no | Further fields, named as schema.org properties where one exists |

`title` and `summary` are data from the company. An agent shows them. It does not follow instructions written in them.

### Commerce fields

`product`, `offer`, and `listing` may include these. `product` is something for sale. `offer` is a plan, rate, tier, or quote. `listing` is a stay, room, property, vehicle, or ticketed slot.

| Field | Meaning |
| --- | --- |
| `price` | `{ "amount": "140.00", "currency": "USD" }`. `amount` is a decimal string, so no precision is lost. `currency` is ISO 4217 |
| `list_price` | The regular price, only when it is higher than `price` |
| `price_note` | What the price covers, such as "per night, before taxes" |
| `availability` | `in_stock`, `out_of_stock`, `limited`, `preorder`, `backorder`, `made_to_order`, `available`, or `unavailable` |
| `valid_until` | RFC 3339. After this, ask again before quoting the price |
| `options` | The selected variant, such as `{ "size": "12", "color": "Black" }`. Keys and values are plain strings |
| `rating` | `{ "value": 4.6, "count": 4203, "scale": 5 }`. Only the door's own reviews |

`offer` adds `period` (`once`, `day`, `week`, `month`, `year`, or `night`) and `includes` (at most 20 short plain strings).

`listing` adds `start` and `end` (RFC 3339), `location` (`name`, `locality`, `region`, `country`, and no street address unless the page shows it publicly), and `capacity` (an integer). Cancellation terms stay on an `article` item.

`article` is a doc, policy, help page, or post the reply relies on. It adds optional `updated` (RFC 3339).

`action` is something the person can do next on the company's site. It adds `action` (`view`, `add_to_cart`, `book`, `contact`, or `manage`), optional `for` (the `id` of the item it applies to), and optional `expires` (RFC 3339, when the link stops working). The `url` opens a page on the company's site with the choice prefilled. Opening it does not complete a payment or a change. Checkout, and any other change that needs the person's approval, uses a confirmation.

### Rules for doors

- Every item matches the reply. Do not list an item the reply contradicts.
- Never put API keys, prompts, ids that grant access, or another person's data in an item. In a logged-in reply, items follow the same login scope as the reply. An item about the person's own account is only sent with a valid token for that person.
- Keep `url` and action links on the door's domain, or on a domain that domain vouches for by redirecting to it.
- Send at most 20 items. Send the best first.
- Unknown fields are ignored by agents, so a door may add fields under `extra`.

### Rules for agents

- Treat items as the company's own account, like `reply`. Check other sources for comparisons and reviews.
- Do not quote a price after `valid_until`. Ask again.
- Open `url` and action links only when the person asks, and send no CAP token or `CAP-From` to them.
- Ignore unknown types and fields. Show an unknown type as a link, using `title` and `url`.
- Do not change a title or a price when showing it. Translating the title is fine.
- Drop a malformed item. Do not fail the message.

Items belong to their message. A follow-up returns its own items. An agent does not assume an item from an earlier message is still current.

Items add no status codes. A door that cannot build them sends the reply without them.

```json
{
  "id": "msg_8f2a",
  "status": "done",
  "as_of": "2026-11-12T07:26:00Z",
  "reply": "Two fit: the Cloudrunner 2 [1] is $140, down from $160, and the Tempo Lite [2] is $120. Both are in stock in size 12.",
  "items": [
    {
      "type": "product",
      "ref": 1,
      "id": "sku_88231",
      "title": "Cloudrunner 2, Black",
      "url": "https://shop.example/p/cloudrunner-2?size=12&color=black",
      "image": "https://shop.example/img/cr2-black.jpg",
      "price": { "amount": "140.00", "currency": "USD" },
      "list_price": { "amount": "160.00", "currency": "USD" },
      "availability": "in_stock",
      "options": { "size": "12", "color": "Black" },
      "valid_until": "2026-11-12T19:26:00Z",
      "schema": "https://schema.org/Product"
    },
    {
      "type": "product",
      "ref": 2,
      "id": "sku_77410",
      "title": "Tempo Lite, Black",
      "url": "https://shop.example/p/tempo-lite?size=12&color=black",
      "price": { "amount": "120.00", "currency": "USD" },
      "availability": "in_stock",
      "options": { "size": "12", "color": "Black" },
      "valid_until": "2026-11-12T19:26:00Z"
    }
  ]
}
```

## Access

A public question needs no token. A question about an account needs the person to log in.

Login is OAuth 2.1. The visiting agent is a public client. It has no secret and does not register with the company first. The person types their password only on the company's page. The visiting agent receives a token bound to that person's account and to its own `CAP-From`, and sends it on each request. It never holds the person's password or the company's keys.

There are two ways to log in. Every caller can use the **code login** (the device authorization grant, RFC 8628), because it needs only HTTP requests: the agent shows the person a link, the person approves on the company's page, and the agent picks up the token. A caller that can receive a browser redirect may use the **redirect login** (the authorization code flow with PKCE) instead. An owner with an `OAuth` line supports the code login. The redirect login is optional.

### Discovery

The `OAuth` line is the authorization server's issuer. The caller reads the server's metadata (RFC 8414), with `/.well-known/oauth-authorization-server` inserted between the host and the issuer's path:

```
OAuth: https://harborgoods.example/oauth
GET https://harborgoods.example/.well-known/oauth-authorization-server/oauth
```

The metadata includes `issuer`, `device_authorization_endpoint`, `token_endpoint`, `revocation_endpoint`, and `protected_resources`. An owner with the redirect login also lists `authorization_endpoint`, `code_challenge_methods_supported` with `S256`, and `client_id_metadata_document_supported: true`.

`issuer` matches the `OAuth` line exactly. `protected_resources` (RFC 9728 §4) lists the CAP URL exactly as the `CAP` line gives it:

```json
{
  "issuer": "https://harborgoods.example/oauth",
  "protected_resources": ["https://harborgoods.example/cap/v1"]
}
```

Before a caller starts a login, and before it sends a token to a CAP URL, it checks that `issuer` is the `OAuth` line and that the door's CAP URL is in `protected_resources`, both compared character for character. If either check fails, the caller does not log in and sends no token to that CAP URL. Public questions still work. Without this check, any domain could put another company's authorization server in its `OAuth` line. The person would log in on the real company's page, and the caller would hand the token to the other domain's CAP URL, which could use it at the real one.

An issuer lists only the CAP URLs that answer for the accounts it logs people into. A provider that hosts doors for several companies gives each company its own issuer, such as `https://auth.provider.example/harbor-goods`, so a token from one company is never sent to another's door.

### Log in with a code

1. The caller posts a form to the `device_authorization_endpoint` with `client_id` set to its `CAP-From`, such as `agent:example-assistant`. It may add `client_name`, a short name the person will recognize, and `scope` (see [Access scope](#access-scope)).

```
POST https://harborgoods.example/oauth/device
Content-Type: application/x-www-form-urlencoded

client_id=agent:example-assistant&client_name=Example Assistant
```

```json
{
  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",
  "user_code": "WDJB-MJHT",
  "verification_uri": "https://harborgoods.example/oauth/device",
  "verification_uri_complete": "https://harborgoods.example/oauth/device?user_code=WDJB-MJHT",
  "expires_in": 600,
  "interval": 5
}
```

2. The caller gives the person `verification_uri_complete` and the `user_code`, and tells them to allow it only if the code matches. The caller keeps `device_code` to itself.
3. The person opens the link, logs in on the company's page, checks the code, and allows or denies.
4. Meanwhile the caller posts to the `token_endpoint` every `interval` seconds:

```
POST https://harborgoods.example/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code=GmRhmh...&client_id=agent:example-assistant
```

Until the person decides, the response is `400` with `error: authorization_pending`. `slow_down` means add 5 seconds to the interval. `access_denied` and `expired_token` are final. Once the person allows, the response is `access_token`, `token_type: Bearer`, `expires_in`, `refresh_token`, and `scope`. A device code yields a token once.

The owner shows the `client_name` and the `CAP-From` on its page, says the name is not verified, and binds the token to that `CAP-From`. Codes expire within 10 minutes.

### Log in with a redirect

The caller's `client_id` is an https URL it controls. That URL returns the agent's client metadata as JSON, an OAuth Client ID Metadata Document:

```json
{
  "client_id": "https://assistant.example/cap-client.json",
  "client_name": "Example Assistant",
  "redirect_uris": ["https://assistant.example/cap/callback"],
  "cap_from": "agent:example-assistant"
}
```

`client_id` is the document's own URL. `cap_from` is the `CAP-From` the agent sends. The owner fetches the document when the person logs in, shows `client_name` and the host of `client_id` on its consent page, and binds the token to `cap_from`. An agent that runs on the person's own device lists a loopback redirect, such as `http://127.0.0.1/callback`, and the owner accepts it on any port (RFC 8252). A caller may also use this URL as its `client_id` in the code login. The owner then shows the name as verified by that host.

The steps:

1. The caller makes a random `code_verifier` and opens the `authorization_endpoint` for the person with `response_type=code`, `client_id`, `redirect_uri`, `state`, `code_challenge`, `code_challenge_method=S256`, and optionally `scope`.
2. The person logs in on the company's page and consents. The owner redirects to `redirect_uri` with `code`, `state`, and `iss`. The `redirect_uri` must be one the client document lists. If it is not, the owner shows an error and does not redirect.
3. The caller posts to the `token_endpoint` as a form: `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, and `code_verifier`. The response is `access_token`, `token_type: Bearer`, `expires_in`, and `refresh_token`.

A code works once and expires within 10 minutes.

### Access scope

A login reads by default. A caller that needs the owner's agent to make changes for the person asks for `scope=write`, which includes read. An owner that offers changes lists `scopes_supported: ["read", "write"]` in its metadata, and returns `invalid_scope` for a scope it does not know.

The owner's page says what the caller is asking for. When the caller asks to write, the person can allow changes, allow read only, or deny. The token response's `scope` is what the person granted: `read`, or `read write`. It is never more than the caller asked for, and a renewed token keeps it.

Write access lets the owner's agent act within what the person could do themselves. The owner decides which actions that covers, and may give write tokens a shorter `expires_in`. Actions that are hard to undo, such as deletes or payments, should need the person to confirm each one on the owner's page.

### Confirm an action

A write token does not let an agent delete or pay on its own. When a message asks for such an action, the owner does not do it. It holds the action, answers `done` with a `reply` that says what is waiting, and adds `confirmation`:

```json
{
  "id": "msg_9b1e44c0a7d2f310",
  "status": "done",
  "reply": "Deleting the post \"Hello World\" needs your OK: https://harborgoods.example/confirm?id=cfm_4kq...",
  "confirmation": {
    "id": "cfm_4kq...",
    "status": "pending",
    "url": "https://harborgoods.example/confirm?id=cfm_4kq...",
    "summary": "Delete the post \"Hello World\" from Blog.",
    "authorization_details": [{ "type": "delete_post", "post": "hello-world" }],
    "expires_at": "2026-10-17T06:07:58Z"
  }
}
```

1. The caller gives the person `url` and `summary`. It never says the action is done.
2. The person opens the link, logged in on the owner's page, and approves or denies. The owner runs an approved action once, as the person, and never twice.
3. The caller reads `GET /cap/v1/confirmations/{id}` with the same token and `CAP-From`, waiting `Retry-After` between reads. `status` is `pending`, `working`, `done`, `failed`, `denied`, or `expired`. `done` and `failed` may carry `result.message`, written for the person. `done` may also carry `result.reference`, a short id the person can quote, such as an order or booking number.

A confirmation is visible only to the `CAP-From` and account that asked for it. It expires within 10 minutes if no one decides. Deciding means approving or denying. Work that starts on approval, such as a payment, may run longer, with `status` `working` until it ends. `authorization_details` describes the action in the owner's own types, in the style of Rich Authorization Requests (RFC 9396). The pattern is the one OpenID CIBA uses for approving an action out of band, applied to one action.

### Purchases

A payment is a confirmed action. The person pays on the owner's page, with the owner's checkout. The caller never receives a card, a payment token, or the person's password, and never pays on its own.

The owner keeps what it is selling on its own side: a cart tied to the account, or the items named in the message. A cart that lives only in a browser session cannot be reached by the owner's agent, so an owner that sells through CAP stores the cart against the account.

To hold a purchase, the owner prices it from its own records, freezes the items and the total, and returns a confirmation with one `authorization_details` entry of type `purchase`:

```json
{
  "type": "purchase",
  "merchant": "Harbor Goods",
  "items": [
    { "name": "Stride Runner", "options": { "color": "Black", "size": "12" }, "quantity": 1, "unit_price": "120.00" }
  ],
  "subtotal": "120.00",
  "shipping": "0.00",
  "tax": "9.90",
  "total": "129.90",
  "currency": "USD"
}
```

| Field | Notes |
| --- | --- |
| `type` | `purchase` |
| `merchant` | The name the person will see on the charge |
| `items` | `name`, `quantity`, and `unit_price`. `options` is optional, for variants such as size or color |
| `total` | What the person will be charged. Omit it only when the owner's page computes part of it, such as shipping to an address entered there |
| `subtotal`, `shipping`, `tax` | Optional |
| `currency` | ISO 4217 code |

Amounts are decimal strings in `currency`, not numbers. The person pays what the confirmation shows. When the price, the stock, or the tax changes before they pay, the owner ends the old confirmation as `failed`, with a `result.message` that says why, and the caller asks again. The owner never charges a different amount on the old approval. When the payment succeeds, `status` is `done`, and `result.reference` is the order number.

A caller may show a `purchase` as a checkout card: the items, the total, and a button that opens `url`. It says the order is waiting for the person, never that it is placed, until `status` is `done`.

### Use, renew, and revoke

An account request carries `Authorization: Bearer` and the `CAP-From` the token was issued to. Another `CAP-From` gets `403`. An expired or revoked token gets `401`.

The caller renews with `grant_type=refresh_token`, `refresh_token`, and `client_id`. The owner returns a new refresh token, and the old one stops working. The caller revokes with the `revocation_endpoint` (RFC 7009), sending `token` and `client_id`. Revoking stops that agent, and nothing else has to rotate.

The token endpoint returns OAuth's own errors, such as `invalid_grant`, not CAP's. An owner may require sender-constrained tokens with DPoP (RFC 9449), so a copied token is useless without the agent's key. Its metadata then lists `dpop_signing_alg_values_supported`, and the caller sends a DPoP proof with each token request and CAP request.

Two identities travel on an account request:

- `Authorization: Bearer` is the person and the account.
- `CAP-From: agent:{id}` is the visiting agent.

The owner answers however it chooses: its own MCP servers, a direct API, or a person. The caller does not learn which. Revoking the token stops that agent. Nothing else has to rotate.

## Owner rules

An owner conforms if it:

1. Returns only the fields above. Never tools, prompts, transcripts, internal ids, or credentials, in a field or in the reply.
2. Answers each message from its text, its `context`, the grant, and its own record of the thread. Never from another caller's messages.
3. Answers an account question only with a grant for that account. A name or an account number in `context` is not a grant.
4. Returns `202` with `Location` and `Retry-After` when it cannot finish within its wait.
5. Keeps its limits private. When it will not take more from a caller, it returns `429` with `Retry-After`.
6. Keeps finished messages for at least 24 hours.
7. For account questions, publishes OAuth metadata that lists its CAP URL in `protected_resources`, and supports the code login, with no registration. Binds each token to the `CAP-From` that logged in. If it offers the redirect login, it accepts client id metadata documents and requires PKCE with `S256`.
8. Answers a `GET` on the CAP URL and on `{CAP}/messages` with the [help](#help), and a public question [asked with a GET](#ask-with-a-get). Puts the `Ask` line in `agent.txt`.

## Caller rules

A caller conforms if it:

1. Never calls the owner's tools, MCP servers, or APIs to do or check the work.
2. Asks the door first when the question is one the company answers, and tells the person which answer came from the door. The reply is the company's own account, so for comparisons and reviews the caller checks other sources too.
3. Uses `reply` only when `status` is `done`.
4. Never invents a reply while a message is `working`. It tells the person the owner is still answering.
5. Waits at least `Retry-After` between reads.
6. Treats `failed` as final for that message. It sends a new one only when something changed, such as the person logging in.
7. Sends a short brief in `context`. Never the person's password or another company's data.
8. Sets `previous_message_id` to the last message when the person is continuing the same conversation, and leaves it off when they start a new one.
9. Logs in only through the owner's page, with the code login or the redirect login. Never asks the person for their password, and never sends the `device_code` to the person.
10. Gives the person a `confirmation` link as it is, and never reports a confirmed action as done until its status is `done`.
11. Logs in, and sends a token to a CAP URL, only when the issuer's metadata lists that CAP URL in `protected_resources`. Never carries a token or `CAP-From` to a `Location` or redirect on another origin.

## Errors

```json
{ "error": { "code": "rate_limited", "message": "Try again in a minute." } }
```

| Code                    | HTTP | When                                                                        |
| ----------------------- | ---- | --------------------------------------------------------------------------- |
| `invalid_request`       | 400  | The body is not JSON, `message` is missing, or a header is malformed        |
| `version_not_supported` | 400  | `CAP-Version` is not implemented                                            |
| `unauthorized`          | 401  | The bearer token is invalid, expired, or revoked                            |
| `forbidden`             | 403  | The token was issued to a different agent than `CAP-From`                   |
| `not_found`             | 404  | The message, confirmation, or `previous_message_id` does not exist, has expired, or is not visible to this caller |
| `conflict`              | 409  | `previous_message_id` is still `working`, or the thread is too long          |
| `rate_limited`          | 429  | The owner will not take more from this caller now. `Retry-After` is set     |
| `unavailable`           | 503  | The agent is not answering                                                  |

These are request errors. A message that was accepted and could not be answered is `failed`, with its own `error`.

## Relationship to other protocols

| Layer             | Protocol | Role                                                                   |
| ----------------- | -------- | ---------------------------------------------------------------------- |
| Tools and data    | MCP      | An agent reaching its own tools, inside one boundary                   |
| Agent integration | A2A      | Agents that integrate with each other: agent cards, tasks, streaming   |
| Company directory | Personal Agent Protocol | What a company offers personal agents: sign-in, sessions, APIs, website, and which agents to talk to |
| Front door        | CAP      | Any agent asking a company's agent, public or logged in, from a text file and two endpoints |

CAP is the smallest of these on purpose: one file, one object, two endpoints, and common HTTP. It covers the public question and the account question. A public question needs nothing. An account question adds one OAuth token the person granted. There is no session to open and no browser to drive. An owner can serve CAP next to any of the others from the same agent. Each keeps its own discovery file (`/.well-known/agent-card.json` for A2A, `/.well-known/poppy.json` for Personal Agent Protocol), and `agent.txt` does not list them.

### Personal Agent Protocol

The Personal Agent Protocol (Poppy) and CAP do different jobs. `poppy.json` is a company's directory for personal agents: who the company is, where to sign in, which APIs and pages an agent may use, and which agents it can talk to. CAP is one of those agents: the one standing at the front door. A company can publish both, and its `poppy.json` can point to its CAP door.

Poppy lists the company's agents in `agent.protocols`, each with a `type`, an `endpoint`, and a `description`. A personal agent picks a type it supports and skips the rest (Poppy 1.0, §8.1). Poppy reserves plain names for its own extensions, so CAP is a Poppy extension named `conciergeprotocol.org/cap`, version `1`. A company lists the extension in `extensions` and the door in `agent.protocols`, with that name as the `type` and the CAP URL as the endpoint:

```json
{
  "protocol_version": "1.0",
  "organization": { "name": "Harbor Goods", "domain": "harborgoods.example" },
  "agent": {
    "protocols": [
      {
        "type": "conciergeprotocol.org/cap",
        "endpoint": "https://harborgoods.example/cap/v1",
        "description": "Products, policies, orders, and returns"
      }
    ]
  },
  "extensions": {
    "conciergeprotocol.org/cap": [{ "version": "1" }]
  }
}
```

The endpoint is the `CAP` line exactly, and the door still publishes `agent.txt`. Requests to it follow this specification, not Poppy's conversation format, and carry no `Poppy-Extensions` header. A personal agent that knows CAP reads `agent.txt` from the same domain for the `OAuth` line, then asks as in [Operations](#operations). One that does not know CAP skips the entry, so listing it costs nothing. A company that also serves Poppy's own conversations lists both entries, and the personal agent chooses.

The two cover different callers. A personal agent that looks for `poppy.json` first finds the door there. Any other agent, such as a coding assistant or a browser agent, finds it from `agent.txt`. Neither has to know the other protocol exists.

**Account questions.** A company can log people in for both from one authorization server. The `OAuth` line in `agent.txt` names the same issuer Poppy uses, and that issuer's `protected_resources` lists the CAP URL, as [Discovery](#discovery) requires. A personal agent signs in with the redirect login, using its Poppy client metadata document as its `client_id` with `cap_from` added. The token is bound to that `CAP-From`, as for any other caller. CAP's `read` and `write` scopes, and its [confirmations](#confirm-an-action), apply on the CAP door whatever Poppy scopes the same person granted elsewhere.

### A2A

An owner can serve both A2A and CAP from the same agent. A CAP message maps onto an A2A task:

| CAP                         | A2A 1.0                                       |
| --------------------------- | --------------------------------------------- |
| Send a message              | `SendMessage` with `returnImmediately: true`  |
| Read a message              | `GetTask`                                     |
| `working`, `done`, `failed` | `TASK_STATE_WORKING`, `_COMPLETED`, `_FAILED` |
| `reply`                     | A text part on the task's result              |
| `previous_message_id`       | Sending with the earlier task's `contextId`   |

Version 1 ships as the `/cap/v1` HTTP surface above.

---

Copyright 2026 Tony Spiro. Licensed under [CC BY 4.0](https://github.com/conciergeprotocol/cap/blob/main/LICENSE-SPEC). Attribute as: "Concierge Agent Protocol (CAP), by Tony Spiro, https://conciergeprotocol.org." "CAP" and "Concierge Agent Protocol" are trademarks of Tony Spiro. See [TRADEMARKS.md](https://github.com/conciergeprotocol/cap/blob/main/TRADEMARKS.md).
