# ATIP 2: HTTP Binding (`atip/2`)

Status: **2.0.0-draft**, 2026-12-01. Normative binding for the HTTP transport of `spec/core.md`.

Contents: 1 Scope and mapping summary · 2 Routes, methods and request framing · 3 Response framing, step rendering and
exchanges · 4 Outcome and HTTP status mapping · 5 Discovery and derived OpenAPI 3.1 · 6 Streams over Server-Sent Events ·
7 Accepted work and monitors · 8 Conformance and checker verification.

---

## 1. Scope and mapping summary

1.1. **Purpose.** This document specifies how an `atip/2` tool exposes operations over HTTP (RFC 9110): how operation ids
map to routes under a deployment base prefix `{base}`, how requests and responses carry the input document and the
response envelope in structured mode, how error conditions map to HTTP status codes, how streams travel as Server-Sent
Events (SSE), and how an OpenAPI 3.1 document is derived mechanically from the `schema` catalog.

1.2. **Summary of HTTP mappings.**

| Aspect | Core (`spec/core.md`) | HTTP binding | Section |
|---|---|---|---|
| Operation `finding_close` | Operation id (`_`-separated words) | `POST {base}/finding/close` | 2.1 |
| Group route `finding` | Refused, `OPERATION_REQUIRED` | `POST {base}/finding` → HTTP 400, failure envelope with `OPERATION_REQUIRED` | 2.1, 4.1 |
| Unknown route | Refused, `OPERATION_NOT_FOUND` | HTTP 404, failure envelope with `OPERATION_NOT_FOUND` | 2.1, 4.1 |
| Input document (including control arguments) | One JSON object | Request body (`Content-Type: application/json`); empty body treated as `{}` | 2.2 |
| Envelope | `{ok, data\|error, meta}` | Compact UTF-8 JSON response body (`Content-Type: application/json`), on both 2xx and 4xx/5xx | 3.1 |
| Outcome | `ok`, `error.refused`, condition | 200 (or 202 for accepted async work); deterministic 4xx/5xx per condition (Table T3) | 4.1 |
| Stream | `start`, `event`, `end` items | HTTP 200, `Content-Type: text/event-stream` (`event: start\|event\|end`, `data: <JSON>`) | 6 |
| Step `{operation, arguments}` | Transport-free step in `meta.next` | `POST {base}/<words joined by "/">` with `arguments` as JSON body | 3.3 |
| Discovery | `schema`, `skills_show` | `POST {base}/schema`, `POST {base}/skills/show`, derived `GET {base}/openapi.json`, and `/.well-known/api-catalog` (SHOULD) | 5 |

## 2. Routes, methods and request framing

### 2.1. Base prefix and operation routes (Table T1)

2.1.1. `{base}` is the URL path prefix under which a deployment serves the tool (possibly empty, such as
`https://api.example.com` or `https://api.example.com/pelago`). The contract version (`atip/2`, `2.0`) travels in
`meta.contract` and `meta.contractVersion` inside the envelope and MUST NOT appear as a URL segment (`{base}` carries no
`/v2` or `/atip2` segment required by the protocol).

2.1.2. Every operation id (`finding_close`, `billing_invoice_send`, `schema`, `skills_show`) maps to the route formed by
joining its `_`-separated words with `/` after `{base}`:

- `finding_close` → `POST {base}/finding/close`
- `billing_invoice_send` → `POST {base}/billing/invoice/send`
- `schema` → `POST {base}/schema`
- `skills_show` → `POST {base}/skills/show`

Because `_` never appears inside a word (`spec/core.md` 4.1.1), the operation id and its HTTP path convert both ways
without ambiguity.

