API Reference
Build powerful integrations with our comprehensive REST API. Access real-time agent management, conversation tracking, and webhook capabilities with simple, well-documented endpoints.
📡Base URL
https://api.One Last AI.com/v1All API requests should be made to this base URL with proper versioning.
🔑Authentication
Authorization: Bearer YOUR_API_KEYInclude your API key in the Authorization header for all requests.
API Reference
Authentication
Getting Your API Key
- 1
Sign in to your account
Log in to the One Last AI dashboard
- 2
Navigate to API Settings
Go to Settings → Developer → API Keys
- 3
Generate a new API key
Click "Create New Key" and copy your key
⚠️ Security Note: Keep your API keys confidential. Never commit them to version control or share publicly.
Agents Endpoints
/agentsRetrieve a list of all your agents
Response:
{
"data": [
{
"id": "agent_123",
"name": "Tech Wizard",
"personality": "helpful",
"created_at": "2025-01-15T10:30:00Z"
}
],
"total": 1
}/agentsCreate a new AI agent
Request:
{
"name": "New Agent",
"personality": "friendly",
"model": "gpt-4",
"system_prompt": "You are a helpful assistant"
}/agents/[agent_id]Retrieve details of a specific agent
Conversations API
/conversationsSend a message to an agent and get a response
Request:
{
"agent_id": "agent_123",
"message": "How do I create an agent?",
"conversation_id": "conv_456" // optional
}/conversations/[conversation_id]Retrieve the full conversation history
Rate Limits
Standard Plan
- Requests/minute:100
- Daily limit:100,000
- Concurrent requests:10
Pro Plan
- Requests/minute:500
- Daily limit:1,000,000
- Concurrent requests:50
Code Examples
List All Agents
JavaScript// Get all agents
const response = await fetch('https://api.One Last AI.com/v1/agents', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const agents = await response.json();
console.log(agents);Create an Agent
Pythonimport requests
# Create a new agent
response = requests.post(
'https://api.One Last AI.com/v1/agents',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'name': 'My Bot',
'personality': 'helpful',
'model': 'gpt-4'
}
)
agent = response.json()
print(agent['id'])Send Message
JavaScript// Send a message to an agent
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({
agent_id: 'agent_123',
message: 'Hello, how are you?'
})
});
const result = await response.json();
console.log(result.reply);Error Handling
All API errors follow a standard format. Handle errors gracefully in your applications:
{
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid",
"details": "Please check your API key and try again"
}
}Bad Request
Invalid parameters or missing required fields
Unauthorized
API key is missing or invalid
Rate Limit Exceeded
You've exceeded the rate limit for your plan
Server Error
Internal server error - try again later
Webhooks
Subscribe to real-time events from your agents. Webhooks are triggered when specific events occur:
agent.created
Triggered when a new agent is created
agent.updated
Triggered when an agent is updated
message.received
Triggered when an agent receives a message
conversation.completed
Triggered when a conversation ends
Ready to Build?
Start integrating with our API today. Check out our tutorials and SDKs for different programming languages.