Skip to main content

Protocol Reference

This page defines every ANIP endpoint, request/response schema, and data type. It is the implementation reference — use it alongside the concept pages (Capabilities, Delegation, Failures, Trust) which explain the why.

Endpoints

An ANIP HTTP service exposes 9 standard endpoints:

EndpointMethodAuthSection
/.well-known/anipGETNoneDiscovery
/.well-known/jwks.jsonGETNoneJWKS
/anip/manifestGETNoneManifest
/anip/tokensPOSTBearerToken Issuance
/anip/permissionsPOSTBearerPermission Discovery
/anip/invoke/{capability}POSTBearerInvocation
/anip/auditPOSTBearerAudit
/anip/checkpointsGETNoneCheckpoints
/anip/checkpoints/{id}GETNoneCheckpoint Detail

Discovery

GET /.well-known/anip

No authentication required. This is the entry point for any agent discovering the service.

Response

{
"anip_discovery": {
"version": "0.11.0",
"service_id": "travel-service",
"endpoints": {
"manifest": "/anip/manifest",
"tokens": "/anip/tokens",
"permissions": "/anip/permissions",
"invoke": "/anip/invoke/{capability}",
"audit": "/anip/audit",
"checkpoints": "/anip/checkpoints"
},
"capabilities": {
"search_flights": {
"description": "Search available flights",
"side_effect": { "type": "read" },
"minimum_scope": ["travel.search"],
"financial": false
},
"book_flight": {
"description": "Book a flight reservation",
"side_effect": { "type": "irreversible" },
"minimum_scope": ["travel.book"],
"financial": true
}
},
"trust": {
"level": "signed",
"anchoring": { "cadence": "hourly" }
},
"metadata_disclosure": {
"caller_class": "all",
"failure_detail": "full"
}
}
}

Fields

FieldTypeRequiredDescription
versionstringYesProtocol version (e.g., "0.11.0")
service_idstringYesUnique service identifier
endpointsobjectYesMap of operation names to URL paths
capabilitiesobjectYesLightweight capability summaries (name → metadata)
trustobjectYesTrust posture: level (declarative, signed, anchored) and optional anchoring cadence
metadata_disclosureobjectNoControls what metadata is disclosed to different caller classes

Each capability summary in discovery includes description, side_effect.type, minimum_scope[], and financial (boolean). The full declarations are in the manifest.


JWKS

GET /.well-known/jwks.json

No authentication required. Returns the service's public signing keys in standard JWKS format.

Response

{
"keys": [
{
"kty": "OKP",
"crv": "Ed25519",
"x": "dGhpcyBpcyBhIHB1YmxpYyBrZXk...",
"kid": "primary-signing-key",
"use": "sig"
}
]
}

Used to verify: manifest signatures (X-ANIP-Signature header), delegation token JWTs, and checkpoint signatures.


Manifest

GET /anip/manifest

No authentication required. Returns the full capability declarations with a cryptographic signature.

Response headers

X-ANIP-Signature: eyJhbGciOiJFZERTQSJ9...

Response body

{
"manifest_metadata": {
"version": "0.11.0",
"sha256": "a1b2c3d4...",
"issued_at": "2026-03-28T10:00:00Z",
"expires_at": "2026-03-29T10:00:00Z"
},
"service_identity": {
"id": "travel-service",
"jwks_uri": "/.well-known/jwks.json",
"issuer_mode": "self"
},
"trust": {
"level": "signed",
"anchoring": { "cadence": "hourly" }
},
"capabilities": {
"search_flights": {
"description": "Search available flights between airports",
"contract_version": "1.0",
"inputs": [
{
"name": "origin",
"type": "airport_code",
"required": true,
"description": "Departure airport (IATA code)"
},
{
"name": "destination",
"type": "airport_code",
"required": true,
"description": "Arrival airport (IATA code)"
},
{
"name": "date",
"type": "date",
"required": false,
"description": "Travel date (ISO 8601)"
}
],
"output": {
"type": "flight_list",
"fields": ["flight_number", "origin", "destination", "price"]
},
"side_effect": {
"type": "read"
},
"minimum_scope": ["travel.search"],
"cost": { "certainty": "fixed" },
"response_modes": ["unary"],
"observability": {
"logged": true,
"retention": "90d"
}
},
"book_flight": {
"description": "Book a flight reservation",
"contract_version": "1.0",
"inputs": [
{ "name": "flight_number", "type": "string", "required": true },
{ "name": "passengers", "type": "integer", "required": true, "default": 1 }
],
"output": {
"type": "booking_confirmation",
"fields": ["booking_id", "status", "total_cost"]
},
"side_effect": {
"type": "irreversible"
},
"minimum_scope": ["travel.book"],
"cost": {
"certainty": "estimated",
"financial": {
"currency": "USD",
"range_min": 200,
"range_max": 800,
"typical": 420
}
},
"requires": [
{ "capability": "search_flights", "reason": "must verify flight exists" }
],
"response_modes": ["unary"],
"observability": {
"logged": true,
"retention": "365d",
"fields_logged": ["flight_number", "passengers"]
}
}
}
}

