API Reference
Welcome to the AgentsGT API documentation. This API allows you to programmatically interact with your AI agents, retrieve chat history, and access usage metrics.
Base URL
All API requests should be made to:
https://agentsgt.com/api/v1
Authentication
AgentsGT uses API keys for authentication. You can create and manage API keys from your organization's settings page.
API Key Format
API keys consist of two parts:
- Public Key: Starts with
pk_(can be safely stored in client-side code) - Secret Key: Starts with
sk_(must be kept secure and never exposed)
Using Your API Key
Include your API key in the Authorization header of each request:
Authorization: Bearer {PUBLIC_KEY}:{SECRET_KEY}
Example:
Authorization: Bearer pk_1234567890abcdef:sk_abcdef1234567890
Rate Limiting
API keys can have rate limits configured per organization. If you exceed your rate limit, you'll receive a 429 Too Many Requests response.
Response Format
All API responses are returned in JSON format with the following structure:
Success Response:
{
"success": true,
"data": { ... }
}
Error Response:
{
"success": false,
"error": "Error message"
}
Common HTTP Status Codes
| Status Code | Description |
|---|---|
200 | Success - Request completed successfully |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - API key doesn't have permission |
404 | Not Found - Resource doesn't exist |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Something went wrong on our end |
Available Endpoints
Agents
- Get All Agents - Retrieve all agents in your organization
Chat History
- Get Chat History by Agent - Retrieve conversation history for a specific agent
- Get Chat History by Identifier - Retrieve conversation history for a specific user/session
Metrics
- Get Metrics by Organization - Retrieve organization-wide consumption and usage metrics
- Get Metrics by Agent - Get detailed metrics for a specific agent
- Get Metrics by Identifier - Track consumption for a specific user/session
Best Practices
- Secure Your API Keys: Never commit secret keys to version control or expose them in client-side code
- Use Environment Variables: Store API keys in environment variables, not in your code
- Handle Errors Gracefully: Always check response status codes and handle errors appropriately
- Monitor Usage: Keep track of your API usage to avoid hitting rate limits
- Update Last Used: API keys automatically track when they were last used for security purposes