2.1.3. A `POST` request to a route under `{base}` that names a group prefix (`POST {base}/finding`) or `{base}` itself
(`POST {base}` or `POST {base}/`) is refused with HTTP 400 and a failure envelope carrying `OPERATION_REQUIRED` and
`expected`. A `POST` request to a route under `{base}` that is neither an operation nor a group in the HTTP catalog is
refused with HTTP 404 and a failure envelope carrying `OPERATION_NOT_FOUND` and `expected` (the ids valid at the
position the path names, `spec/core.md` 4.1.2); so is a request that the
tool receives for a path outside `{base}` other than the discovery routes (5.2). These answers take their place in the
order of Table T10 (4.3): on a deployment that requires authentication, a request without a caller gets `401` instead,
so that it cannot enumerate the routes.

### 2.2. HTTP method and request parts (Table T2)

2.2.1. **Every operation uses `POST`.** Every operation in the catalog—`read`, `write` and `destructive` alike—is
invoked with HTTP `POST`. No operation argument ever travels in a URL path segment or a URL query string
(`spec/core.md` 14.3). The derived `GET {base}/openapi.json` endpoint (5.2) is the only `GET` route defined by this
binding.

2.2.2. **Request body and media type.** The request carries the core input document (`spec/core.md` 4.2) as a UTF-8
JSON object in the request body with `Content-Type: application/json` (parameters such as `charset=utf-8` are allowed).
A request **has a body** when it carries `Content-Length` above 0 or any `Transfer-Encoding` (RFC 9112 6.3), so that
the server knows before it reads a byte. A request without a body (no such header, or `Content-Length: 0`) MUST be
accepted as the empty input document `{}`, with or without `Content-Type: application/json`. A request that has a body
and whose `Content-Type` is not `application/json` is refused with `415`, even when a chunked body turns out to be empty;
a chunked body that is empty and sent as `application/json` is the empty input document `{}`.

2.2.3. **Control and reserved arguments.** All arguments—including the six control arguments (`commit`, `planDigest`,
`limit`, `cursor`, `all`, `fields`) and the other reserved arguments (`dryRun`, `idempotencyKey`, `wait`, `timeout`)—are
members of the JSON request body. No protocol-defined HTTP header (such as `If-Match`, `Idempotency-Key`, `Prefer` or
`Range`) is used to carry them.

2.2.4. **Credentials.** Credentials arrive through HTTP authentication headers (such as `Authorization: Bearer <token>`,
RFC 9110) and never as members of the JSON request body (`spec/core.md` 14.3). A request that presents a valid
credential has a **caller**; a request that presents none has no caller and is processed on (an operation that requires a
caller refuses it, step 6 of Table T10); a request that presents an invalid or expired credential is refused (step 4).
Which operations answer a request without a caller (typically `schema` and `skills_show`) is the deployment's choice; the
catalog does not record it.

## 3. Response framing, step rendering and exchanges

### 3.1. Structured mode response body (Table T4)

3.1.1. Every non-stream response—both on success (HTTP 200 or 202) and on failure (HTTP 4xx or 5xx)—has
`Content-Type: application/json` and a body consisting of one compact UTF-8 JSON response envelope
(`schema/envelope.schema.json`, `spec/core.md` 5). No protocol metadata is split into custom HTTP response headers.

3.1.2. **No RFC 9457 problem details on the wire.** Error responses carry the `atip/2` failure envelope
`{ok: false, error, data?, meta}` with `Content-Type: application/json`, never `application/problem+json`. This keeps
one failure schema across CLI, HTTP and MCP and preserves `error.refused`, partial `data` and `meta.next`. (A gateway or
edge proxy that must expose RFC 9457 to non-ATIP consumers may derive a problem-details object outside this binding from
the HTTP status, the registry's `meaning` as `title`, `error.message` as `detail`, and the envelope as extension
members.)

### 3.2. Preview, commit, paging and field selection (Tables T5, T6)

- **Preview and commit (`spec/core.md` 7.5, Table T5)**: A `POST` to a `destructive` operation's route without
  `"commit": true` in the body computes the preview plan, changes nothing, and returns HTTP 200 with the preview
  envelope (`data.planDigest`, `data.effects`, `data.committed: false`, and the commit step in `meta.next[0]`). Sending
  `"commit": true` and `"planDigest": "…"` in the JSON body executes the plan (HTTP 200, `data.committed: true`) or, if
  the recomputed digest differs, refuses with HTTP 409 and `PLAN_STALE`.
