Skip to main content

Get Agent Details

Retrieve detailed information about a specific AI agent by its ID.

Endpoint

GET /api/v1/agents/agent/{agentId}

Authentication

This endpoint requires API key authentication. Include your API key in the Authorization header using the Bearer scheme.

Header Format:

Authorization: Bearer {PUBLIC_KEY}:{SECRET_KEY}

Request

Path Parameters

ParameterTypeRequiredDescription
agentIdstring (UUID)YesThe unique identifier of the agent

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesYour API key in the format Bearer pk_xxx:sk_xxx

Query Parameters

This endpoint does not accept any query parameters.

Response

Success Response

Status Code: 200 OK

Response Body:

{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Customer Support Agent",
"description": "AI agent for handling customer inquiries",
"system_prompt": "You are a helpful customer support assistant...",
"slug": "customer-support",
"language": "en",
"model": {
"name": "gpt-4",
"display_name": "GPT-4",
"pricing": {
"input_per_1k_tokens": 0.03,
"output_per_1k_tokens": 0.06
},
"context_window": 8192
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z",
"url": "https://agentsgt.com/api/v1/agents/basic/550e8400-e29b-41d4-a716-446655440000"
}
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful
dataobjectThe agent object
data.idstring (UUID)Unique identifier for the agent
data.namestringName of the agent
data.descriptionstring | nullDescription of the agent's purpose
data.system_promptstring | nullThe system prompt that defines the agent's behavior
data.slugstring | nullURL-friendly identifier for the agent
data.languagestring | nullPrimary language of the agent
data.modelobjectInformation about the AI model used
data.model.namestringInternal name of the model
data.model.display_namestringHuman-readable name of the model
data.model.pricingobjectPricing information for the model
data.model.pricing.input_per_1k_tokensnumberCost per 1,000 input tokens (in USD)
data.model.pricing.output_per_1k_tokensnumberCost per 1,000 output tokens (in USD)
data.model.context_windownumberMaximum context window size in tokens
data.created_atstring (ISO 8601)Timestamp when the agent was created
data.updated_atstring (ISO 8601)Timestamp when the agent was last updated
data.urlstringDirect API URL to interact with this agent

Error Responses

401 Unauthorized

Status: 401 Unauthorized
Body: "Unauthorized"

404 Not Found

Status: 404 Not Found
Body: "Agent not found"

500 Internal Server Error

Status: 500 Internal Server Error
Body: "Internal server error"

Example Usage

cURL

curl -X GET https://agentsgt.com/api/v1/agents/agent/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer pk_1234567890abcdef:sk_abcdef1234567890"

JavaScript (Fetch API)

const publicKey = 'pk_1234567890abcdef';
const secretKey = 'sk_abcdef1234567890';
const agentId = '550e8400-e29b-41d4-a716-446655440000';

fetch(`https://agentsgt.com/api/v1/agents/agent/${agentId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${publicKey}:${secretKey}`,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log('Agent:', data.data.name);
console.log('Model:', data.data.model.display_name);
console.log('Language:', data.data.language);
})
.catch(error => {
console.error('Error:', error);
});

Python (Requests)

import requests

public_key = 'pk_1234567890abcdef'
secret_key = 'sk_abcdef1234567890'
agent_id = '550e8400-e29b-41d4-a716-446655440000'

headers = {
'Authorization': f'Bearer {public_key}:{secret_key}',
'Content-Type': 'application/json'
}

response = requests.get(
f'https://agentsgt.com/api/v1/agents/agent/{agent_id}',
headers=headers
)

if response.status_code == 200:
data = response.json()
agent = data['data']
print(f"Agent: {agent['name']}")
print(f"Model: {agent['model']['display_name']}")
print(f"Language: {agent['language']}")
else:
print(f"Error: {response.status_code} - {response.text}")

Node.js (Axios)

const axios = require('axios');

const publicKey = 'pk_1234567890abcdef';
const secretKey = 'sk_abcdef1234567890';
const agentId = '550e8400-e29b-41d4-a716-446655440000';

axios.get(`https://agentsgt.com/api/v1/agents/agent/${agentId}`, {
headers: {
'Authorization': `Bearer ${publicKey}:${secretKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
const agent = response.data.data;
console.log(`Agent: ${agent.name}`);
console.log(`Model: ${agent.model.display_name}`);
console.log(`Language: ${agent.language}`);
})
.catch(error => {
console.error('Error:', error.response?.data || error.message);
});

Notes

  • The agent must belong to the organization associated with your API key
  • Returns a single agent object rather than an array
  • Includes the agent's language setting, which is not returned by the list agents endpoint
  • The url field provides a direct link to the basic message endpoint for this agent