Skip to content

API Reference

The AG2Trust API enables programmatic access to your agents. This reference documents all available endpoints.

Base URL

https://agents.ag2trust.com

Authentication

All API requests require authentication via API key:

curl -H "X-API-Key: cust_your_api_key" https://agents.ag2trust.com/api/v1/...

See Authentication for details on obtaining and managing API keys.

API Versioning

The API uses URL path versioning:

/api/v1/...

We commit to maintaining backward compatibility within a version.

Response Format

All responses are JSON with consistent structure:

Success Response

{
  "data": { ... },
  "meta": {
    "request_id": "req_abc123"
  }
}

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

curl -X POST https://agents.ag2trust.com/api/v1/ask/support \
  -H "X-API-Key: cust_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello, I need help with my account"}'
curl -X POST https://agents.ag2trust.com/api/v1/agents/{agent_id}/messages \
  -H "X-API-Key: cust_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, I need help with my account"}'

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:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1700308800

See Rate Limits for details.

Detailed Documentation