- **Paging and field selection (`spec/core.md` 8, Table T6)**: `"limit"`, `"cursor"`, `"all"` and `"fields"`
  (`["a", "b.c"]`) are passed as members of the JSON request body. The response carries `meta.page`, `meta.fields` and
  the next-page step in `meta.next`; no HTTP `Link` header is used. A bad cursor (`CURSOR_INVALID`, `field` `"/cursor"`)
  returns HTTP 400.

### 3.3. Rendering a step `{operation, arguments}` to an HTTP request (Table T9)

A caller renders a core step `{operation, arguments}` into an HTTP request by:

1. Replacing each `_` in `operation` with `/` and appending the result to `{base}/`:
   `POST {base}/<words joined by "/">`.
2. Setting `Content-Type: application/json` and serialising `arguments` (or `{}` when `arguments` is omitted) as the
   UTF-8 JSON request body.

## 4. Outcome and HTTP status mapping

### 4.1. Condition-to-status mapping (Table T3)

`ok` is `true` if and only if the HTTP status code is `200` (or `202` for an accepted async start, 7.1). On failure
(`ok: false`), the HTTP status code is determined strictly by `error.code` and its condition (`spec/core.md` 6.2,
6.4) or by the framing failure rule of 4.3 (Table T10), and is never chosen ad hoc at a call site:

| Outcome, condition or core code | `error.refused` | HTTP status | Required response headers |
|---|---|---|---|
| Success (`ok: true`, non-async or monitor) | — | `200 OK` | `Content-Type: application/json` (or `text/event-stream` for a stream, 6.1) |
| Accepted async start (`ok: true`, `async` operation, 7.1) | — | `202 Accepted` | `Content-Type: application/json` |
| `INVALID` (`INPUT_INVALID`, `CURSOR_INVALID`, etc.) | `true` | `400 Bad Request` | `Content-Type: application/json` |
| `REQUIRED` (except `AUTHENTICATION_REQUIRED`) | `true` | `400 Bad Request` | `Content-Type: application/json` |
| `AUTHENTICATION_REQUIRED` | `true` | `401 Unauthorized` | `Content-Type: application/json`, `WWW-Authenticate` (RFC 9110; 4.3.4) |
| `DENIED` | `true` | `403 Forbidden` | `Content-Type: application/json` |
| `NOT_FOUND` (`OPERATION_NOT_FOUND`, etc.) | `true` | `404 Not Found` | `Content-Type: application/json` |
| `EXISTS`, `CONFLICT`, `STALE`, `EXPIRED` (`INPUT_CONFLICT`, `PLAN_STALE`, `IDEMPOTENCY_KEY_CONFLICT`, etc.) | `true` | `409 Conflict` | `Content-Type: application/json` |
| `TOO_LARGE` (`INPUT_TOO_LARGE`, etc.) | `true` | `413 Content Too Large` | `Content-Type: application/json` |
| `CORRUPT` | `true` | `500 Internal Server Error` | `Content-Type: application/json` |
| `FAILED`, `INCOMPLETE`, `INTERNAL`, `UNVERIFIABLE` | `false` | `500 Internal Server Error` | `Content-Type: application/json` |
| `UNSUPPORTED` | `true` | `501 Not Implemented` | `Content-Type: application/json` |
| `UNAVAILABLE` (including rate or quota limits that clear with time) | `true` | `503 Service Unavailable` | `Content-Type: application/json`; `Retry-After` when the delay is known |
| `TIMEOUT` (monitor with `wait: true` whose wait timed out, 7.2) | `false` | `504 Gateway Timeout` | `Content-Type: application/json` |

### 4.2. Status semantics notes

