Protocol reference

Pigeon Protocol v1.

Protocol v1 is the language-neutral HTTP + JSON contract between PigeonMQ brokers and clients. SDKs preserve these semantics instead of reimplementing broker policy logic.

Design invariant

A governed operation requires an authenticated principal and a valid runtime communication contract. Clients do not assert their own authority. The broker resolves identity, negotiates a contract and validates subsequent operations under that contract ID.

Required headers

HeaderPurpose
authorization: Bearer <credential>Authenticate the calling principal.
x-pigeon-contract: <contract_id>Bind a governed operation to a negotiated contract.
x-pigeon-region: <region>Supply the runtime region used by current policy gates.
content-type: application/jsonJSON request bodies.

Endpoints

EndpointPurpose
GET /Broker metadata and protocol information.
GET /healthBroker health.
GET /v1/subjectsDiscover registered subjects and selected public constraints.
POST /v1/contractsAuthenticate and negotiate permitted subjects and operations.
POST /v1/messagesPublish a governed message under x-pigeon-contract.
POST /v1/subjects/{subject}/receiveReceive messages when the contract contains receive authority.
GET /v1/auditRead current audit records.
GET /v1/quarantineInspect quarantined communication.
POST /v1/quarantine/{id}/releaseRelease a quarantined record when the caller and contract permit it.

Negotiate a contract

POST /v1/contracts
Authorization: Bearer <credential>
Content-Type: application/json

{
  "subjects": ["payments.authorize"],
  "ttlMs": 900000
}

The broker returns only the requested subjects and operations permitted for the authenticated principal. A principal with no permitted requested subjects receives a typed denial and no contract is issued.

Publish

POST /v1/messages
Authorization: Bearer <credential>
x-pigeon-contract: contract_1
Content-Type: application/json

{
  "subject": "payments.authorize",
  "type": "payment.authorization.requested",
  "source": "checkout-service",
  "intent": "authorize_payment",
  "idempotencyKey": "order_42:authorize",
  "classification": "pci",
  "region": "uk",
  "data": {
    "merchantId": "m",
    "orderId": "order_42",
    "amount": 42.5,
    "currency": "GBP",
    "paymentToken": "tok"
  }
}

A new accepted message returns HTTP 202. A recognised duplicate may return HTTP 200 with status: "duplicate". Contract or policy failures can deny or quarantine an otherwise well-formed message.

Typed errors

{
  "error": {
    "code": "CONTRACT_REQUIRED",
    "message": "...",
    "details": {}
  }
}

Representative codes include UNAUTHENTICATED, CONTRACT_EXPIRED, SUBJECT_NOT_IN_CONTRACT, INTENT_DENIED, REGION_DENIED, SENSITIVE_FIELD_DENIED, IDEMPOTENCY_REQUIRED, SCHEMA_INVALID and RATE_LIMITED.

Versioning

SDK compatibility is defined against Pigeon Protocol v1, not identical package patch versions. A breaking wire or semantic change requires a new protocol version.