Gates API
Endpoints for creating and managing security checkpoints (gates) and verifying agent passports against them.
··
POST /gates: Create a Gate
bash
curl -X POST https://modei.ai/api/v1/gates \
-H "Authorization: Bearer mod_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Gate",
"description": "Guards the main production API",
"trust_level": "L2",
"template_id": "web-research-agent",
"constraints": {
"rate_limits": {
"requests_per_minute": 60,
"requests_per_day": 10000
},
"spend_limits": {
"daily_usd": 100.00,
"per_transaction_usd": 10.00
},
"allowed_domains": ["api.example.com"],
"pii_controls": { "mode": "log_only" }
}
}'201 Created
{
"gate_id": "gate_01HXYZ...",
"name": "Production API Gate",
"description": "Guards the main production API",
"trust_level": "L2",
"gate_url": "https://gate.modei.ai/gate_01HXYZ...",
"constraints": { "...": "..." },
"created_at": "2026-02-24T10:00:00Z",
"status": "active"
}GET /gates: List Gates
bash
curl https://modei.ai/api/v1/gates \
-H "Authorization: Bearer mod_live_xxxxxxxx" \
-G --data-urlencode "limit=50"200 OK
{
"items": [
{
"gate_id": "gate_01HXYZ...",
"name": "Production API Gate",
"trust_level": "L2",
"gate_url": "https://gate.modei.ai/gate_01HXYZ...",
"request_count": 48291,
"permit_count": 47803,
"block_count": 488,
"created_at": "2026-02-24T10:00:00Z"
}
],
"total": 3,
"limit": 50
}GET /gates/:id: Get a Gate
bash
curl https://modei.ai/api/v1/gates/gate_01HXYZ... \
-H "Authorization: Bearer mod_live_xxxxxxxx"200 OK
{
"gate_id": "gate_01HXYZ...",
"name": "Production API Gate",
"trust_level": "L2",
"gate_url": "https://gate.modei.ai/gate_01HXYZ...",
"constraints": {
"rate_limits": { "requests_per_minute": 60 },
"spend_limits": { "daily_usd": 100.00 },
"allowed_domains": ["api.example.com"]
},
"stats": {
"total_requests": 48291,
"permits": 47803,
"blocks": 488,
"last_request_at": "2026-02-24T14:30:00Z"
}
}PUT /gates/:id: Update a Gate
bash
curl -X PUT https://modei.ai/api/v1/gates/gate_01HXYZ... \
-H "Authorization: Bearer mod_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"constraints": {
"spend_limits": {
"daily_usd": 200.00
}
}
}'200 OK
{
"gate_id": "gate_01HXYZ...",
"name": "Production API Gate",
"updated_at": "2026-02-24T15:00:00Z",
"constraints": { "...": "updated" }
}POST /gates/:id/test: Test a Gate
bash
curl -X POST https://modei.ai/api/v1/gates/gate_01HXYZ.../test \
-H "Authorization: Bearer mod_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"passport_token": "eyJhbGciOiJFZERTQSJ9...",
"requested_action": "web:search",
"context": {
"domain": "api.example.com",
"estimated_cost_usd": 0.01
}
}'200 OK, Permitted
{
"decision": "allow",
"agent_id": "research-bot-001",
"gate_id": "gate_01HXYZ...",
"attestation_id": "att_01HABC...",
"timestamp": "2026-02-24T10:00:00Z",
"guardrails_evaluated": ["rate_limit", "spend_limit", "domain_allowlist"],
"all_passed": true
}200 OK, Blocked
{
"decision": "block",
"reason": "spend_limit_exceeded",
"detail": "Daily spend of $100.00 would be exceeded. Current: $99.50 + Requested: $5.00",
"attestation_id": "att_01HDEF...",
"timestamp": "2026-02-24T10:00:00Z"
}DELETE /gates/:id: Delete a Gate
bash
curl -X DELETE https://modei.ai/api/v1/gates/gate_01HXYZ... \
-H "Authorization: Bearer mod_live_xxxxxxxx"200 OK
{
"gate_id": "gate_01HXYZ...",
"deleted": true,
"deleted_at": "2026-02-24T16:00:00Z"
}