1. **`error.refused` is authoritative over 4xx vs. 5xx.** Because `UNSUPPORTED` (501), `CORRUPT` (500) and `UNAVAILABLE`
   (503) map to 5xx statuses even though they are refusals (`error.refused: true`), a caller MUST inspect
   `error.refused` in the envelope—never the 4xx/5xx class alone—to know whether the operation refused before starting.
2. **One status per condition.** Rate and quota limits use condition `UNAVAILABLE` and return `503 Service Unavailable`
   (with `Retry-After` when known), never `429`. An error's `reason` never changes the HTTP status code.
3. **Check verdicts on HTTP.** A check operation whose negative verdict is an ordinary domain result SHOULD report that
   verdict inside `data` with `ok: true` and HTTP `200`, rather than failing with a `<SUBJECT>_FAILED` code (which maps
   to HTTP `500`, `spec/core.md` 6.2.2).

### 4.3. Request processing order (Table T10)

A server evaluates a request in the order of Table T10. The first step that fails answers, and no later step is
evaluated, so a request with two faults is answered for the earlier one. Every answer of the table has a compact failure
envelope with `Content-Type: application/json`. The steps up to 8 are step 1 of `spec/core.md` 4.4 on this binding;
step 9 is its steps 2 and 3.

| Step | Fails when | HTTP status | `error.code` and `reason` | Additional headers / fields |
|---|---|---|---|---|
| 1. Method | The method is not `POST`. The two discovery routes, `{base}/openapi.json` and `/.well-known/api-catalog`, take `GET` and `HEAD` instead, and answer a request whatever its query string or body (5.2); any other method on them fails | `405 Method Not Allowed` | `INPUT_INVALID`, reason `SYNTAX`, `field` `""` | `Allow: POST` (`Allow: GET, HEAD` on the two discovery routes) |
| 2. Media type | On a `POST` route, the request has a body (2.2.2) and `Content-Type` is not `application/json` | `415 Unsupported Media Type` | `INPUT_INVALID`, reason `SYNTAX`, `field` `""` | — |
| 3. Query string | On a `POST` route, the URL has a non-empty query string; this holds for every path, so `POST /nope?a=1` is `400` | `400 Bad Request` | `INPUT_INVALID`, reason `SYNTAX`, `field` `""` | — |
| 4. Credential | A credential is presented and is invalid or expired, on any route, the discovery routes (5.2.2) included. A request that presents none goes on with no caller | `401 Unauthorized` | `AUTHENTICATION_REQUIRED`, reason `INVALID` or `EXPIRED` | `WWW-Authenticate` |
| 5. Route | The route names no operation: a group or `{base}` itself, or neither an operation nor a group, or a path outside `{base}` (2.1.3). When the request has no caller and the deployment requires authentication for any operation, both answer `401` instead | `400 Bad Request` or `404 Not Found`; `401 Unauthorized` without a caller as above | `OPERATION_REQUIRED` or `OPERATION_NOT_FOUND`, with `expected`; `AUTHENTICATION_REQUIRED`, reason `MISSING` | `WWW-Authenticate` on `401` |
| 6. Caller | The operation requires a caller and the request has none. Which operations answer without a caller is the deployment's choice (2.2.4). The answer is the one of step 5 for an unknown route (4.3.3) | `401 Unauthorized` | `AUTHENTICATION_REQUIRED`, reason `MISSING` | `WWW-Authenticate` |
| 7. Size | The body exceeds the operation's `input.maxBytes`: judged on `Content-Length` before the body is read when the request declares it, else by reading at most `input.maxBytes + 1` bytes and refusing when that many arrive (4.4) | `413 Content Too Large` | `INPUT_TOO_LARGE`, reason `TOO_MANY_BYTES`, `field` `""` | `Connection: close` (4.4) |
| 8. Body | The body is not UTF-8 JSON; the body is JSON and not an object (an array, a string, a number or `null`) | `400 Bad Request` | `INPUT_INVALID`, reason `NOT_JSON`; `INPUT_INVALID`, reason `NOT_OBJECT`; `field` `""` | — |
| 9. Input | An unknown argument, a wrong value type, a missing required argument, a domain, constraint or validator violation (`spec/core.md` 4.4 steps 2 and 3) | Status of the code (`400` for `INPUT_INVALID`) | `INPUT_INVALID` (or the declared code) with its reason (`UNKNOWN_ARGUMENT`, `MISSING_ARGUMENT`, `INVALID_VALUE`, `CONSTRAINT`) | `error.field` set to the JSON Pointer |

