Agent API Reference
Complete API documentation for integrating agents into your applications.
API Overview
The One Last AI API provides RESTful endpoints to integrate AI agents into your applications, websites, and systems. The API uses JSON for request and response payloads and requires authentication via API keys.
Base URL:
https://api.One Last AI.com/v1Authentication
API Keys
All API requests require an API key in the Authorization header. You can generate API keys from your One Last AI dashboard under Settings → API Keys.
Header Format
Rate Limiting
API requests are rate-limited based on your plan tier. Standard plans allow 100 requests per minute. Rate limit information is included in response headers. When you exceed the limit, you'll receive a 429 Too Many Requests response.
Core Endpoints
/agentsRetrieve a list of all available agents with their metadata.
Response:
{
"agents": [
{
"id": "einstein",
"name": "Einstein",
"specialty": "Scientific Research",
"description": "...",
"isAvailable": true
}
]
}/agents/{agentId}Get detailed information about a specific agent.
Parameters:
agentId (string) - The ID of the agent (e.g., "einstein")
Response includes:
ID, name, specialty, description, configuration options, and model information.
/agents/{agentId}/messageSend a message to an agent and receive a response.
Request Body:
{
"conversationId": "conv_123",
"message": "Your question here",
"config": {
"tone": "professional",
"length": "standard"
}
}Response:
{
"id": "msg_456",
"response": "Agent response text",
"timestamp": "2025-10-22T10:30:00Z",
"tokensUsed": 150
}/conversationsCreate a new conversation session with an agent.
Request Body:
{
"agentId": "einstein",
"metadata": {
"user_id": "user_123",
"context": "Additional context"
}
}Returns:
A new conversation ID to use in subsequent message requests.
/conversations/{conversationId}Retrieve the full conversation history including all messages.
Query Parameters:
limit- Maximum messages to return (default: 50)offset- For pagination
/agents/{agentId}/configUpdate the configuration for an agent session.
Request Body (example):
{
"tone": "casual",
"length": "brief",
"language": "es",
"creativity": "creative"
}Error Handling
400 Bad Request
The request parameters are invalid or malformed. Check your request body and parameters.
401 Unauthorized
Authentication failed. Verify your API key is correct and included in the Authorization header.
404 Not Found
The requested resource (agent, conversation) does not exist.
429 Too Many Requests
Rate limit exceeded. Wait before making additional requests. Check rate-limit headers for reset time.
500 Internal Server Error
A server error occurred. Retry your request. If the issue persists, contact support.
Integration Examples
JavaScript/Node.js
// Create conversation
const response = await fetch(
'https://api.One Last AI.com/v1/conversations',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agentId: 'einstein'
})
}
);
const { conversationId } = await response.json();
// Send message
const msgResponse = await fetch(
'https://api.One Last AI.com/v1/agents/einstein/message',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
conversationId,
message: 'What is quantum entanglement?'
})
}
);
const data = await msgResponse.json();
console.log(data.response);Python
import requests
api_key = "YOUR_API_KEY"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
# Create conversation
conv_response = requests.post(
"https://api.One Last AI.com/v1/conversations",
headers=headers,
json={"agentId": "einstein"}
)
conversation_id = conv_response.json()["conversationId"]
# Send message
msg_response = requests.post(
"https://api.One Last AI.com/v1/agents/einstein/message",
headers=headers,
json={
"conversationId": conversation_id,
"message": "Explain relativity"
}
)
print(msg_response.json()["response"])Rate Limits & Quotas
Rate limits vary by plan tier:
Upgrade your plan at any time to increase your rate limits and token quotas.
← Configuration
Configure agents
Best Practices →
Learn expert tips
Troubleshooting →
Solve issues