Capability declaration fields

FieldTypeRequiredDescription
descriptionstringYesHuman-readable description
contract_versionstringYesSemantic version of this capability's contract
inputsarrayYesInput parameter declarations (see below)
outputobjectYesOutput shape: type and fields[]
side_effectobjectYesSide-effect declaration (see below)
minimum_scopestring[]YesRequired scope strings for delegation
costobjectNoCost declaration (see below)
requiresarrayNoPrerequisite capabilities
response_modesstring[]No["unary"], ["streaming"], or ["unary", "streaming"]. Default: ["unary"]
observabilityobjectNoLogging and retention posture

Input field

FieldTypeRequiredDescription
namestringYesParameter name
typestringYesSemantic type hint (e.g., "string", "airport_code", "integer")
requiredbooleanNoDefault: true
defaultanyNoDefault value if not provided
descriptionstringNoHuman-readable description

Side-effect types

ValueMeaning
readNo state change. Safe to call speculatively.
writeReversible state change.
transactionalState change with a rollback window. Has optional rollback_window (duration) and compensation (capability name).
irreversiblePermanent state change. Cannot be undone.

Cost declaration

FieldTypeDescription
certaintystring"fixed", "estimated", or "variable"
financialobjectOptional: currency, range_min, range_max, typical
computeobjectOptional: expected_duration, resource hints
determined_bystringOptional: what determines the cost (e.g., "passenger_count")

Token Issuance

POST /anip/tokens

Authentication: Bearer token (API key for bootstrap, existing JWT for delegation).

Request

{
"scope": ["travel.search", "travel.book"],
"capability": "book_flight",
"subject": "agent-007",
"purpose_parameters": {
"task_id": "trip-planning-2026",
"budget_usd": 500
},
"ttl_hours": 2
}
FieldTypeRequiredDescription
scopestring[]YesRequested scope strings
capabilitystringNoSpecific capability this token is for
subjectstringYes (bootstrap)Subject identifier for the delegated principal
purpose_parametersobjectNoOpaque purpose constraints (budget, task context)
ttl_hoursnumberNoToken lifetime in hours. Default: 2

Response

{
"issued": true,
"token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9...",
"scope": ["travel.search", "travel.book"],
"capability": "book_flight",
"expires_at": "2026-03-28T12:00:00Z"
}

Delegation rules

  • Scope can only narrow, never widen. A delegated token cannot have scope the parent doesn't have.
  • Budget constraints in scope strings (e.g., travel.book:max_$500) are enforced at invocation time.
  • The service signs tokens with its Ed25519 key pair. Any replica with the same key material can verify them.

Permission Discovery

POST /anip/permissions

Authentication: Bearer JWT delegation token.

Request

{}

Response

{
"available": [
{
"capability": "search_flights",
"scope_match": "travel.search",
"constraints": {}
}
],
"restricted": [
{
"capability": "book_flight",
"reason": "missing scope: travel.book",
"grantable_by": "human:[email protected]"
}
],
"denied": [
{
"capability": "admin_reset",
"reason": "requires admin principal class"
}
]
}

Three-bucket model

BucketMeaning
availableToken has sufficient scope. Fields: capability, scope_match, constraints
restrictedMissing a grantable scope. Fields: capability, reason, grantable_by
deniedStructurally impossible (wrong principal class). Fields: capability, reason

Invocation

POST /anip/invoke/{capability}

Authentication: Bearer JWT delegation token.

Request