4.3.1. `meta.operation` follows the route (`spec/core.md` 5.6): the answers of steps 1 to 5 have none, except
`OPERATION_REQUIRED` for a group, which carries the group id (it is reached only when the caller is authenticated or the
deployment is open, because step 5 answers `401` otherwise); every answer from step 7 on carries the operation id, a `413`
and a body that is not JSON or not an object included. No `AUTHENTICATION_REQUIRED` carries one. `meta.schemaVersion` of a
failure that carries an operation is the version of the output the request would have produced (`spec/core.md` 5.8), and
`"1.0"` of every other.

4.3.2. An unhandled crash before an envelope can be constructed answers `500 Internal Server Error` with any body.

4.3.3. **The two `401 MISSING` answers are one answer.** A request without a credential that names an unknown route or a
group (step 5) and a request without a credential that names a known operation the deployment keeps closed (step 6) are
answered with the same status, the same headers (`Content-Type` and the same `WWW-Authenticate` challenge) and the same
envelope: `AUTHENTICATION_REQUIRED`, reason `MISSING`, the same `message`, no `hint`, no `field`, no `expected`, and no
`meta.operation`. Only the members of `meta` that match `^x-` (`spec/core.md` 12.7.2), such as a request identifier, may
differ. Any difference would let a caller without a credential tell which routes exist.

4.3.4. **The `WWW-Authenticate` challenge.** The authentication scheme is the deployment's. When it is `Bearer`, the
challenge of every `401` follows RFC 6750 section 3: it is never a bare `Bearer` and carries at least `realm` or another
auth-param (`Bearer realm="acme"`); it carries no `error` attribute when the request presented no bearer credential
(reason `MISSING`); and it carries `error="invalid_token"` when the credential is invalid or expired (reason `INVALID` or
`EXPIRED`): `Bearer realm="acme", error="invalid_token"`. A challenge of another scheme is the deployment's own.

### 4.4. Bodies without a declared length

4.4.1. A body that declares no `Content-Length` (a chunked body) is read until it ends or until `input.maxBytes + 1` bytes
have arrived. In the second case the server stops reading, refuses with step 7 (`413`) and does not read the rest. The
server SHOULD close the connection after that answer (`Connection: close`), as it should after a `413` it gave on a
declared `Content-Length` without reading the body: the rest of the request is still on the connection.

## 5. Discovery and derived OpenAPI 3.1

### 5.1. Authoritative discovery (`POST {base}/schema` and `POST {base}/skills/show`, Table T11)

5.1.1. At L1, `POST {base}/schema` serves the `schema` operation (`spec/core.md` 12.1), with `data.binding: "http"` in
its `tree` answer. In the HTTP catalog:

- Every operation with a `valueType: "path"` argument is omitted (`spec/core.md` 12.2.2).
- No argument carries a `cli` member, and no operation or output carries `input.batch`, `input.maxItems`,
  `output.batch`, `kind: "artifact"` or `mediaType` (`spec/annex-design.md` S2 rule 17).
- `schema` (and `skills_show` at L2) are included in `tree.operations` with their own operation documents and `schemas`
  answers.

5.1.2. At L2, `POST {base}/skills/show` serves the guide operation `skills_show` (`spec/core.md` 12.8).

### 5.2. Derived OpenAPI 3.1 document (`GET {base}/openapi.json`, Table T11)

