API Reference¶
The AG2Trust API enables programmatic access to your agents. This reference documents all available endpoints.
Base URL¶
Authentication¶
All API requests require authentication via API key:
See Authentication for details on obtaining and managing API keys.
API Versioning¶
The API uses URL path versioning:
We commit to maintaining backward compatibility within a version.
Response Format¶
All responses are JSON with consistent structure:
Success Response¶
Error Response¶
{
"error": "Human-readable error message",
"error_code": "MACHINE_READABLE_CODE",
"details": { ... }
}
Endpoints Overview¶
Core Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
POST | /api/v1/ask/{endpoint_slug} | Send message to agent pool |
POST | /api/v1/agents/{id}/messages | Send message to specific agent |
GET | /api/v1/agents | List available agents |
Utility Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/usage | Get usage statistics |
GET | /api/v1/conversations/{id}/history | Get conversation history |
PUT | /api/v1/webhook | Update webhook URL |
POST | /api/v1/webhook/test | Test webhook delivery |
Quick Start¶
1. Get Your API Key¶
Generate an API key in the Dashboard: Settings > API Keys
2. Send Your First Message¶
3. Handle the Response¶
{
"thread_id": "thread_abc123",
"agent_id": "uuid",
"content": "Hello! I'd be happy to help you with your account. What specific issue are you experiencing?",
"timestamp": "2025-01-15T10:30:00Z"
}
Rate Limits¶
| Endpoint | Default Limit |
|---|---|
| All endpoints | 60 requests/minute |
| Per agent | 50 requests/minute |
Rate limit headers are included in responses:
See Rate Limits for details.
Detailed Documentation¶
-
Authentication
API key management and authentication
-
Pool Endpoint
Load-balanced messaging with conversation threads
-
Direct Endpoint
Send messages to specific agents
-
Webhooks
Async response delivery
-
Rate Limits
Understanding and handling rate limits
-
Error Codes
Error responses and troubleshooting