Skip to main content

API overview

:::info Implemented by cmd/api, cmd/mcp and cmd/a2a cmd/api serves every REST route below (internal/adapters/inbound/http) on HTTP_ADDR (default :8080); cmd/mcp serves the read-only MCP server on MCP_ADDR (default :8090); cmd/a2a serves the read-only A2A agent on A2A_ADDR (default :8093). The contracts are apis/openapi.yaml and apis/asyncapi.yaml, pinned by ADR 0001, ADR 0002 and ADR 0004. The router registers the eleven API routes of the spec plus /healthz and /readyz, which the spec does not list. See the Quickstart for real responses. :::

InterfaceSource of truthNotes
RESTapis/openapi.yaml (OpenAPI 3.0.3, version 0.1.0)The pages under REST are generated from the spec with npm run gen-api-docs; do not edit them by hand. The spec names one server, http://localhost:8080; through Kong in the kind cluster the base path is http://localhost:8000/api/product-content (the prefix is stripped).
Eventsapis/asyncapi.yaml (AsyncAPI 3.0.0, version 1.0.0)Summarised on the event catalogue; every field on Domain events.
MCPADR 0008, internal/adapters/inbound/mcpcmd/mcp serves Streamable HTTP on /mcp and / (port 8090; through Kong /api/mcp/product-content, rewritten to /mcp), GET /healthz for probes. Two read-only tools, every one authority L1, no write tool: get_product_content and list_categories; one resource and one prompt. See MCP tools. No auth, by fleet decision.
A2AADR 0006, internal/adapters/inbound/a2acmd/a2a serves JSON-RPC 2.0 on / and /a2a (port 8093; through Kong /api/a2a/product-content), the Agent Card at /.well-known/agent-card.json, GET /healthz for probes. Two read-only skills, no write skill: get_product_content and list_categories. No auth, by fleet decision.

Endpoints​

TagEndpointOperation idSuccess
ProductContentsPOST /product-contentscreateProductContent201, the DRAFT content at revision 1
ProductContentsGET /product-contentslistProductContents200 {items, nextCursor?}, every state, ordered by catalogItemId; cursor, limit 1 to 500 (default 100)
ProductContentsGET /product-contents/{catalogItemId}getProductContent200, the content; 404 not-found
ProductContentsPOST /product-contents/{catalogItemId}/revisionsreviseProductContent200, the revised content at its new revision
ProductContentsPOST /product-contents/{catalogItemId}/publicationspublishProductContent200, the content as PUBLISHED; unchanged and silent when the current revision is already published
ProductContentsPOST /product-contents/{catalogItemId}/retirementsretireProductContent200, the RETIRED content
ProductContentsDELETE /product-contents/{catalogItemId}/draftdiscardProductContentDraft200, the DRAFT retired with reason DISCARDED
CategoriesPOST /categoriescreateCategory201, the category (id minted by the service)
CategoriesGET /categorieslistCategories200, the tree version and every category; version 0 and empty before the first one
CategoriesPOST /category-tree-publicationspublishCategoryTree200, the live tree republished under a new version
CategoriesPUT /categories/{categoryId}/parentmoveCategory200, the moved category
CategoriesPUT /categories/{categoryId}/namerenameCategory200, the renamed category
HealthGET /healthz, GET /readyznone (not in the spec)200 {"status":"ok"} / 200 {"status":"ready"}, or 503 {"status":"not_ready"} once shutdown has started or Postgres or Kafka does not answer; see the Runbook

Source: internal/adapters/inbound/http/server.go (NewRouter), handlers.go, handlers_category.go, readiness.go.