5.2.1. At L1, the server MUST serve `GET {base}/openapi.json` returning an OpenAPI 3.1 (`"openapi": "3.1.1"`) JSON
document with `Content-Type: application/json`. The OpenAPI document is a pure deterministic function of the HTTP
`schema` catalog and error registry, in catalog order, and is never hand-written:

1. **Top-level metadata (`info` and `x-atip`)**:
   - `openapi`: `"3.1.1"`.
   - `info.title`: the tool name (`meta.tool`).
   - `info.version`: the tool version (`meta.toolVersion`).
   - `info.description`: the L1 form is `"<tool> over HTTP: every operation is a POST with a JSON body. The operation
     schema describes every operation, argument and error."`; the L2 form adds the guide:
     `"<tool> over HTTP: every operation is a POST with a JSON body. The operation schema describes every operation,
     argument and error; the guide is the operation skills_show."` (`<tool>` is `meta.tool`).
   - `info.x-atip`: `{"contract": "atip/2", "contractVersion": "<declared minor>", "level": "<L1|L2>"}`.
2. **Paths (`paths`)**: One path entry `/{words joined by "/"}` per operation in `tree.operations` (groups have no path
   entry), in the exact order of `tree.operations`, each holding a single `post` operation object:
   - `operationId`: the operation id (`finding_close`).
   - `summary`: the operation's `summary`.
   - `description` (when `effectNote` is present): `effectNote`.
   - `x-atip-effect`: the operation's `effect` (`"read"`, `"write"`, `"destructive"`).
   - `x-atip-idempotency` (when `idempotency` is present): the operation's `idempotency`.
   - `requestBody`: `{"required": true, "content": {"application/json": {"schema": <derived Input schema>}}}`, where
     `<derived Input schema>` is the operation's `Input` schema from `schema` (`{"operation": "<id>", "schemas": true}`).
3. **Responses (`responses`)**:
   - **Success response**: status `"202"` when the operation declares `async` (7.1), otherwise `"200"`, with the fixed
     `description` of Table T12:
     - For a `report` output: `"content": {"application/json": {"schema": {"type": "object", "required": ["ok", "data",
       "meta"], "properties": {"ok": {"const": true}, "data": <dataSchema>, "meta": <MetaFragment>}}}}`, where
       `<dataSchema>` is `{"$ref": "#/components/schemas/<operationId>.<Name>"}` for a single report output or
       `{"oneOf": [...]}` for several report outputs.
     - For a `stream` output: status `"200"` with `"content": {"text/event-stream": {"schema": {"type": "string"},
       "x-atip-stream": {"eventRef": "#/components/schemas/<operationId>.<EventName>", "schemaRef":
       "#/components/schemas/<operationId>.<ResultName>"}}}`.
   - **Error responses**: one response entry (in ascending status order) for each HTTP status code that the operation's
     declared `errors` plus its implied core codes (`spec/core.md` 12.5.2, excluding the CLI-only `INPUT_CONFLICT`
     and `BATCH_INCOMPLETE`) map to under Table T3 (4.1), and for `415`, with the fixed `description` of the table below
     and `"content": {"application/json": {"schema": {"$ref": "#/components/schemas/FailureEnvelope"}}}`. Every
     operation therefore lists at least `400`, `401`, `404`, `413`, `415` and `500`. `401` is listed although a
     deployment that reads no credential never answers it: `AUTHENTICATION_REQUIRED` is a universal core code. `405` is
     never listed: an OpenAPI response belongs to a method, the path item holds only `post`, and the wrong-method answer
     is not an answer of that method.
