Commerce API
Endpoints for service discovery, permission catalogs, consumption billing, and settlement.
··
GET /discover: Service Discovery
List all publicly discoverable gates. Agents use this endpoint to find services they can authenticate with.
bash
curl https://modei.ai/api/v1/discover \
-H "Authorization: Bearer mod_live_xxxxxxxx"json
{
"gates": [
{
"gate_id": "gate_01HXYZ...",
"name": "Research API",
"description": "Web search and document retrieval",
"permissions": ["web:search", "web:fetch"],
"trust_required": "L2",
"anonymous_access": true
}
]
}GET /gates/:id/catalog: Get Permission Catalog
Retrieve the signed, versioned permission catalog for a gate. Includes pricing and service-level agreement (SLA) terms.
bash
curl https://modei.ai/api/v1/gates/gate_01HXYZ/catalog \
-H "Authorization: Bearer mod_live_xxxxxxxx"json
{
"catalog_id": "cat_01HXYZ...",
"gate_id": "gate_01HXYZ...",
"version": 3,
"published_at": "2025-01-15T10:00:00Z",
"signature": "ed25519:...",
"permissions": [
{
"key": "web:search",
"description": "Perform web searches",
"price_per_call": 0.001,
"rate_limit": "100/min"
}
]
}POST /enforce: Enforcement Layer
Evaluate passport constraints before an action. Returns a cryptographically signed allow, request_hold, or block decision.
bash
curl -X POST https://modei.ai/api/v1/enforce \
-H "Authorization: Bearer mod_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"passport_id": "pass_01HXYZ...",
"action": "web:search",
"context": {
"query": "latest AI research"
}
}'json
{
"decision": "allow",
"attestation_id": "att_01HXYZ...",
"signature": "ed25519:...",
"constraints_evaluated": 4,
"remaining_budget": 47.50
}GET /billing/settlements: List Settlements
List billing settlements for your account. Settlements are created automatically from consumption attestations.
bash
curl https://modei.ai/api/v1/billing/settlements \
-H "Authorization: Bearer mod_live_xxxxxxxx"json
{
"settlements": [
{
"id": "set_01HXYZ...",
"status": "paid",
"amount": 12.50,
"currency": "USD",
"period_start": "2025-01-01T00:00:00Z",
"period_end": "2025-01-31T23:59:59Z",
"attestation_count": 12500
}
]
}Related
- Commerce Overview: Catalogs, discovery, billing, and Anti-Bait-and-Switch explained.
- Billing & Metering: How consumption attestations drive settlement.
- Audit Trail API: Export and query attestation records.