Conventions in the contract​

  • Noun routes. Lifecycle actions are POST transition resources named by a plural noun after the id ({catalogItemId}/publications); a draft discard is DELETE .../draft; a category move or rename is PUT .../parent or PUT .../name. The body of /revisions is the whole editable content; /publications, /retirements and DELETE .../draft take no body. One /revisions route serves both states: the state picks ReviseDraft or ReviseContent (Use cases).
  • Idempotency-Key. Required on every POST (1 to 128 printable ASCII characters; 400 idempotency-key-required when absent, 400 idempotency-key-invalid when malformed). Global: remembered 24 hours by key alone, compared by method + path + body hash, in idempotency_keys: the same key with the same request replays the stored response, marked with the header Idempotency-Replayed: true; the same key with a different request is 409 idempotency-key-reused. Every response below 500 is stored, 4xx included, so retry a failed request with a fresh key. Implemented by internal/adapters/inbound/http/idempotency.go.
  • Paging. GET /product-contents takes limit (1 to 500, default 100) and an opaque cursor; the response is {items, nextCursor} and nextCursor is absent on the last page. Any other query parameter is 400 unknown-query-parameter. Ordered by catalogItemId; every state is listed.
  • Revisions and versions. revision is the content shape number (1 at creation, plus one per revise); publishedRevision is the last published one (0 = never). The tree carries one version, which grows with every category write and every POST /category-tree-publications.
  • Errors are RFC 9457 application/problem+json with type = /problems/<slug> (a relative reference). Slugs: malformed-request, not-found, content-retired, category-in-use (declared, never raised), unknown-catalog-item, item-discontinued, incomplete-content, unknown-category, too-many-bullets, too-many-attributes, too-many-media, category-cycle, max-depth, duplicate-sibling-name, concurrent-update, illegal-transition, validation-failed, idempotency-key-required, idempotency-key-reused and internal-error. Which error maps to which slug and status is on Use cases, with remedies on Troubleshooting.
  • Limits. Description at most 4000 characters; at most 10 bullets of 1 to 300; at most 50 attributes (name 1 to 100, value 1 to 300, unit at most 20); at most 12 media (absolute http(s) URL up to 2048 characters, alt text 1 to 200, role PRIMARY or GALLERY, unique mediaId); a category name 1 to 100 characters without /; at most 4 levels and 5000 categories. A catalogItemId is 1 to 64 characters of A-Za-z0-9._:- starting with a letter or digit.
  • A NUL character (U+0000) in a path, query or body is a client error, never a database failure (internal/adapters/inbound/http/nul.go).
  • Auth: none. The fleet reverted REST, MCP and A2A auth on 2026-09-11, and TestNoAuthMiddlewareReintroduced fails CI if auth middleware returns under internal/adapters/inbound.
  • No PII. No route or event carries a title, a price, stock or personal data.

A2A​

cmd/a2a is a message-only agent built on the official A2A Go SDK. Its Agent Card (GET /.well-known/agent-card.json) advertises one JSON-RPC interface at A2A_AGENT_URL, a required variable that must be the absolute URL clients dial (the binary refuses to boot without it), no streaming, input and output modes application/json and text/plain, and no security scheme.

A skill call is a JSON-RPC message whose first part is a data part (or a text part holding the same JSON) with the skill id and its arguments:

SkillArgumentsAnswers
get_product_contentcatalogItemId (required, at most 128 characters)The content exactly as GET /product-contents/{catalogItemId} returns it: state, description, bullets, attributes, media, primary category, revision and published revision; a not-found problem when the item has no content.
list_categoriesnoneThe tree version and every category with id, parent id, name and path, as GET /categories.

The reply is one agent message with a data part (the envelope with the skill id and the data, or a problem) and a text part (a one-line summary). Rejections are answered, not raised: a domain or request problem comes back in the message as a problem with the REST status and one of the slugs not-found (404), validation-failed (422), internal-error (500), malformed-skill-request, unknown-skill or invalid-argument (400), never as a JSON-RPC error. Unknown fields in a skill request are refused. Each skill run opens an a2a.skill <id> span. The agent reads Postgres only: it has no Kafka, no relay, no consumer and no write path (TestA2AAgentIsReadOnlyWithNoOutboundClient), and no outbound A2A client exists. Facts between contexts still travel as CloudEvents on Kafka.

Source: internal/adapters/inbound/a2a/server.go, skills.go, mapping.go, cmd/a2a/router.go.