4. **Status descriptions (Table T12).** The `description` of every response is fixed by its status:

   | Status | `description` |
   |---|---|
   | `200` | `Success` |
   | `202` | `Accepted: the work was started and is not done` |
   | `400` | `Refused: the request is invalid or lacks something it needs` |
   | `401` | `Refused: authentication is required` |
   | `403` | `Refused: the caller is not permitted` |
   | `404` | `Refused: a named object does not exist` |
   | `409` | `Refused: the request conflicts with the target's state or an earlier answer` |
   | `413` | `Refused: the request is too large` |
   | `415` | `Refused: the media type is not application/json` |
   | `500` | `The operation failed, or the tool did` |
   | `501` | `Refused: not supported here` |
   | `503` | `Refused: unavailable now; repeat later` |
   | `504` | `The wait ran out of time` |

5. **Components (`components.schemas`)**: holds `FailureEnvelope`
   (`{"type": "object", "required": ["ok", "error", "meta"], "properties": {"ok": {"const": false}, "error":
   <ErrorFragment>, "meta": <MetaFragment>}}`, where `<ErrorFragment>` requires `["code", "message", "retryable",
   "refused"]` and `<MetaFragment>` requires `["contract", "contractVersion", "schemaVersion", "tool", "toolVersion"]`
   with `contract: {"const": "atip/2"}`), followed by each operation's schemas from `schemas` (excluding `Input`) under
   the key `"<operationId>.<Name>"`, with internal `#/schemas/<X>` references rewritten to
   `"#/components/schemas/<operationId>.<X>"` and `required` removed from object cut nodes at and below the records of
   any output declaring `fields` (`spec/annex-fields.md` F5).

5.2.2. **Discovery routes.** `GET {base}/openapi.json` answers the same document whatever its query string or body: the
route takes no argument, and neither is judged (Table T10 steps 2 and 3 apply to `POST` routes). `HEAD` is allowed on it
(RFC 9110 9.3.2): the same status and headers as `GET`, no body. Every other method answers `405` with
`Allow: GET, HEAD`. Table T10 step 4 applies to the discovery routes as to every route: a credential presented and
invalid or expired answers `401` with reason `INVALID` or `EXPIRED`. Step 6 applies where the deployment requires a
caller for discovery: the discovery routes answer a request without a caller exactly when the operation `schema` does
(2.2.4), since both serve the catalog; a request without a caller then answers `401` with reason `MISSING`.

5.2.3. **Well-known API catalog (RFC 9727).** A deployment SHOULD serve `/.well-known/api-catalog` (RFC 9727) containing
a `service-desc` link relation pointing to `{base}/openapi.json`, under the rules of 5.2.2. `atip/2` defines no custom
`/.well-known/` URI of its own.

## 6. Streams over Server-Sent Events

6.1. **SSE framing (Table T8).** When a request invokes an operation with a `stream` output and preconditions pass, the
server responds with HTTP `200 OK` and `Content-Type: text/event-stream` (WHATWG HTML Server-Sent Events). Each stream
item (`schema/stream-line.schema.json`, `spec/core.md` 10.1) is sent as one SSE event:

- `event: <type>` where `<type>` is `start`, `event` or `end`;
- `data: <compact UTF-8 JSON of the stream item>` (the full `{type, ...}` object on a single `data:` line);
- terminated by a blank line (`\n\n`).

No SSE `id:` field or `retry:` field is used, and stream resumption via `Last-Event-ID` is not supported: a stream that
disconnects before the `end` event is treated as a cut stream (`spec/core.md` 10.2).

6.2. **Outcome and pre-stream refusal.** Once the HTTP `200 OK` header and `start` event are sent, the HTTP status code
is already fixed at `200`; the operation's final outcome (`ok: true` or `ok: false`) is carried by the `result` envelope
inside the `end` event. If the operation refuses before the stream begins (`error.refused: true`), the server MUST NOT
open an SSE stream: it returns a normal `Content-Type: application/json` failure envelope with the HTTP status code from
Table T3 (4.1).

## 7. Accepted work and monitors

