Authorize an exact operation
Authorization requires a valid caller credential, an active enforcement-mode integration, matching permit state and a live Trace decision.
POST /api/public/v1/workpermit/gateway/authorize
Authorization: Bearer <credential>
Content-Type: application/json
{
"integration_id": "<uuid>",
"permit_id": "<uuid>",
"site_id": "<uuid>",
"operation": "permit.hold",
"expected_revision": 3,
"reason": "Isolation boundary changed",
"enforcement_point_id": "<uuid>",
"ttl_seconds": 300
}Redeem once at the enforcement point
Use the returned authorization ID and fingerprint. Redemption rechecks authority and consumes the exact action atomically; a replay is not a second authorization.
POST /api/public/v1/workpermit/gateway/redeem
Authorization: Bearer <credential>
Content-Type: application/json
{
"integration_id": "<uuid>",
"permit_id": "<uuid>",
"site_id": "<uuid>",
"operation": "permit.hold",
"expected_revision": 3,
"reason": "Isolation boundary changed",
"authorization_id": "<uuid>",
"fingerprint": "<64 lowercase hex characters>"
}Send signed integration events
Sign the exact raw request body with HMAC-SHA256 over timestamp + period + rawBody. Use a ten-digit Unix timestamp inside the five-minute replay window.
POST /api/public/v1/workpermit/gateway/events
Authorization: Bearer <credential>
X-Trace-Timestamp: <10-digit Unix seconds>
X-Trace-Key-Version: <version>
X-Trace-Signature: sha256=<64 hex characters>
Content-Type: application/json
{
"integration_id": "<uuid>",
"external_event_id": "vendor-event-000184",
"event_type": "permit.updated",
"payload": {"revision": 3},
"occurred_at": "2026-11-20T14:00:00Z",
"sequence": 184
}Retries and outcomes
Reuse the same external event ID and byte-identical content for a safe event retry. Changed payload, type, occurrence time or sequence under that ID is refused.
- 201 records a new authorization or event; 202 can require approval; 200 handles redemption or a true duplicate.
- 400 means the contract is invalid; 401 means identity or signature failed; 403 means authority or integration refused; 409 means state or event conflict.
- 429 is abuse protection, not authorization. 500 means the answer could not be established.
- Delayed and out-of-order events are retained for reconciliation; they do not overwrite earlier state.
