API Reference

Technical API documentation for building custom integrations.

⚠️

Most users should use the Python SDK instead of calling the API directly.

This reference is for building custom integrations in other languages.

Authentication

All API requests require your project API key in the X-API-Key header:

X-API-Key: as_your_api_key

Get your API key from the Dashboard.

Event Ingestion

POST /ingest-event

Records a permission check event.

Request:

{
  "agent_name": "SupportBot",
  "action": "permission_check",
  "scope": "read:orders",
  "allowed": true,
  "function_name": "get_order",
  "metadata": {}
}

Fields:

FieldTypeRequiredDescription
agent_namestringYesName of the agent
actionstringYesEvent type (e.g., permission_check)
scopestringNoThe scope being checked
allowedbooleanYesWhether access was granted
function_namestringNoName of the protected function
metadataobjectNoAdditional context

Response (201):

{
  "id": "uuid",
  "project_id": "uuid",
  "agent_id": "uuid",
  "agent_name": "SupportBot",
  "action": "permission_check",
  "scope": "read:orders",
  "allowed": true,
  "timestamp": "2024-01-15T10:30:00Z"
}

Example (cURL):

curl -X POST https://api.agentsudo.dev/ingest-event \
  -H "Content-Type: application/json" \
  -H "X-API-Key: as_your_api_key" \
  -d '{
    "agent_name": "SupportBot",
    "action": "permission_check",
    "scope": "read:orders",
    "allowed": true,
    "function_name": "get_order"
  }'

Error Codes

HTTP StatusCodeDescription
400INVALID_PAYLOADMissing required fields
401INVALID_API_KEYAPI key is missing or invalid
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORServer error

Error Response:

{
  "error": "Invalid API key"
}

Rate Limits

TierLimit
Free1,000 events/day
Pro100,000 events/day

Building a Custom SDK

If you're building an SDK for another language, here's the minimal implementation:

# Pseudocode for any language
def send_event(api_key, agent_name, scope, allowed, function_name):
    POST "https://api.agentsudo.dev/ingest-event"
    Headers: {
        "Content-Type": "application/json",
        "X-API-Key": api_key
    }
    Body: {
        "agent_name": agent_name,
        "action": "permission_check", 
        "scope": scope,
        "allowed": allowed,
        "function_name": function_name
    }
💡

Interested in building an SDK for TypeScript, Go, or another language? Open an issue and we'll help!