7.1. **Starting accepted work (Table T7).** When an operation that declares `async: {monitor: "<operation_id>"}`
(`spec/core.md` 9.1) accepts work, it responds with HTTP `202 Accepted`, `Content-Type: application/json`, and the
accepted response envelope (`ok: true`, `meta.work: {id, state: "working"}`, and `meta.next[0]` pointing to the monitor
operation with `"wait": true`). The server does not set an HTTP `Location` header, because polling or waiting on the
monitor is a `POST` request with a JSON body (`{base}/<monitor words>`), not a `GET` URL.

7.2. **Calling the monitor (Table T7).** The caller checks or waits on the work by sending `POST` to the monitor
operation's route:

| Monitor call and work state | HTTP status | `ok` | Envelope summary |
|---|---|---|---|
| Without `"wait": true`, in any state (`working`, `done`, `failed`, `cancelled`) | `200 OK` | `true` | `meta.work.state` reports the state; `data` holds the status or final report |
| With `"wait": true` (and optional `"timeout": "<DURATION>"`), work reaches `"done"` | `200 OK` | `true` | `meta.work.state: "done"`, `data` is the work's report |
| With `"wait": true`, work reaches `"failed"` or `"cancelled"` | `500 Internal Server Error` | `false` | Tool's `<SUBJECT>_FAILED` or `<SUBJECT>_INCOMPLETE` code (`refused: false`), `meta.work.state` is `"failed"` or `"cancelled"` |
| With `"wait": true`, wait times out while still `"working"` | `504 Gateway Timeout` | `false` | Tool's `<SUBJECT>_TIMEOUT` code (`refused: false`, `retryable: true`), `meta.work.state: "working"`, `meta.next[0]` repeats the wait step |
| Unknown work identifier (with or without `"wait"`) | `404 Not Found` | `false` | Tool's `<SUBJECT>_NOT_FOUND` code (`refused: true`) |

## 8. Conformance and checker verification

8.1. **Levels on HTTP.** An HTTP tool claims `"ATIP 2.0 HTTP L0"`, `"ATIP 2.0 HTTP L1"` or `"ATIP 2.0 HTTP L2"` as
defined in `spec/core.md` 3.2.

8.2. **What the checker verifies on HTTP** (informative; see `approaches/checker.md`). When invoked with
`atip check --bin <BINARY> --binding http`, the checker starts the server using the fixture's `serve` entry, runs the
core checks (`spec/core.md` 3.6) through the HTTP driver (rendering steps by 3.3), and additionally verifies:

- every Table T3 status code mapping against `ok`, `error.refused` and the error code's condition (4.1), and
  `Content-Type: application/json` on every non-stream 2xx, 4xx and 5xx response (3.1);
- each step of Table T10: `405 Method Not Allowed` with `Allow: POST` on non-`POST` requests (`Allow: GET, HEAD` on the
  discovery routes, which answer `GET` and `HEAD` whatever the query or body), `415 Unsupported Media Type` when a request
  that has a body (2.2.2) has the wrong media type, `400 Bad Request` (`INPUT_INVALID`, reason `SYNTAX`) when a query
  string is present on a `POST` route, `401 Unauthorized` with an RFC 6750 `WWW-Authenticate` (4.3.4) for an invalid credential and for a missing one where the
  deployment requires a caller, the same answer for an unknown route and a closed operation without a credential (4.3.3), `413 Content Too Large` when the body exceeds `input.maxBytes` (on `Content-Length`,
  before the body is sent), and `400 Bad Request` when JSON is malformed (`NOT_JSON`, `NOT_OBJECT`); and their order,
  with two faults in one request (4.3);
- `202 Accepted` on `async` start and `200`/`500`/`504`/`404` on the monitor operation (7);
- `200 OK` with `Content-Type: text/event-stream` and `start`/`event`/`end` SSE events on stream operations, plus JSON
  failure responses when a stream refuses before starting (6);
- equality of `GET {base}/openapi.json` with the document derived from the `schema` catalog, and the `info.description`
  pointer to `schema` (5.2);
- when checked together with the CLI or MCP binding of the same tool, parity of catalog operation documents (apart from
  `cli`) and response envelopes across reachable operations.