{
"parameters": {
"origin": "SEA",
"destination": "SFO"
},
"client_reference_id": "task:abc/step-3",
"stream": false
}
FieldTypeRequiredDescription
parametersobjectYesCapability input parameters
client_reference_idstringNoCaller-supplied correlation ID (max 256 chars), echoed in response
streambooleanNoRequest streaming response (SSE). Default: false

Success response (HTTP 200)

{
"success": true,
"invocation_id": "inv_7f3a2b4c5d6e",
"client_reference_id": "task:abc/step-3",
"result": {
"flights": [
{ "flight_number": "AA100", "price": 420 },
{ "flight_number": "DL310", "price": 280 }
]
},
"cost_actual": {
"currency": "USD",
"amount": 0
}
}

Failure response (HTTP 4xx)

{
"success": false,
"invocation_id": "inv_8b2f4a7c9d0e",
"client_reference_id": "task:abc/step-3",
"failure": {
"type": "budget_exceeded",
"detail": "Requested booking costs $487.00 which exceeds the delegated budget of $200.00",
"retry": false,
"resolution": {
"action": "request_budget_increase",
"requires": "higher_budget_delegation",
"grantable_by": "human:[email protected]",
"estimated_availability": "immediate"
}
}
}

Response fields

FieldTypeAlways presentDescription
successbooleanYesWhether the invocation succeeded
invocation_idstringYesServer-generated unique ID (inv_{hex12})
client_reference_idstringIf provided in requestEchoed caller correlation ID
resultobjectOn successCapability-specific result data
cost_actualobjectIf capability has financial costcurrency and amount
failureobjectOn failureStructured failure (see below)

ANIPFailure schema

FieldTypeRequiredDescription
typestringYesMachine-readable failure category (e.g., scope_insufficient, budget_exceeded, rate_limited)
detailstringYesHuman-readable explanation
retrybooleanYesWhether retrying the same call might succeed. Default: true
resolutionobjectYesRecovery guidance (see below)

Resolution schema

FieldTypeRequiredDescription
actionstringYesWhat to do (e.g., request_scope, request_budget_increase, wait)
requiresstringNoWhat's needed to resolve
grantable_bystringNoWho can grant what's needed (principal identifier)
estimated_availabilitystringNoHow soon resolution is possible (e.g., immediate, 24h)

Audit

POST /anip/audit

Authentication: Bearer token. Results are scoped to the root principal of the caller's delegation chain — a principal can only see its own audit trail.

Request (query parameters)

ParameterTypeDescription
capabilitystringFilter by capability name
sincestringISO 8601 timestamp — entries after this time
invocation_idstringFilter by specific invocation
client_reference_idstringFilter by caller correlation ID
limitintegerMaximum entries to return

Response

{
"entries": [
{
"invocation_id": "inv_7f3a2b4c5d6e",
"capability": "search_flights",
"actor_key": "agent:booking-bot",
"root_principal": "human:[email protected]",
"event_class": "low_risk_success",
"success": true,
"client_reference_id": "task:abc/step-3",
"timestamp": "2026-03-28T10:30:00Z"
}
]
}

Event classification

ClassWhen used
low_risk_successRead capability succeeded
high_risk_successWrite/irreversible/financial capability succeeded
low_risk_failureRead capability failed
high_risk_failureWrite/irreversible/financial capability failed

Checkpoints

GET /anip/checkpoints

No authentication required.

Query parameters

ParameterTypeDescription
limitintegerMaximum checkpoints to return. Default: 20

Response

{
"checkpoints": [
{
"checkpoint_id": "cp_a1b2c3",
"sequence": 42,
"merkle_root": "sha256:7d3f8a...",
"entry_count": 150,
"created_at": "2026-03-28T11:00:00Z",
"signature": "eyJhbGciOi..."
}
]
}

Checkpoint Detail

GET /anip/checkpoints/{id}

Returns a single checkpoint with optional consistency proof fields.

Response

{
"checkpoint_id": "cp_a1b2c3",
"sequence": 42,
"merkle_root": "sha256:7d3f8a...",
"entry_count": 150,
"created_at": "2026-03-28T11:00:00Z",
"signature": "eyJhbGciOi...",
"tree_size": 150,
"tree_head": "sha256:7d3f8a..."
}

JSON Schema

Machine-readable JSON Schema definitions are maintained alongside the spec:

The spec (SPEC.md) is authoritative for semantics. The schemas are authoritative for structure.