Skip to content

API Reference

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

Base URL

https://api.ag2trust.com

Authentication

All API requests require authentication via API key:

curl -H "X-API-Key: cust_your_api_key" https://api.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/teams/{team_slug}/ask Send message to a team

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://api.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"}'

3. Handle the Response

{
  "thread_id": "thread_abc123",
  "agent_id": 42,
  "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

  • Authentication


    API key management and authentication

    Authentication

  • Pool Endpoint


    Load-balanced messaging with conversation threads

    Pool Endpoint

  • Session Management


    Close sessions, update variables, confirm pending actions

    Session Management

  • Knowledge Base


    Upload and manage knowledge documents

    Knowledge Base

  • Feedback


    Submit response and agent type feedback

    Feedback

  • Webhooks


    Async response delivery

    Webhooks

  • Rate Limits


    Understanding and handling rate limits

    Rate Limits

  • Error Codes


    Error responses and troubleshooting

    Error Codes