HTTP API
The complete inbound surface of acdp-registry. Routes are assembled in
build_router() (crates/acdp-registry-core/src/lib.rs); handlers live under
crates/acdp-registry-core/src/handlers/.
Endpoint summary
| Method | Path | Auth | Built when |
|---|---|---|---|
| GET | /.well-known/acdp.json | none | always |
| GET | /.well-known/jwks.json | none | always |
| GET | /.well-known/did.json | none | always (404 unless [receipt] configured) |
| GET | /healthz | none | always |
| GET | /livez | none | always |
| GET | /metrics | optional scrape bearer | metrics.enabled |
| POST | /contexts | producer signature | always |
| GET | /contexts/{ctx_id} | optional bearer | always |
| GET | /contexts/{ctx_id}/body | optional bearer | always |
| GET | /contexts/search | optional bearer | always |
| POST | /contexts/{ctx_id}/retract | producer-signed event | always (501 unless lifecycle.enabled) |
| POST | /contexts/{ctx_id}/republish | producer-signed event | always (501 unless lifecycle.enabled) |
| GET | /lineages/{lineage_id} | optional bearer | always |
| GET | /lineages/{lineage_id}/current | optional bearer | always |
| GET | /log/checkpoint | none | always (501 unless log.enabled) |
| GET | /log/proof | optional bearer | always (501 unless log.enabled) |
| GET | /log/entries | optional bearer | always (501 unless log.enabled) |
| GET | /changes | optional bearer | always (501 unless changes.enabled) |
| POST | /subscriptions | bearer | always (501 unless events.enabled) |
| GET | /subscriptions/{subscription_id} | bearer | always (501 unless events.enabled) |
| DELETE | /subscriptions/{subscription_id} | bearer | always (501 unless events.enabled) |
| POST | /key-attestations | — | 501 unless keyless.enabled (off by default): mint a key attestation (RFC-ACDP-0021 §5) |
| GET | /key-attestations | — | 501 unless keyless.enabled: list a controller's attestations, newest first (§5.4) |
| POST | /auth/challenge | none | auth.enabled |
| POST | /auth/token | challenge signature | auth.enabled |
| POST | /auth/token/revoke | bearer | auth.enabled |
| GET | /admin/status | admin bearer | always |
| GET | /admin/lineages/{lineage_id}/audit | admin bearer | always |
| POST | /admin/contexts/{ctx_id}/retract | admin bearer | always (501 unless lifecycle.enabled) |
| POST | /admin/contexts/{ctx_id}/republish | admin bearer | always (501 unless lifecycle.enabled) |
| GET | /admin/contexts | admin bearer | playground feature |
| POST | /admin/pinned-keys/reload | admin bearer | playground feature |
The /auth/* routes are mounted at runtime only when auth.enabled = true. The
two /admin/{contexts,pinned-keys} routes are compiled in only with the
playground Cargo feature; /admin/status always ships.
Media types and middleware
Every ACDP data and auth endpoint returns application/acdp+json — on both
success bodies and error envelopes (RFC-ACDP-0007 §4). /.well-known/jwks.json
returns application/jwk-set+json; /healthz, /livez and /admin/* return
plain operational JSON.
All requests pass through, outermost first: a media-type backstop that stamps
application/acdp+json on any response that set none; request-id assignment
(x-request-id, a UUIDv4 minted if absent, propagated downstream, and present
on every response including the ones the middleware generates itself); an
envelope backstop that gives a 413 the RFC-ACDP-0007 §4 error body; the CORS
layer (off unless registry.cors.allowed_origins is populated or
registry.cors.public_reads is set, see CONFIGURATION); a
RequestBodyLimitLayer capped at limits.max_payload_bytes (so even
unauthenticated /auth/* calls can't push oversized JSON); a 30 s
TimeoutLayer; and TraceLayer. When metrics.enabled, a request-metrics
layer sits innermost of these, recording count/latency/status by matched route —
so observed latency covers the router and its per-route layers and excludes the
stack above it.
The request-id layers sit outside the body limit, the timeout and CORS on
purpose: a 413, a 408 or a CORS preflight is generated by those layers
themselves and never reaches the router, so an id assigned any deeper would be
missing from exactly the failures an operator most needs to correlate.
The /auth/* subrouter additionally carries the FEAT-06 per-IP + process-global
rate limiter ([rate_limit]): it admits or rejects a request with 429 +
Retry-After before any DID resolution, keyed by the resolved client IP
(TCP peer, or the trusted-proxy X-Forwarded-For policy). It runs as a
route_layer on the three /auth/* routes only, ahead of their handlers and
body extractors, so every request it admits is charged whatever the handler
then answers (a 415 or 400 included). It checks the global ceiling first,
then the per-IP budget. With the default rate_limit.backend = "memory" both
are counted per process. With backend = "postgres" the in-memory limiter
stays in front as a pre-filter and an admitted check is then counted once
across every replica sharing the database (see
CONFIGURATION.md · [rate_limit]); a
shared-counter denial is the same 429 with the database's own Retry-After.
If the database cannot answer, backend_unavailable = "allow" (the default)
admits the request on the per-process check alone, while "deny" refuses it
with 429 and Retry-After: 5.
Request bodies and Content-Type
The body-bearing routes gate the request Content-Type before reading the
body. Accepted on all of them: application/json or any application/*+json
type (so application/acdp+json), with parameters such as ; charset=utf-8
ignored. Anything else that is present — text/plain, application/xml, an
empty value — is 415 unsupported_media_type. The routes differ only on an
absent header:
| Route family | No Content-Type | Wrong-shaped or non-JSON body |
|---|---|---|
POST /contexts | accepted (treated as JSON) | 400 schema_violation |
POST /contexts/{ctx_id}/retract, POST /contexts/{ctx_id}/republish | accepted | 400 schema_violation (400 immutable_field for a body-content member) |
POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republish | accepted (the body is optional) | 400 schema_violation |
POST /auth/challenge, POST /auth/token, POST /auth/token/revoke | 415 unsupported_media_type | 400 schema_violation (never 422) |
Accepting an absent header on the publish and lifecycle routes is a
deliberate choice (POST /contexts never required it, and rejecting it
would break every publisher that omits it); /auth/* has always required
it. On every route an oversized body is 413 payload_too_large, and a search
query string that does not parse (for example GET /contexts/search?limit=abc)
is 400 schema_violation (GET /admin/contexts parses its query with plain
axum, so a malformed one answers axum's plain-text 400). These rejections carry the error envelope below, not
plain text. POST /admin/pinned-keys/reload takes no body.
Rate limits (429)
Every 429 is rate_limited with a Retry-After header (whole seconds,
never 0). Each limiter is a fixed 60-second window, and the sources are:
| Source | Applies to | Keyed by | Configured by |
|---|---|---|---|
/auth/* global ceiling | all three /auth/* routes | — | rate_limit.global_per_minute (default 6000) |
/auth/* per-IP budget | all three /auth/* routes | resolved client IP | rate_limit.per_ip_per_minute (default 60) |
Shared backend unavailable, backend_unavailable = "deny" | all three /auth/* routes | — | Retry-After: 5, fixed |
| Challenge global ceiling | POST /auth/challenge | — | 64 × limits.challenge_rate_per_minute |
| Challenge per-agent budget | POST /auth/challenge | the requested agent_id | limits.challenge_rate_per_minute (default 60) |
| Publish per-agent budget | POST /contexts | the signing agent_id | limits.publish_rate_per_minute (default 60) |
| Lifecycle per-agent budget | POST /contexts/{ctx_id}/retract, /republish | the event actor | the same per-agent bucket as publish |
| Keyless per-IP budget | POST /key-attestations | resolved client IP | keyless.rate_per_ip_per_minute (default 30) |
| Keyless per-identity budget | POST /key-attestations | the workload identity (type, issuer, subject) | keyless.rate_per_identity_per_minute (default 10); charged only after the token verifies |
| Anonymous read budget | every data-plane GET/HEAD (contexts, search, lineages, /log/*, /changes, GET /subscriptions/{id}, GET /key-attestations) | resolved client IP (an IPv6 client by its /64) | read_limits.anonymous_per_minute (default 600) when read_limits.enabled |
| Authenticated read budget | the same routes, with a valid bearer token | the requester DID | read_limits.authenticated_per_minute (default 1200) when read_limits.enabled |
The read budgets (RFC-ACDP-0008 §4.3) are off by default. When on, the read
is refused before its handler runs, so a throttled read is always 429,
never a 404 or 403. HEAD draws on the same budget as GET. A request
carrying a present but invalid bearer token is charged to its client IP and
then refused 403 as usual, so rotating bad tokens buys no extra budget.
Capabilities, did.json, JWKS, /healthz, /livez, /metrics, /admin/*
and /auth/* are never read-limited. The read budgets are per process.
"Resolved client IP" is the same for every per-IP budget (/auth/*, keyless
and anonymous reads): it is the TCP peer, or the X-Forwarded-For hop allowed
by rate_limit.forwarded_header_trust (see
CONFIGURATION.md).
The admin lifecycle routes have no registry-side rate limit. The challenge, publish and lifecycle budgets are always per process,
whichever rate_limit.backend is configured. Publish and lifecycle charge
the same way: before signature verification they only peek at the bucket
(an agent already over budget gets 429; nothing is charged and no bucket is
created), and the request is charged once its signer is proven (see
POST /contexts and
the lifecycle endpoints).
A lifecycle request is charged to its event actor once the event is proven
— the context is visible to the caller, the actor is its producer, and the
event signature verifies — and from then on on every exit, including a 409,
a store error and a byte-identical replay. An unsigned or mis-signed event
naming an agent therefore spends nothing from that agent's budget, and does
not create a bucket; nor does an event refused before its signature is
checked (an unknown or invisible context, an actor that is not the producer).
Because the pre-verification peek answers for whatever agent a request names,
the 429s it returns are counted before verification: an unauthenticated
caller naming an agent that is already over budget increments the
rejection counter (scope publish_per_agent or lifecycle_per_agent)
without being verified, so those two scopes can be inflated by anyone.
Every 429 is
counted on the rejection counter documented under
GET /metrics, labelled with the check that refused
it; a refusal because the shared backend was unavailable counts under that
check's own auth_global or auth_per_ip scope.
Metadata
Cache-Control on the data plane (#205). Every requester-relative endpoint below —
GET /contexts/{ctx_id},/contexts/{ctx_id}/body,GET /contexts/search,GET /lineages/{lineage_id},/lineages/{lineage_id}/current,GET /log/checkpoint,GET /log/proofandGET /log/entries,GET /changes, the/subscriptionsand/key-attestationsroutes, plus the publish/retract/republishPOSTs — answers withCache-Control: privateandVary: authorization, x-tenant-id, so a shared cache cannot reuse one requester's view for another (POST /subscriptionsanswersno-store, since it carries the secret).GET /changesalso varies onaccept-encoding(it is the only gzip-compressed route; see below)./auth/*,/admin/*,GET /healthz,GET /livezandGET /metricsanswerCache-Control: no-store. The three/.well-known/*documents are requester-invariant and keepCache-Control: public, max-age=300—publicis the half that matters: it is the deliberate opposite ofprivateabove, not an omission. (/.well-known/did.json's 404 arm is the one arm in that group answering a different directive:no-store, because a cached miss outlives the configuration change that would fix it. The document's own200arm ispubliclike the others. The group's405arms emit no directive at all, which is why this says "different" rather than "the only exception".)Two exceptions, stated rather than left to be discovered. (
GET /metricswas a third until #218 closed: it now answersno-storeon every arm — 200, 401 and 405 — the 401 being the one that mattered, since a cached 401 is what a shared cache would hand an authorized scraper.)
GET /log/checkpointanswersprivateeven though the checkpoint itself is requester-invariant. It inherits the data-plane posture by group membership. That is conservative, not wrong — it forgoes shared caching of a cacheable document rather than risking the reverse.- CORS preflight is not covered. An
OPTIONSrequest is answered by the CORS layer above the route layers, so it carries noCache-Control. A preflight response has no body and discloses nothing requester-specific.
The headers are emitted on every matched route regardless of status — a 405,
and a handler-produced 404 on a real path, both carry private. That is
deliberate: a 404 whose existence depends on the caller's visibility is exactly
what private is for. Unrouted paths fall through to a bare router fallback and
carry no directive.
See RECEIPTS.md for what this does and does not buy you.
GET /.well-known/acdp.json
Capabilities document. Cache-Control: public, max-age=300. The fields, their
meaning, an example, and the consumer validation rules are normative in
RFC-ACDP-0007 §3;
this section records only what this registry emits in each one
(build_capabilities in crates/acdp-registry-server/src/main.rs):
| Field | What this registry emits |
|---|---|
acdp_version | Always "0.5.0" — see below. |
registry_did | did:web: + registry.authority (a port's : becomes %3A). |
supported_signature_algorithms | ["ed25519", "ecdsa-p256"], fixed by the build; not configurable. |
supported_did_methods | auth.did_methods; may include "did:key". |
profiles | registry.profiles (default: acdp-registry-core, acdp-registry-discovery) plus the receipts, head-receipts, lifecycle, transparency-log, acdp-registry-changes ([changes]) and acdp-registry-events ([events]) profiles when their config sections enable them. |
limits | max_payload_bytes, max_embedded_bytes and idempotency_key_ttl_seconds from [limits]; change_retention_seconds, max_change_filters and max_changes_page from [changes] when it is enabled, plus max_change_bucket_length only when [changes] max_change_bucket_length is also set; max_subscriptions_per_requester from [events] when it is enabled; max_publish_per_minute is never emitted. |
supports_idempotency_key | Always true. |
anonymous_public_reads | auth.anonymous_public_reads; always present (default false). |
read_authentication_methods | ["bearer_jwt"] when auth.enabled = true, plus "bearer_static" when [[auth.read_tokens]] is configured; omitted otherwise. |
acdp_version is unconditionally "0.5.0" (RFC-ACDP-0016 §10 — anchors
handling has no admin-config gate, so its version claim always wins), but
profiles still lights up per config. The advertised version string and the
set of active capabilities are two different axes — do not infer what a
registry actually enforces from acdp_version alone; check profiles and the
response bodies instead.
How signatures are verified. Every ACDP signature check (publish, /auth/token,
lifecycle events, witness cosignatures) goes through the acdp crate. ed25519
is verified strictly, as
RFC-ACDP-0001 §5.10
requires: small-order keys and nonce points are rejected with invalid_signature
(conformance sig-004). ecdsa-p256 high-S signatures are accepted, and
signature bytes are never used as an identity, as
registries/signature-algorithms.md
requires. A lifecycle retry counts as idempotent only if it matches the stored event
byte for byte, including signature.value, so a re-sent event whose P-256 signature
was flipped to its high-S twin is rejected with schema_violation
(RFC-ACDP-0013 §6).
bearer_jwt (the /auth/* DID challenge answered with a registry-minted JWT) is the
id registered for this flow in the spec's
registries/auth-methods.md,
whose requirements are in
RFC-ACDP-0008 §6.2;
AUTHENTICATION.md maps them to this
registry. Before 0.3.0 the value was bearer-jwt, which the capabilities schema's
^[a-z][a-z0-9_]*$ rejects.
GET /.well-known/jwks.json
JSON Web Key Set for verifying this registry's JWTs. Cache-Control: public, max-age=300, Content-Type: application/jwk-set+json.
- EdDSA mode — one OKP/Ed25519 public key:
{ "keys": [ { "kty": "OKP", "crv": "Ed25519", "use": "sig", "alg": "EdDSA", "kid": "<fingerprint-or-config>", "x": "<base64url>" } ] } - HS256 mode —
{ "keys": [] }. Symmetric secrets are never published.
See AUTHENTICATION.md.
GET /.well-known/did.json (ACDP 0.2.0)
The registry's own did:web DID document, generated from [receipt] —
this is where consumers resolve the receipt verification key
(did:web:<authority> resolves to exactly this URL). The active signing
key appears in verificationMethod and assertionMethod; retired keys
([[receipt.retired_keys]]) appear in verificationMethod only, per the
RFC-ACDP-0010 §9 retention rule. Cache-Control: public, max-age=300 on the
200 arm. 404 when no receipt key is configured — and that arm answers
no-store, not public: a cached 404 would keep hiding the document from
every resolver that saw the miss once an operator configures a key.
See RECEIPTS.md.
GET /healthz
Storage readiness, plus the identity of the running build. Readiness, not
liveness: see GET /livez below for why the distinction is
load-bearing and which probe belongs on which.
200 with {"status":"ok","storage":true,"version":"..."} when the backend
responds, 503 with {"status":"degraded","storage":false,"version":"..."}
otherwise. version is present on both responses — build identity matters
most when the service is unhealthy.
The version field (#117)
GET /healthzMUST include a top-level"version": a non-empty, human-readable identifier of the running build. It SHOULD begin with the package's SemVer and MAY carry SemVer build metadata (+g<shortsha>). Consumers MUST treat it as opaque — display or equality at most, never parsing.
What it contains depends on how the binary was built:
| Build | version | Uniquely identifies the build? |
|---|---|---|
Image built by .github/workflows/docker.yml | <version>+g<shortsha> | Yes |
cargo build, cargo run, docker compose up --build, or any other build that injects no commit | <version> | No |
The commit is injected at compile time through the ACDP_BUILD_SHA build ARG.
Outside docker.yml it is unset and the field degrades to the bare package
version, which every such build shares. Every workspace crate inherits the
single workspace version from Cargo.toml (released via release-plz — see
the per-crate CHANGELOG.md files), so the bare string is shared by every
build of a given release and the +g<shortsha> suffix is what carries build
identity.
<version> is the SAME value in both rows — that is the whole point of
the table. Two builds of one release carry an identical package version and
are told apart only by the +g<shortsha> suffix, which is why the second
row cannot uniquely identify a build.
It is deliberately a placeholder rather than a literal: this table named a real version once and that is exactly how it went stale. The contrast it teaches does not depend on which number it is, only on the two rows sharing one.
acdp-control-plane serves the same flat version string shape on its own
/healthz. The two are two precision levels of one contract, not two
different fields.
For the commit on its own — and for which storage implementation was compiled
in — see the build group on
GET /admin/status, which is bearer-gated.
GET /livez
Liveness. Always 200, never touches storage. Cache-Control: no-store.
{ "status": "ok", "version": "<opaque build identifier>" }version is the same field, with the same normative rules, as
GET /healthz's — non-empty, human-readable, and
opaque to consumers. It is repeated here so a liveness probe's logs identify
the build without a second, storage-touching request. status is always the
literal "ok": a /livez that can answer at all is alive by definition, so
there is no degraded arm to report.
Why this is separate from /healthz
/healthz is readiness — it answers 503 while the database is
unreachable, which is exactly right for gating traffic and gating a deploy. It
is exactly wrong for a liveness probe: a liveness probe that sees 503 restarts
the process, and a process cannot fix an unreachable database by restarting. The
restart loop that follows also discards the in-memory webhook queue on every
cycle, and that queue has no outbox and no replay.
So: readiness probe → /healthz. Liveness probe → /livez. Pointing both at
/healthz turns a database outage into data loss. See
RAILWAY.md for the deployment-side note.
GET /metrics (FEAT-10)
Answers Cache-Control: no-store on every arm — 200, 401 and 405:
its content is authorization-relative, so a shared cache must never store any of
them. The guarantee is unconditional on purpose, and the 405 is the load-bearing
part of it: a 405 is produced by the router before any handler runs, so a
handler-set header cannot reach it — only a layer can. That layer must then be
scoped to this route rather than applied group-wide, because aux also carries
the /.well-known/* documents. Two separate constraints, both load-bearing. Stating the guarantee as "the 200 and the 401"
would let a refactor to a handler-set header satisfy this sentence verbatim while
silently dropping an arm — metrics_is_never_cacheable pins all three so that
refactor reddens instead.
Prometheus text exposition (Content-Type: text/plain; version=0.0.4). Mounted
only when metrics.enabled = true (404 otherwise). Deliberately outside the
ACDP auth pipeline and the /auth/* rate limiter so a scraper reaches it
unimpeded; when metrics.bearer_token is set the endpoint requires
Authorization: Bearer <token> and answers 401 otherwise. Exposed series:
| Metric | Type | Labels | Meaning |
|---|---|---|---|
acdp_registry_request_total | counter | route, method, status_class | HTTP requests by matched route pattern (never the resolved ctx_id). |
acdp_registry_request_duration_seconds | histogram | route, method | Request latency. |
acdp_registry_publish_total | counter | outcome | Publishes: inserted, idempotent_replay (every path), or a wire code (schema_violation, payload_too_large, …). |
acdp_registry_receipts_minted_total | counter | — | RFC-ACDP-0010 receipts minted on accepted publishes. |
acdp_registry_event_receipts_minted_total | counter | — | RFC-ACDP-0017 §10 event receipts minted: one per accepted lifecycle event, plus each earlier event receipted by fill-on-append or the startup sweep. |
acdp_registry_event_receipts_incomplete_total | counter | — | Reads by a minting registry that omitted registry_state.event_receipts because a context's history is not fully receipted. |
acdp_registry_event_receipts_sweep_skipped_total | counter | — | Contexts the startup sweep (or fill-on-append) could not complete: a NULL before a receipted event, or a corrupt stored receipt. |
acdp_registry_log_leaves_total | counter | — | RFC-ACDP-0012 transparency-log leaves appended. |
acdp_registry_lifecycle_event_total | counter | event, outcome | Retract / republish outcomes. |
acdp_registry_witness_cosignatures_total | counter | outcome | Witness cosignatures aggregated / rejected / store_error. |
acdp_registry_rate_limit_rejections_total | counter | scope | 429s by scope (auth_per_ip, auth_global, challenge_per_agent, challenge_global, publish_per_agent, lifecycle_per_agent, keyless_per_ip, keyless_per_identity, read_anonymous, read_principal). |
acdp_registry_keyless_key_fetch_total | counter | outcome | RFC-ACDP-0021 issuer key fetches (JWKS, SPIFFE bundle, OIDC discovery): ok, transport, bad_status, too_large, bad_document, bad_discovery or policy_refused (the address is outside public unicast). Emitted only with keyless.enabled. |
acdp_registry_keyless_key_stale_served_total | counter | — | Token verifications answered from an issuer key set past its TTL because the refetch failed (stale-if-error, bounded by keyless.jwks_max_stale_seconds). |
acdp_registry_rate_limit_shared_total | counter | scope, outcome | Round trips to the shared (cluster-wide) /auth/* limiter backend: scope is auth_per_ip or auth_global, outcome is allow, deny or unavailable. Counts which layer answered; a client-visible 429 still increments the rejections counter above. Emitted only when a shared backend is configured. |
acdp_registry_rate_limit_shared_seconds | histogram | scope | Latency of those round trips. The series to watch to confirm the shared limiter's database load assumption (see docs/OPERATIONS.md). |
acdp_registry_changes_requests_total | counter | outcome | RFC-ACDP-0018 GET /changes requests: ok, or the wire code (invalid_cursor, cursor_expired, schema_violation, …). |
acdp_registry_changes_rows_scanned_total | counter | — | Feed rows scanned (not returned) by GET /changes; the ratio to requests is the visibility post-filter cost. |
acdp_registry_changes_pages_byte_capped_total | counter | — | GET /changes pages ended early by the 1 MiB page-size bound (RFC-ACDP-0018 §5.2) rather than by limit or the feed head. |
acdp_registry_changes_pruned_total | counter | — | Feed rows deleted by the retention prune task. |
acdp_registry_changes_head_seq | gauge | — | Feed head seq after the last prune pass. |
acdp_registry_changes_pruned_through | gauge | — | Highest pruned seq; a cursor below it is cursor_expired. |
acdp_registry_hint_deliveries_total | counter | outcome | RFC-ACDP-0018 hint attempts. outcome is delivered, nothing_visible (matching entries the owner cannot see; the position advanced, nothing sent), failed (non-2xx, redirect, timeout, connect error), ssrf_refused (the host no longer resolves to public unicast only), unknown_key (the secret is sealed under a [changes] key_id this replica does not hold; nothing sent, retried like a failure), disabled (the attempt that disabled the subscription: 72 h of failure, a corrupt secret, an unreadable stored owner, or no tenant while auth.require_tenant is set), lease_lost (the subscription was deleted or taken over meanwhile; nothing recorded) or error (a store or evaluation error, or the attempt overran its 20 s bound; nothing recorded, retried once the lease lapses). An address refused at connect time, after the pre-check passed, counts as failed. |
acdp_registry_hint_subscriptions | gauge | status | Subscriptions by status (active, disabled), refreshed after every worker pass. |
acdp_registry_hint_oldest_due_seconds | gauge | — | Seconds the oldest active subscription behind the feed head has been due (its next_attempt_at to now), 0 when none is overdue; refreshed after every worker pass. |
acdp_registry_subscription_requests_total | counter | op, outcome | RFC-ACDP-0018 /subscriptions requests. op is create, get or delete; outcome is ok or the wire code (schema_violation, not_found, not_authorized, not_implemented, …). |
scopechanged meaning for global challenge rejections (H-A/P4). Until this change, a/auth/challengerejection caused by the process-global ceiling was labelledchallenge_per_agent— the same label as a single noisy agent. It is nowchallenge_global. If you alert onchallenge_per_agent, that series will drop by however much of its volume was actually global-ceiling rejections, and the missing volume reappears under the new label. The two are worth separating precisely because they mean opposite things operationally:challenge_per_agentis one agent to throttle,challenge_globalis a flood rotatingagent_idto defeat the per-key limit, which is the case the global ceiling exists to catch and the old label hid.The authoritative list is
RateLimitScope::ALLincrates/acdp-registry-core/src/metrics.rs; the table row above is pinned against it byevery_rate_limit_scope_is_documented.
Adding a handler needs no metrics-middleware change: request metrics are
automatic (from MatchedPath); domain counters are explicit metrics::counter!
calls in the handlers.
Contexts
POST /contexts
Publish a context. Not bearer-authed — the producer's signature over the
content_hash is the authentication. Runs the full RFC-ACDP-0003 §2.1 pipeline
(see ARCHITECTURE.md).
Request headers:
| Header | Required | Notes |
|---|---|---|
Idempotency-Key | optional | 1–256 ASCII chars; replays return the prior result within limits.idempotency_key_ttl_seconds. |
X-Run-Id | optional | ≤256 chars; correlation id echoed into the context.published webhook. |
X-Tenant-Id | optional | Selects the tenant only when no signed tenant claim (or, for writes, [[auth.tenant_agents]] binding) applies and auth.tenant_header_trust trusts the sender: none (the default in every mode since 0.4.0) never, trusted_proxies only from a listed gateway peer, any_peer always. A header that is present but untrusted, and does not simply repeat the claim/binding, is 403 not_authorized; default is 400 schema_violation. See MULTI-TENANCY.md. |
Body: an RFC-ACDP-0003 PublishRequest (JSON). Response: 201 Created with a
PublishResponse (assigned ctx_id, lineage_id, version, status, and —
on a receipts-advertising registry — the top-level registry_receipt, the
signed RFC-ACDP-0010 attestation minted atomically with the row). A
per-agent rate limit (limits.publish_rate_per_minute, default 60, keyed by
the body's agent_id) answers 429 + Retry-After when drained. Before
signature verification it is only a read-only peek: the claimed
agent_id is not yet proven, so an over-budget agent is refused but nothing
is charged and no bucket is created. The publish is charged only once the
signer's identity is proven (from then on, a later failure such as a store
error is charged too) or when the publish succeeds. A publish that fails
before its signer is proven — a bad signature, an unresolvable key, a
malformed body — costs the named agent nothing. In playground mode without a
pinned key nothing is verified, so only a successful publish is charged.
Because peek and charge are separated by the verify, concurrent publishes by
one agent can overshoot the limit by the number in flight.
Status and Location. A first successful publish answers 201 Created
(RFC-ACDP-0003 §4); an idempotent replay (same agent,
same Idempotency-Key, same content_hash) answers 200 OK with the original
response (§6.2). Both carry
Location: /contexts/<ctx_id>, a path-relative URL whose ctx_id is
percent-encoded as one path segment (acdp://host/uuid becomes
/contexts/acdp%3A%2F%2Fhost%2Fuuid, uppercase hex). A replay emits no second
context.published webhook, mints no receipt and appends no log leaf. Before
0.5.0 the response was 200 with no Location (see
UPGRADING.md).
did:key producers (ACDP 0.2.0) are verified offline — no DID-document
fetch — when "did:key" is in supported_did_methods; otherwise the publish
is rejected with key_resolution_failed (400, permanent).
anchors (RFC-ACDP-0016, still Draft) is an optional array of typed,
content-addressed references to external artifacts. Its shape, the
content-hash binding, and the version rules are normative in
RFC-ACDP-0016 §4 and
§10; the request-side version rule (a declared acdp_version of 0.5.0 or above) is RFC-ACDP-0016 §14. What this registry adds:
since it always advertises acdp_version "0.5.0", only the request half of
the gate can fail — a publish carrying anchors whose declared
acdp_version is absent or below 0.5.0 is rejected with
schema_violation (400). The check runs right after the body parses, before
the rate-limit peek and before signature verification, so it applies to every
publish path (did:key, playground pinned-key, playground unpinned, and the
default did:web pipeline) and a rejected publish is never charged. Each
anchor's uri is stored and re-served verbatim and is never dereferenced by
this registry.
GET /contexts/{ctx_id}
Retrieve a full context. Optional Authorization: Bearer <jwt> identifies the
caller for the visibility gate (RFC-ACDP-0008 §4.5). 404 when not found or
not visible to the caller (no existence oracle). If ctx_id's authority differs
from this registry's and registry.cross_registry_resolution = true, the
request is resolved against the foreign registry anonymously — only remote
public contexts are surfaced (see
OPERATIONS.md).
On a receipts-advertising registry the response carries the top-level
registry_receipt member (outside body and registry_state); contexts
published before receipts were enabled omit it (no backfill — see
RECEIPTS.md). Foreign retrievals pass the upstream's verified
receipt through verbatim, along with the upstream's registry_state and its
body exactly as the origin sent it (never re-serialized), so a consumer
recomputing content_hash over the raw body (RFC-ACDP-0001 §5.7) gets the
producer's bytes whatever timestamp spelling the producer used.
On a lifecycle-advertising registry (lifecycle.enabled, ACDP 0.3.0) a
context that has been retracted/republished carries its append-only
registry_state.lifecycle_events array (RFC-ACDP-0013 §4.1; omitted when
empty) and its status reflects the §7.2 precedence
(retracted > superseded > expired > active). Retraction is
mark-not-delete: the body of a retracted context is served unchanged.
When the registry also advertises acdp-registry-receipts and declares
acdp_version >= 0.5.0, registry_state.event_receipts runs parallel to
lifecycle_events: element i is the acdp-event-receipt/1 the registry
signed with its receipt key when it accepted event i (RFC-ACDP-0017 §10).
It is append-only, and it is served only when every event has a receipt
(omitted otherwise, including when there are no events). A byte-identical
retry of an event serves the stored receipt rather than minting another. See
RECEIPTS.md.
GET /contexts/{ctx_id}/body
As above, but returns only the context Body (no envelope metadata, and
never registry_receipt — the immutable-cache story is unchanged).
GET /contexts/search
Keyword + filter search. Optional bearer scopes which contexts are disclosable.
Query parameters (all optional):
| Param | Meaning |
|---|---|
q | Full-text query over title, summary, description, domain, tags and agent_id. On Postgres it is plainto_tsquery('english', q): English stemming (running matches "run"), English stopwords dropped, case-folded, every remaining word required (any order), no operator syntax. SQLite (FTS5 porter tokenizer plus the same stopword list) is brought to the same contract, and both backends run the same parity test; the two stemmers are different implementations and can still disagree on individual words. A query made only of stopwords (q=the) matches nothing on either. The demo memory backend differs: one case-insensitive substring match of the whole query, unstemmed, so a multi-word q is a contiguous phrase (matched over all fields joined with spaces, so it can span two fields). |
type | Context type filter. |
domain, tags, agent_id, schema_uri, derived_from | Exact-match facets. |
status | Status filter (default active). A retracted context matches only status=retracted — never the default, nor superseded/expired even where those facts also hold (RFC-ACDP-0013 §8.2). |
visibility | Narrow to public / restricted / private. |
created_after, created_before | RFC 3339 bounds on creation time. |
data_period_start_after, data_period_end_before | Bounds on the context data period. |
expires_after, expires_before | Bounds on expiry. |
limit | Page size, default 20, clamped to 100. Values above the cap are served at the cap, not rejected; 0 floors to 1. |
cursor | Opaque pagination cursor from a prior next_cursor. |
Response: a SearchResponse — { matches: [...], total_estimate, next_cursor }.
Visibility (RFC-ACDP-0008 §4.5) is enforced in the SQL WHERE clause on both
backends, and tenant narrowing is too — a tenant-scoped request is served by
ExtendedRegistryStore::search_in_tenant, which carries the tenant predicate in
the same statement as the keyset and the count. A ?visibility= narrow is still
post-filtered with a bounded refill loop (up to 6 inner pages), so a page may
return fewer than limit rows near the end of a result set even though
next_cursor is set — keep paging until next_cursor is absent.
total_estimate is returned for every caller, including a tenant-scoped one,
and it is the caller's own count. For a request that asserts a tenant it is the
number of §4.5-visible matches within that tenant — never the registry-wide
figure. It also counts only what the status filter keeps: a retracted context
is excluded from the default (active) search's matches[] and from its
total_estimate (RFC-ACDP-0013 §8.2, fixture lc-001 D). The status projection
runs in the same SQL scan as the count. Before #561 it ran afterwards, so a
retracted, superseded or expired context was still counted.
This paragraph previously documented the opposite, and the history is worth one
sentence because the field's meaning changed rather than its presence. It was
omitted from tenant-scoped responses because it was wrong: the count was
taken in the store before the handler applied the tenant predicate, so it
described rows across every tenant and handed a tenant-scoped caller a population
size for data it could not see. search_in_tenant put the predicate in the same
statement as the keyset and the count, so COUNT(*) OVER () now rides a scan
that only ever sees the caller's rows. The number is correct by construction, and
withholding it would hide a figure the caller is entitled to and which discloses
nothing.
Two things a client should not infer. The count is not the page size: with
limit smaller than the result set, total_estimate exceeds matches.len() and
is the pre-page total. And it is an estimate in name only on these backends —
COUNT(*) OVER () is exact for the scan it rides — but treat it as advisory, per
RFC-ACDP-0008, rather than as a value to paginate against.
The cursor oracle described here previously is closed. Recorded rather than deleted, because the shape of it is worth knowing and because this paragraph used to tell readers the fix had not been built.
next_cursoris unsigned plaintext base64 of{mint_ms}:{anchor_ms}:{ctx_id}, anchored on the last row the store scanned — not the last row returned. While tenant narrowing was a handler-side post-filter, the scan saw other tenants' rows, so a returned cursor could carry a foreign(created_at, ctx_id): the filter dropped the row but the anchor had already been computed from it. No post-filter can fix that, which is the whole point — dropping a row after the fact does not un-scan it.A tenant-scoped request is now served by
search_in_tenant, so the scan never sees another tenant's rows and the anchor can only ever be one of the caller's own. Cursors remain unsigned and unauthenticated, so a caller can still read and forge its own{mint_ms}:{anchor_ms}:{ctx_id}— that is a separate property, unchanged by this, and not a cross-tenant disclosure.
GET /lineages/{lineage_id}
Every version in a lineage as a FullContext array, visibility- and
tenant-filtered. Optional bearer. Each version carries its own projected
status and (under the lifecycle profile) its lifecycle_events — the
lineage array is the record, and the record includes withdrawals. Each
member also carries what its full retrieval carries (RFC-ACDP-0017 §11):
the top-level registry_receipt when one was minted and, on an event
receipts registry, registry_state.event_receipts, so a consumer can
verify a whole lineage from this one response.
GET /lineages/{lineage_id}/current
The newest version that is neither superseded nor retracted
(RFC-ACDP-0004 §5.2 as amended by RFC-ACDP-0013 §8.3 — an expired head is
still a valid head). 404 when the lineage is unknown, no version is
visible, or every version is superseded-or-retracted; retracting a linear
lineage's head therefore takes the lineage off /current entirely until
the producer republishes it or supersedes it with a fresh version.
The head is served as a full FullContext, with the same
registry_receipt, lifecycle_events and event_receipts as its full
retrieval.
When receipt.head_receipts = true (ACDP 0.3.0 / RFC-ACDP-0011) the
response additionally carries a top-level lineage_head_receipt: a
registry-signed, per-response attestation that "as of as_of, the head of
this lineage is head_ctx_id at head_version with head_status". It is
minted after head selection (so it can never name a superseded or
retracted head), signed with the RFC-ACDP-0010 receipt key, never
persisted, and never attached to body-only responses. See
RECEIPTS.md.
POST /contexts/{ctx_id}/retract, POST /contexts/{ctx_id}/republish (ACDP 0.3.0)
Lifecycle events & retraction. The request envelope, the event object, its
signing, the ordered processing steps (visibility-first resolution, closed
shape with immutable_field for body content, actor authentication,
the invalid_lifecycle_transition alternation check, atomic append), retry
idempotency and the response shape are normative in
RFC-ACDP-0013 §4,
§5 and
§6; the handler follows
§6 in order. A registry with the flag off never serves lifecycle state: it
refuses to start over a store that holds any (see
CONFIGURATION.md).
What is specific to this registry:
- Gate. Mounted always; a registry without
lifecycle.enabled = trueanswers501 not_implemented. - Signature verification goes through the same DID pipeline as a publish
—
did:webvia resolution,did:keyoffline. - Rate limit. Per-agent limiting draws on the same bucket as publish
(
limits.publish_rate_per_minute), keyed by the eventactor. After the shape and path checks the handler only peeks at the bucket (an actor already over budget gets429). After the tenant gate and the bearer check, theacdpSDK proves the event (visibility, event validation, actor == producer, signature) before it commits anything, and the request is charged between the two — on every exit from then on, including a409and a byte-identical replay. An event that fails to prove (unsigned, mis-signed, an unknown or invisible context, a403for an actor that is not the producer) is never charged. See Rate limits. - Response.
200with the post-transition full-retrieval envelope (body+registry_state,statusre-derived,lifecycle_eventsincluding the new event, and on an event-receipts registryevent_receiptsincluding its receipt).
Only the producer may use these endpoints (delegation is not supported).
Registry-initiated events go through the admin-gated
POST /admin/contexts/{ctx_id}/retract and /republish,
which attribute the event to the registry's own DID.
GET /log/checkpoint, GET /log/proof, GET /log/entries (ACDP 0.3.0)
Registry transparency log. The checkpoint object, the two /log/proof modes
and their parameters, the /log/entries shape, and the verification
procedures are normative in
RFC-ACDP-0012 §6,
§8 and
§9; the witness_signatures
aggregation envelope is
RFC-ACDP-0015 §6.1. This section records what
this registry does with them:
- Gate. Mounted always; a registry without
log.enabled = trueanswers501 not_implementedfrom every/log/*path. With it there is nolog_unavailableanywhere: every accepted publish appends its leaf in the same storage transaction as the context row and its receipt, so the proof for a context exists the moment its publish response does. - Checkpoints are signed with the
[receipt]key (no new key role);timestampis fresh per evaluation, and a/log/proofrequest for a historicaltree_sizegets a checkpoint signed at that size on demand. Publicly readable wherever capabilities are. - Witness cosignatures (ACDP 0.4.0). When
[[witnesses]]is configured and at least one verified cosignature exists for the exact(log_id, tree_size, root_hash)being served,GET /log/checkpointreturns the envelope (log_checkpointplus a siblingwitness_signaturesarray), and the checkpoint embedded in aGET /log/proofresponse carries the same sibling. With none collected the response is the bare checkpoint — the array is never fabricated or served empty. Aggregation adds no profile (stillacdp-registry-transparency-log) and does not moveacdp_version, which is"0.5.0"regardless (seeGET /.well-known/acdp.json). See CONFIGURATION.md for[[witnesses]]. - Visibility. An inclusion proof by
?ctx_id=applies retrieval visibility exactly as forGET /contexts/{ctx_id}: an unauthorized or unloggedctx_idis404 not_found, indistinguishable from absence. Proofs by?leaf_index=and consistency proofs have no visibility gate. The convenienceleafecho on/log/proof, and theleafof each/log/entriesentry, are present only when the requester is authorized to retrieve that context (public contexts: always); otherwise absent, nevernull. Leaf hashes, positions and tree size are public by design — a registry with confidentiality requirements over publication volume/timing metadata must weigh that before enabling[log]. - Limits and errors.
GET /log/entriesreturns at most 256 entries per page; continue fromstart + len(entries). Mixing the/log/proofparameter sets, omitting both, malformed integers, or out-of-range positions/sizes →400 schema_violation. A stored leaf that no longer parses surfaces asinvalid_log_prooffrom this registry's own/log/proof— see the status table.
GET /changes (ACDP 0.5.0)
The registry change feed (profile acdp-registry-changes). Entry shapes,
parameters and cursor semantics are normative in
RFC-ACDP-0018 §5 and
§6. This section records what this
registry does with them:
- Gate. Mounted always; without
changes.enabled = trueevery request is501 not_implemented. Enabling it needs lifecycle, a[receipt]key and a durable store (see CONFIGURATION.md). - What is recorded. One entry per accepted lifecycle event (
kind: lifecycle, carrying the event and its event receipt), per superseding publish (kind: superseded,ctx_idthe older version,superseded_byandregistry_receiptthe new one's), and per accepted key-revocation context (kind: key_revocation). A plain publish and an idempotent retry record nothing. Each entry commits in the same storage transaction as its change, and its evidence is byte-identical to whatregistry_state(or the new version's retrieval) serves. - Parameters.
sinceis absent (start at the oldest retained entry),head(start at the current head; returnschanges: []), or a cursor from an earliernext_cursor; an emptysince=is400 invalid_cursor.limitis a positive integer (default 100); one abovemax_changes_pageis clamped to it.ctx_id,lineage_id,agent_idandkindrepeat; the three id filters OR together andkindANDs with them, and actx_idwatch also matcheskey_revocationentries for that context's producer. More thanmax_change_filtersfilter values in total, a repeatedsince/limit, a malformed id or an unknownkind→400 schema_violation(limiterrors namedetails.field = "limit"). Unknown parameters are ignored, exceptlineage_bucketandagent_bucket(below). - Bucket filters (§6.1). Served only when
[changes] max_change_bucket_lengthis set, which advertiseslimits.max_change_bucket_length.lineage_bucketandagent_bucketrepeat; each value is 1 to that many lowercase hex digits, a prefix of lowercase hex(SHA-256(UTF-8(value))) of thelineage_idoragent_idexactly as served. They OR with each other and with the id filters,kindANDs with the result, and their values count towardmax_change_filters. The page holds the whole bucket: every visible entry whose id hashes into a requested prefix, so the consumer keeps the exact ids it watches and discards the rest. There is no key-revocation counterpart: only an exactctx_idwatch matches its producer'skey_revocationentries, so watch the producer'sagent_bucketto hear those. Visibility, refill and cursors are unchanged. Not advertised (the default), either parameter is400 schema_violationwithdetails.fieldnaming it, whatever its value, rather than being ignored; advertised, an empty, upper-case, non-hex or over-long value is the same 400. Parameters are checked before the anonymous-reader refusal below, so a malformed or unsupported bucket parameter is a 400 for an anonymous caller too. - Response.
{changes, next_cursor, has_more};next_cursoris always present, including on an empty page, and resumes strictly after the last entry returned when the page is full, otherwise after the last position scanned. Cursors are opaque, authenticated (AES-GCM under the[changes]key) and durable: they stay valid until the entry they point past is pruned. - Visibility. Entries are filtered per requester after the scan: a
lifecycleentry is visible when its context is retrievable, asupersededentry only when the new version is retrievable, and akey_revocationentry always. Hidden entries never end the feed early: the scan refills past them (up to six scan batches per request), and if that budget runs out the page comes back short withhas_more: trueand anext_cursorpast everything scanned. A short page is not the end of the feed;has_more: falseis. Actx_idwatch matches its producer's revocations only when that context is visible, so a watch never discloses who produced a hidden context. Responses carryCache-Control: private. Whenanonymous_public_readsisfalse, an anonymous request is403 not_authorized, as on search. - Page size. A serialized page body stays at or under 1 MiB
(1,048,576 bytes, measured before any content coding, RFC-ACDP-0018
§5.2) whatever
limitasks for: the page ends early withhas_more: trueand anext_cursorthat resumes at the first entry left out. A single entry larger than that on its own is served alone on its page, so the feed always moves forward. With the defaultmax_changes_page = 100real pages stay far below the bound. - Compression.
GET /changesis the only compressed route, and gzip the only coding: withAccept-Encoding: gzip(orx-gzip, or*, at any q > 0, case-insensitive) a response body of at least 32 bytes comes backContent-Encoding: gzipwithoutContent-Length; error bodies included. Every response the handler produces carriesVary: accept-encoding, whether or not it is compressed. It never answers 406: anAccept-Encodingthat rules out gzip, even one that also rules out identity (identity;q=0,*;q=0,br, identity;q=0), gets the handler's own status with an identity body (RFC 9110 §12.1, §12.5.3, §15.5.7), and a malformed header is treated as absent. A403from read authentication is never compressed. Every other route ignoresAccept-Encoding. - Retention. Entries are kept at least
change_retention_seconds(advertised; at least 30 days) and pruned oldest-first by a background task. A cursor pointing before the oldest retained entry, past the head, or minted under a key this registry does not hold is400 cursor_expired; restart fromsinceabsent orhead. A cursor that does not decode or authenticate is400 invalid_cursor. - Sequence resets (§5.3). A cursor carries the feed head it was issued at
and that row's fingerprint. After a restore that rolls
seqback, a cursor whose anchor row is gone or is now a different entry iscursor_expired, even once new entries have reused its position, so no consumer skips them. A restore also raises[changes] cursor_epoch, which expires every cursor of the earlier epoch. A cursor issued by 0.9 or earlier (the 51-character version-1 format) carries no anchor and iscursor_expiredonce; resync fromsince=head.
POST /subscriptions, GET /subscriptions/{id}, DELETE /subscriptions/{id} (ACDP 0.5.0)
Change-hint subscriptions (profile acdp-registry-events), normative in
RFC-ACDP-0018 §8.
This section records what this registry does:
- Gate. Mounted always; without
events.enabled = trueevery request is501 not_implemented, before authentication. Enabling it needs the change feed andauth.enabled(see CONFIGURATION.md). - Ownership. Every request needs a bearer; an anonymous one is
403 not_authorized. A subscription belongs to the DID that created it. Another requester's id, an id that does not exist and an id that is not a UUID are all404 not_found, so an id discloses nothing. - Create. The body is an
acdp-subscription-request: afilterwith theGET /changessemantics (at least one member, no empty or duplicate values, at mostmax_change_filtersvalues in total) and anhttpscallback_url. A filter carryinglineage_bucketoragent_bucketis400 schema_violation(details.field = "filter"), whether or notGET /changesserves bucket filters: a subscription filter has no bucket member (RFC-ACDP-0018 §8.1, §6.1). Thecallback_urlis refused unless it ishttps, names a host rather than an IP literal, and every address that host resolves to is public unicast (RFC-ACDP-0006 §7). A public IP literal is refused too: stricter than §8.3, which constrains only the resolved address. A refusal at resolution gives one fixed message, so the response never reveals what a name resolves to. A badfilter, a refusedcallback_urland a requester already holdingmax_subscriptions_per_requestersubscriptions are each400 schema_violationwithdetails.fieldset tofilter,callback_urlorlimits.max_subscriptions_per_requester. Other malformed bodies are400 schema_violation. Success is201with the subscription,status: "active", and asecretof 32 random bytes in base64, sent withCache-Control: no-store. The secret appears in this response only. The registry stores it sealed (AES-256-GCM under a key derived from the[changes]key, bound to the subscription id), never in plaintext. A new subscription hints only for changes after its creation. - Read.
GETreturns the same object withoutsecret(Cache-Control: private). - Delete.
DELETEis204. The slot it held counts toward the limit until then; a disabled subscription still holds one. - Hints. A background worker on every replica POSTs an
acdp-change-hint/1body (Content-Type: application/json, headerACDP-Signature: t=<unix seconds>,v1=<hex HMAC-SHA-256>) to thecallback_urlwhen the feed holds an entry past the subscription's last hint that matches its filter and that the owner's ownGET /changeswould return. A change the owner cannot see sends nothing. Every change since the last hint is covered by one hint, and a subscription is hinted at most once a second. The hint carries no change content: the receiver callsGET /changesitself. Each delivery re-resolves the host and refuses it unless every address is public unicast (a lookup has 5 s); the connection's own lookup is checked the same way, so an answer that rebinds in between is refused too. It follows no redirect, gives up after 10 s and never reads the response body. Any non-2xx, a redirect, a timeout or a refused address is a failure: retries back off from one minute, doubling to an hourly ceiling, and changes in the meantime coalesce into the next hint. A subscription still failing 72 hours after its first failure is disabled,GETthen shows"status": "disabled", and it is never tried again; the owner deletes and re-creates it. A delivered hint ends the failure run. Replicas share the work through 60-second store leases, so a hint is delivered by one replica.
POST /key-attestations, GET /key-attestations (RFC-ACDP-0021)
Without keyless.enabled (the default) both answer 501 not_implemented,
decided before the request is read (no body or query refusal can precede
it), and the capabilities document carries neither the
acdp-registry-keyless profile nor the keyless member. With it, both are
served as below, and the profile and the keyless member
(accepted_oidc_issuers, accepted_spiffe_trust_domains,
max_attestation_ttl_seconds) are advertised together (§13.1). See
CONFIGURATION.md and
OPERATIONS.md.
POST takes an acdp-key-attestation-request/1 body (Content-Type
JSON, under max_payload_bytes, no HTTP signature: the workload token
authenticates it) and runs RFC-ACDP-0021 §5.2 in order, stopping at the
first failure:
| Step | Failure | HTTP | code | details.reason |
|---|---|---|---|---|
| — | per-IP budget (keyless.rate_per_ip_per_minute, charged on arrival) | 429 | rate_limited | — |
| 1 | not the closed schema (a did:key controller, an X509-SVID, requested_ttl_seconds outside 1..3600, unknown member) | 400 | schema_violation | — |
| — | the identity's budget (keyless.rate_per_identity_per_minute; peeked here, charged only once the token verifies) | 429 | rate_limited | — |
| 2 | issuer or trust domain not configured | 403 | key_not_authorized | issuer_not_accepted |
| 3 | token signature, iss/sub, exp/nbf/iat, header rules | 403 | key_not_authorized | token_invalid |
| 3 | issuer's key set unreachable (no usable cached copy) | 502 | key_resolution_unreachable | issuer_unreachable |
| 3 | aud does not contain this registry's DID | 403 | key_not_authorized | audience_mismatch |
| 3 | cnf.jkt is not the presented key's thumbprint | 403 | key_not_authorized | confirmation_mismatch |
| 3 | the token already minted an attestation | 403 | key_not_authorized | token_replayed |
| 4 | pop does not verify (a P-256 pop must be 64-byte P1363; DER is refused) | 400 | invalid_signature | pop_invalid |
| 5 | algorithm is not the key's, or not in supported_signature_algorithms | 400 | unsupported_algorithm | — |
| 6 | the controller's DID document cannot be fetched | 400 / 502 | key_resolution_failed / key_resolution_unreachable | — |
| 6 | the document's AcdpKeylessSigning service does not list the identity, after one re-fetch past the cache | 403 | key_not_authorized | identity_not_authorized |
| 6 | not listed in a cached document, and the re-fetch is rate-limited | 502 | key_resolution_unreachable | — |
On success it publishes the acdp:key-attestation body under the registry's
DID, signed with the receipt key, untenanted, through the ordinary publish
path (receipt, transparency-log leaf and attestation index row in one
transaction; a token that raced another request to it is refused there as
token_replayed), and answers 201 Created with Location: /contexts/{ctx_id} and the full retrieval representation (body,
registry_state, registry_receipt). The window is
[now, min(now + requested_ttl_seconds (default 600), now + keyless.max_attestation_ttl_seconds, token exp)]. The token is never logged
or stored; token_hash is its trace.
GET /key-attestations?controller=<did:web> lists a controller's
attestations, newest first, optionally filtered by issuer and subject,
paged like search (limit default 20, at most 100; cursor from
next_cursor). Items are {ctx_id, content_hash, metadata}. A missing or
non-did:web controller is 400 schema_violation; a bad cursor is
400 invalid_cursor; an unknown controller is an empty page.
Keyless publish, supersession and lifecycle events (RFC-ACDP-0021 §6.3, §7)
With keyless.enabled, POST /contexts accepts a body whose
signature.key_id fragment begins acdp-kl- and whose key_attestation
names an attestation this registry minted. The body is checked against the
stored attestation in the publish transaction, and the receipt and
transparency-log leaf carry the attested key_fingerprint. Refusals:
| Failure | HTTP | code | details.reason |
|---|---|---|---|
a key_attestation member beside a key_id that is not acdp-kl- | 400 | schema_violation | — |
an acdp-kl- key_id with no key_attestation | 400 | key_resolution_failed | attestation_missing |
key_attestation.ctx_id is on another registry | 400 | key_resolution_failed | attestation_foreign |
nothing (or no attestation) at that ctx_id | 400 | key_resolution_failed | attestation_not_found |
key_attestation.content_hash is not the stored attestation's | 400 | key_resolution_failed | attestation_mismatch |
agent_id, key_id or algorithm is not the attestation's | 403 | key_not_authorized | attestation_mismatch |
| the attestation was retracted (withdrawn, §9.2) | 403 | key_not_authorized | attestation_withdrawn |
the registry's created_at is outside [not_before, not_after) | 403 | key_not_authorized | outside_attestation_window |
| the controller no longer lists the identity (re-checked on publish) | 403 | key_not_authorized | identity_not_authorized |
| the signature does not verify under the attested key | 400 | invalid_signature | — |
a successor's identity may not supersede its predecessor (§7: same identity, or an org_wide successor; a non-org-wide keyless body never supersedes a controller-signed one) | 403 | not_authorized | keyless_identity_mismatch |
a lifecycle event (/retract, /republish) signed under an acdp-kl- key id (R13) | 400 | key_resolution_failed | keyless_event_unsupported |
Without the profile, an acdp-kl- key id is an ordinary unresolvable key
(400 key_resolution_failed, no details). A registry advertising an
acdp_version below 0.5.0 refuses any key_attestation member as
400 schema_violation (kl-007 C); this binary advertises 0.5.0.
Auth
Mounted only when auth.enabled = true. Full flow and JWT details in
AUTHENTICATION.md.
POST /auth/challenge
Body { "agent_id": "did:web:..." } — did:key: is accepted here too.
The agent_id is checked cheaply before any storage work: it must start
with did:web: or did:key: and be 9–2048 bytes long (UTF-8 bytes, both
bounds inclusive). Anything else is
rejected 403 not_authorized (auth challenge: unsupported DID method: …) without a challenge record being written, so a client mistyping the
method cannot fill the challenge table.
Measured against a running registry:
agent_id | length | result |
|---|---|---|
did:web:a | 9 | 200 — a challenge is minted |
did:web: | 8 | 403 not_authorized |
did:key:z6MkExample | 19 | 200 — even with auth.did_methods = ["did:web"] |
did:foo:bar | 11 | 403 not_authorized |
"" | 0 | 403 not_authorized |
This is a prefix and length check only. Full DID parsing, and the
auth.did_methods capability gate, run later at POST /auth/token — so a
registry that does not list did:key in auth.did_methods will still issue a
challenge for a did:key: agent and reject it at token time. See
AUTHENTICATION.md step 5.
Returns an AuthChallenge:
{
"nonce": "<24 random bytes, url-safe base64>",
"registry_authority": "registry.example.com",
"expires_at": 1748000300,
"signing_input": "acdp-registry-auth:v1:{nonce}:{agent_id}:{authority}:{expires_at}"
}agent_id must be a did:web: or did:key: DID of 9–2048 bytes (the
screen above). Bounded by
limits.challenge_rate_per_minute (default 60) per agent_id plus a
process-global ceiling; 429 + Retry-After when drained.
POST /auth/token
Exchange a signed challenge for a JWT. Body:
{
"agent_id": "did:web:agents.example.com:my-agent",
"key_id": "did:web:agents.example.com:my-agent#key-1",
"nonce": "<from the challenge>",
"expires_at": 1748000300,
"algorithm": "ed25519",
"signature": "<base64 signature over signing_input>"
}algorithm is ed25519 or ecdsa-p256; it must match the algorithm declared
on the resolved verification method (downgrade defense). Response:
{ "token": "<jwt>", "token_type": "Bearer", "expires_at": 1748003600 }A challenge failure is 403 not_authorized. A did:web document the
registry could not reach (non-2xx, timeout, TLS failure, or a key absent from
a stale cached copy whose forced re-fetch was rate-limited) is
502 key_resolution_unreachable: retry with a new challenge. See
AUTHENTICATION.md, step 6.
POST /auth/token/revoke
Body { "jti": "<token id>" }. Requires Authorization: Bearer <jwt>; the
caller's DID must own the jti. 204 on success. 501 not_implemented if no
revocation store is configured — unreachable from the shipped binary, which
always wires one; only a library embedder building its own AppState can hit
it. See AUTHENTICATION.md.
Admin
All six /admin/* routes are bearer-gated against auth.admin_tokens
(constant-time compare; empty list disables every route that checks it):
GET /admin/status, GET /admin/lineages/{lineage_id}/audit,
POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republish,
GET /admin/contexts, and POST /admin/pinned-keys/reload. See
OPERATIONS.md.
GET /admin/status
Operational snapshot. Always shipped.
{
"build": { "version": "<version>+g83de685c2f26", "commit": "83de685c2f26",
"storage_impl": "acdp_registry_sqlite::store::SqliteStore" },
"storage": { "healthy": true },
"idempotency": { "records": 128 },
"webhook": { "enabled": true, "queue_in_flight": 0, "queue_capacity": 1024 },
"revocation": { "configured_feeds": 2 },
"migrations": { "backend": "Sqlite", "applied": true },
"tenancy": { "require_tenant": true, "tenant_header_trust": "trusted_proxies",
"tenant_header_trust_configured": true, "trusted_proxies": 1 }
}idempotency.records, the webhook queue fields (queue_in_flight,
queue_capacity) and build.commit are omitted entirely when unavailable
— they are not serialised as null. Each carries
#[serde(skip_serializing_if = "Option::is_none")]
(crates/acdp-registry-core/src/handlers/admin.rs), so a client must treat
the key as absent, not as present-with-null. A consumer doing
body["webhook"]["queue_in_flight"] === null will not match.
Measured on a local SQLite build with webhooks disabled — note webhook
carries only enabled, and build carries no commit:
{
"build": { "version": "<version>",
"storage_impl": "acdp_registry_sqlite::store::SqliteStore" },
"storage": { "healthy": true },
"idempotency": { "records": 0 },
"webhook": { "enabled": false },
"revocation": { "configured_feeds": 0 },
"migrations": { "backend": "Sqlite", "applied": true },
"tenancy": { "require_tenant": false, "tenant_header_trust": "none",
"tenant_header_trust_configured": false, "trusted_proxies": 0 }
}The tenancy group (#391)
The tenant-resolution policy the running process applies, so it can be checked without reading startup logs.
require_tenant—auth.require_tenant.tenant_header_trust— the effective mode:"none","trusted_proxies"or"any_peer"(who may sendX-Tenant-Id).tenant_header_trust_configured— whether the key was set (file or environment).falsemeans the mode is the default,none(since 0.4.0).trusted_proxies— how manyrate_limit.trusted_proxiesentries are configured: the gateway list thetrusted_proxiesmode matches against. A count only; the CIDRs are not disclosed.
The build group (#117)
The coarse version string is also served unauthenticated on
GET /healthz; the commit and the compiled-in storage
implementation are disclosed only here, behind the admin bearer.
version— identical to the/healthzvalue. Opaque; see theversionfield.commit— the injected build SHA. Omitted entirely when the binary was not built bydocker.yml(ACDP_BUILD_SHAunset). Its absence is meaningful rather than an error: it means this build is not uniquely identified, andversionis the bare package version that every such build shares.storage_impl— which store implementation was compiled in, as opposed to the runtimestorage.backendthatmigrations.backendreports. An opaque diagnostic identifier for human consumption: it is a Rust type path fromstd::any::type_name, whose output carries no stability guarantee and may change across compiler versions. Display it; do not parse it or branch on it.
GET /admin/lineages/{lineage_id}/audit (ACDP 0.2.0)
Full lineage walk as an on-demand integrity check (workstream D3): the publish path validates only against the immediate predecessor's persisted row (lineage anchoring); this endpoint re-walks the entire chain. Always shipped.
{
"lineage_id": "lin:sha256:…",
"versions": 4,
"ok": true,
"issues": [],
"receiptless_contexts": 1
}Checks: version contiguity from 1, supersedes links, the lineage_id
derivation from v1's ctx_id, producer continuity, and the
single-non-superseded-tip invariant. receiptless_contexts counts rows
without a stored receipt (informational — pre-receipts history is
legitimate; see RECEIPTS.md). 404 for an unknown lineage.
POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republish (ACDP 0.3.0)
Registry-attested lifecycle events (RFC-ACDP-0013 §6, "registry-initiated
events") — the policy/legal takedown path, distinct from the producer-signed
POST /contexts/{ctx_id}/{retract,republish}. Use when a context must be
formally withdrawn (or a withdrawal reversed) and the producer is unavailable:
the registry mints the event itself and attributes it to its own DID
(capabilities.registry_did = did:web:<authority>), not the producer.
Auth is the standard admin gate (auth.admin_tokens bearer). Requires
[lifecycle] enabled — a registry not advertising acdp-registry-lifecycle
answers 501 not_implemented (after the admin gate). Always mounted.
Request body — a closed object with one optional member (the operator supplies
only the reason; the registry mints the event_id, occurred_at, actor, and
signature):
{ "reason": "removed by policy: court order 2026-… (producer unavailable)" }An empty body is accepted (reason is optional). Any other member →
400 schema_violation.
Signing (mirrors the SDK's record_registry_lifecycle_event contract exactly):
[receipt]key configured → the event MUST be signed under the receipt key (RFC-ACDP-0013 §5; the receipts-profile MUST).signature.key_idisdid:web:<authority>#<receipt.key_id_fragment>, verifiable against the registry DID document at/.well-known/did.json.- No
[receipt]key → the event is recorded unsigned but attributed:actorstill names the registry DID, andsignatureis omitted. Consumers weight an unsigned registry event only as far as the response transport (§5). This is not a refusal — it is exactly what the SDK helper permits when no receipt signer is present.
Downstream semantics are identical to the producer path: atomic
commit_lifecycle_event, the retracted > superseded > expired > active status
projection, the strict-alternation transition check
(409 invalid_lifecycle_transition on a double-retract or a republish of a
non-retracted context), byte-identical-event_id idempotency, and the
context.retracted / context.republished webhook (with actor = the registry
DID). On success returns 200 with the full-retrieval envelope (body +
registry_state), the minted event appended to
registry_state.lifecycle_events so its registry attribution is visible to
consumers. On an event-receipts registry the event is receipted exactly
like a producer event, in the same transaction, under the same receipt key.
Cross-actor alternation is allowed. RFC-ACDP-0013 §7.1 derives retraction
state from event-type order alone (never the actor), and §6 authorizes the
producer (actor == agent_id) and the registry (actor == registry_did)
independently. So a producer may /republish a context the registry retracted,
and vice versa; both events remain in the append-only history, attributed to
their distinct actors. (The RFC is silent on actor symmetry for the reversal;
allowing it is the natural reading of an actor-agnostic §7.1 and the intended
"registry retracts by policy, producer later resolves and republishes" flow.)
GET /admin/contexts (playground feature)
Paginated dump of stored contexts for the requested tenant. Query: limit
(default 50), cursor. Returns { items: [...], next_cursor }. Tenant filter
applies at the SQL level.
Admin-bearer gated, like every other /admin/* route (see the note at the
top of Admin). The admin bearer authenticates the caller but names
no agent DID, so under the RFC-ACDP-0008 §4.5 predicate it reaches the
public arm only: visibility = 'public' rows are always included, and
restricted/private rows are never disclosed to this listing — because
admin_list (crates/acdp-registry-core/src/handlers/admin.rs) passes
public_arm_open = true to list_contexts unconditionally (its local
admin_sees_public_arm), independent of the
configured auth.anonymous_public_reads, which instead governs whether an
anonymous (no-bearer) caller of GET /contexts/search sees public rows. That
flag is carried on the CapabilitiesDocument, and RegistryServer::search
reads it
off self.caps. The tenant filter applies only when a tenant is asserted; with
none, the listing spans every tenant rather than defaulting to one (in strict mode
an unscoped listing is 403, as for any other request). On this route an
X-Tenant-Id header is honoured from the admin-bearer caller whatever
auth.tenant_header_trust says (#391): the admin credential is already
cross-tenant, so the header only narrows the listing. default is still
400 schema_violation.
POST /admin/pinned-keys/reload (playground feature)
Re-reads config from disk and hot-swaps only the [playground] section
(pinned keys). No body. Returns { "ok": true, "count": <n> }. Other config
sections require a restart.
The loaded [playground] section is validated before it is applied, against
exactly the rules the startup validator enforces (see
CONFIGURATION.md). Three failure modes,
and the distinction between the two 5xx-looking ones matters operationally:
| Status | Meaning | Live config |
|---|---|---|
403 | bearer missing, malformed, or not in auth.admin_tokens | unchanged |
400 | the config was read fine, but its [playground] section is one startup would refuse — an operator error | unchanged |
500 | the registry could not read or parse its own config file at all — a server fault | unchanged |
400 is deliberately not 500. A config typo is not an outage, and an
operator watching 5xx should not be paged for one. The 400 body names the
offending entry and states that the running configuration is unchanged:
{ "error": "rejected: the on-disk playground config is invalid and was NOT applied; the running configuration is unchanged. playground.pinned_keys[0] (did:web:agents.test:mallory): algorithm 'Ed25519' is not supported (expected one of: ed25519, ecdsa-p256). A publish from this agent that selects this entry is rejected at request time (HTTP 500, internal_error)." }Validation runs before the write lock is taken, so a rejected reload cannot half-apply: the swap is not reached at all.
Error envelope
Errors use the envelope of
RFC-ACDP-0007 §4,
emitted as application/acdp+json; its fields and when details is present
are specified there. What this registry adds: internal_error responses never
leak detail — the message is always "internal error", with the real cause in
the server log only. The /admin/* routes and /metrics do not use the
envelope; see the note under the table.
Each code's meaning and canonical HTTP status are in the spec's
error-code registry, and how an acdp client
maps each one back to a typed AcdpError (with retry guidance) is in
acdp-rs · Errors & Retries.
This page documents only what this registry answers and when.
Status / code table
| HTTP | Wire code | Raised when |
|---|---|---|
| 400 | schema_violation | Malformed body, missing field, schema mismatch. |
| 400 | hash_mismatch | Recomputed content_hash ≠ declared. |
| 400 | data_ref_hash_mismatch | An embedded/remote data_ref hash ≠ declared. |
| 400 | key_resolution_failed | DID document fetched but the key isn't usable, or the producer's did:web host was refused by the SSRF policy (a permanent, producer-caused failure). |
| 400 | immutable_field | A lifecycle request tried to supply/alter body content (RFC-ACDP-0013 §6 step 2). |
| 400 | invalid_signature | The producer signature did not verify against the resolved key. |
| 400 | unsupported_algorithm | Signature algorithm outside supported_signature_algorithms. |
| 400 | invalid_cursor | A cursor= value that does not decode or does not match its query, or a GET /changes since cursor that does not decode or authenticate. |
| 400 | cursor_expired | A structurally valid cursor whose window has passed; on GET /changes, one before the oldest retained entry, past the head, under a key or cursor_epoch this registry does not hold, issued before a sequence reset, or in the 51-character format of 0.9 and earlier. |
| 400 | superseded_target | A static supersession violation: any details.reason other than the two 409 ones below (e.g. not_found, lineage_mismatch, cross_registry_supersession_unsupported, lineage_walk_failed, revocation_type_mismatch). |
| 403 | not_authorized | Bad/expired/revoked bearer, challenge failure, an anonymous search when anonymous_public_reads is off, tenant-scope denial in strict mode, an X-Tenant-Id the registry does not trust from the sending peer (auth.tenant_header_trust). Retrieval never answers 403 for visibility: see 404. |
| 403 | key_not_authorized | The key resolved fine but is not authorized to sign for that agent. |
| 404 | not_found | Context/lineage absent or not visible to the caller — including a restricted/private context outside its audience on GET /contexts/{ctx_id} and /body, and any context for an anonymous caller when anonymous_public_reads is off. |
| 409 | duplicate_publish | Idempotency conflict: same Idempotency-Key, different content. |
| 409 | superseded_target | Only for the two race reasons: details.reason version_mismatch or already_superseded. Every other reason is 400 (row above). |
| 409 | invalid_lifecycle_transition | Double retract, or republish of a never-retracted context (RFC-ACDP-0013 §6 step 4). |
| 413 | payload_too_large | Body over max_payload_bytes. |
| 413 | embedded_too_large | Embedded data over max_embedded_bytes. |
| 415 | unsupported_media_type | A body-bearing request (POST /contexts, POST /key-attestations, the lifecycle and admin lifecycle routes, /auth/*) whose Content-Type is present but neither application/json nor application/*+json (parameters such as charset are ignored). An absent Content-Type is accepted on those routes except /auth/*, where it is also a 415. How to treat an absent header is registry choice under RFC-ACDP-0007 §4.1; this is ours. |
| 429 | rate_limited | A rate-limit bucket drained (/auth/*, challenge, publish, lifecycle, POST /key-attestations or a data-plane read; see Rate limits), or the shared /auth/* backend unavailable under backend_unavailable = "deny"; carries Retry-After. |
| 500 | internal_error | Storage/config/internal failure (detail logged, not returned). |
| 501 | not_implemented | Unimplemented protocol feature (incl. /log/*, /changes, /subscriptions, /key-attestations and lifecycle endpoints when their profiles are not enabled). |
| 502 | key_resolution_unreachable / cross_registry_resolution_failed | DID document or foreign registry unreachable (on publish, and on POST /auth/token since 0.5.1). A foreign registry refused by the SSRF policy is also cross_registry_resolution_failed, and so is one that serves a context document this registry cannot parse (not JSON, an unknown or missing field); a refused DID host is not (it is 400 key_resolution_failed). |
| 502 | invalid_witness_cosignature | A witness cosignature failed verification (RFC-ACDP-0015 §6.1). Like invalid_log_proof, a 502 because it is normally another party's artifact that failed. |
| 502 | invalid_log_proof | A transparency-log proof/checkpoint failed RFC-ACDP-0012 §9 verification. Normally raised when validating an upstream's proofs (federation), which is why it is a 502. It is also reachable from this registry's own /log/proof: for a retrieval-authorized requester the handler echoes the leaf via record.leaf() (log_proof in crates/acdp-registry-core/src/handlers/log.rs), and a stored leaf that no longer parses under the closed schema surfaces as invalid_log_proof from here, not from a peer (LogEntryRecord::leaf in crates/acdp-registry-store/src/log.rs, with the reject cases pinned by that module's own tests). If you see it and you are not federating, suspect your own log_leaves table. The other /log/* failures are schema_violation, not_found, or not_implemented; there is no log_unavailable. |
Note: auth failures on the ACDP routes surface as 403 not_authorized, not
401, and carry no WWW-Authenticate challenge. /admin/* likewise answers
403 (with its own {"error": "admin-only"} body rather than this envelope).
GET /metrics is the exception and is not covered by this table: it answers
401 with WWW-Authenticate: Bearer realm="metrics", because it sits outside
the ACDP auth pipeline entirely — see
AUTHENTICATION.md.