API Overview
The Agentopia API provides a comprehensive set of endpoints for creating, managing, and deploying AI agents. Our RESTful API allows developers to integrate agent capabilities into their applications and services.
Base URL
https://api.agentopia.org/v1
API Versioning
The Agentopia API uses versioning to ensure backward compatibility. The current version is
v1
. We recommend always specifying the version in your API calls.
API Design Principles
- RESTful: Our API follows REST principles for predictable resource-oriented URLs
- JSON: All requests and responses use JSON format
- HTTPS: All API requests must use HTTPS for security
- Stateless: Each request contains all information needed to complete the operation
Authentication
The Agentopia API uses API keys for authentication. You can obtain an API key from your Agentopia dashboard.
API Keys
Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY
Example Request with Authentication
curl -X GET \
https://api.agentopia.org/v1/agents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
API Key Management
Best practices for managing your API keys:
- Never expose your API key in client-side code
- Use environment variables to store your API key
- Rotate your API keys periodically
- Use different API keys for development and production
Rate Limits
To ensure fair usage and system stability, the Agentopia API implements rate limiting. Rate limits vary based on your subscription tier.
Tier | Requests per Minute | Requests per Day |
---|---|---|
Free | 60 | 10,000 |
Developer | 300 | 50,000 |
Enterprise | 1,000+ | Custom |
Rate Limit Headers
Each API response includes headers to help you track your rate limit usage:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1622119200
When you exceed your rate limit, you'll receive a
429 Too Many Requests
response. The response will include a
Retry-After
header indicating how long to wait before making another
request.
Agent Endpoints
The following endpoints allow you to create, manage, and interact with AI agents in the Agentopia ecosystem.
List Agents
Returns a list of all agents associated with your account.
Endpoint
GET /agents
Query Parameters
limit
: Maximum number of results (default: 20)offset
: Pagination offset (default: 0)category
: Filter by agent category
Example Response
{
"data": [
{
"id": "agt_123456789",
"name": "Research Buddy",
"description": "AI assistant for academic research",
"category": "regular_single",
"created_at": "2025-04-15T12:00:00Z",
"status": "active"
},
{
"id": "agt_987654321",
"name": "Code Helper",
"description": "Programming assistant for developers",
"category": "regular_single",
"created_at": "2025-04-10T09:30:00Z",
"status": "active"
}
],
"meta": {
"total": 2,
"limit": 20,
"offset": 0
}
}
Create Agent
Creates a new agent with the specified configuration.
Endpoint
POST /agents
Request Body
name
: Agent name (required)description
: Agent descriptioncategory
: Agent category (required)config
: Agent configuration object
Example Request
{
"name": "Data Analyst",
"description": "AI assistant for data analysis tasks",
"category": "autonomous_single",
"config": {
"model": "gpt-4",
"temperature": 0.7,
"tools": ["search", "calculator", "data_visualization"],
"memory_capacity": 10
}
}
Example Response
{
"id": "agt_567890123",
"name": "Data Analyst",
"description": "AI assistant for data analysis tasks",
"category": "autonomous_single",
"created_at": "2025-05-29T22:45:00Z",
"status": "initializing",
"config": {
"model": "gpt-4",
"temperature": 0.7,
"tools": ["search", "calculator", "data_visualization"],
"memory_capacity": 10
}
}
Get Agent
Retrieves details for a specific agent.
Endpoint
GET /agents/{agent_id}
Path Parameters
agent_id
: Unique identifier for the agent
Example Response
{
"id": "agt_123456789",
"name": "Research Buddy",
"description": "AI assistant for academic research",
"category": "regular_single",
"created_at": "2025-04-15T12:00:00Z",
"status": "active",
"config": {
"model": "gpt-4",
"temperature": 0.5,
"tools": ["search", "document_retrieval"],
"memory_capacity": 5
},
"stats": {
"total_interactions": 157,
"average_response_time": 2.3,
"last_active": "2025-05-28T18:30:00Z"
}
}
Update Agent
Updates an existing agent's configuration.
Endpoint
PATCH /agents/{agent_id}
Path Parameters
agent_id
: Unique identifier for the agent
Example Request
{
"name": "Advanced Research Buddy",
"config": {
"temperature": 0.7,
"tools": ["search", "document_retrieval", "citation_generator"]
}
}
Example Response
{
"id": "agt_123456789",
"name": "Advanced Research Buddy",
"description": "AI assistant for academic research",
"category": "regular_single",
"created_at": "2025-04-15T12:00:00Z",
"updated_at": "2025-05-29T22:46:00Z",
"status": "active",
"config": {
"model": "gpt-4",
"temperature": 0.7,
"tools": ["search", "document_retrieval", "citation_generator"],
"memory_capacity": 5
}
}
Delete Agent
Deletes an agent. This action cannot be undone.
Endpoint
DELETE /agents/{agent_id}
Path Parameters
agent_id
: Unique identifier for the agent
Example Response
{
"success": true,
"message": "Agent successfully deleted"
}
Interact with Agent
Sends a message to an agent and receives a response.
Endpoint
POST /agents/{agent_id}/interact
Path Parameters
agent_id
: Unique identifier for the agent
Example Request
{
"message": "What are the latest developments in quantum computing?",
"conversation_id": "conv_987654321", // Optional, for continuing a conversation
"context": { // Optional, additional context
"user_expertise": "beginner",
"preferred_sources": ["academic", "news"]
}
}
Example Response
{
"response": "Recent developments in quantum computing include Google's achievement of quantum supremacy, IBM's 127-qubit processor, and advances in error correction. Researchers are now focusing on creating more stable qubits and developing practical quantum algorithms...",
"conversation_id": "conv_987654321",
"message_id": "msg_456789012",
"sources": [
{
"title": "Quantum Computing Progress Report 2025",
"url": "https://example.com/quantum-report-2025",
"snippet": "The field has seen remarkable progress in the last year..."
}
],
"thinking_process": [ // Only included if debug mode is enabled
"Searching for recent quantum computing developments",
"Filtering academic and news sources",
"Summarizing key advancements"
]
}
Tool Endpoints
The following endpoints allow you to manage and use tools that can be integrated with your AI agents.
List Available Tools
Returns a list of all tools available for integration with agents.
Endpoint
GET /tools
Query Parameters
category
: Filter by tool categorylimit
: Maximum number of resultsoffset
: Pagination offset
Example Response
{
"data": [
{
"id": "tool_search",
"name": "Web Search",
"description": "Search the web for information",
"category": "information_retrieval",
"parameters": [
{
"name": "query",
"type": "string",
"required": true,
"description": "Search query"
},
{
"name": "limit",
"type": "integer",
"required": false,
"description": "Maximum number of results",
"default": 5
}
]
},
{
"id": "tool_calculator",
"name": "Calculator",
"description": "Perform mathematical calculations",
"category": "utility",
"parameters": [
{
"name": "expression",
"type": "string",
"required": true,
"description": "Mathematical expression to evaluate"
}
]
}
],
"meta": {
"total": 15,
"limit": 10,
"offset": 0
}
}
Get Tool Details
Retrieves detailed information about a specific tool.
Endpoint
GET /tools/{tool_id}
Path Parameters
tool_id
: Unique identifier for the tool
Example Response
{
"id": "tool_search",
"name": "Web Search",
"description": "Search the web for information",
"category": "information_retrieval",
"version": "1.2.0",
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-03-20T14:30:00Z",
"parameters": [
{
"name": "query",
"type": "string",
"required": true,
"description": "Search query"
},
{
"name": "limit",
"type": "integer",
"required": false,
"description": "Maximum number of results",
"default": 5,
"minimum": 1,
"maximum": 20
},
{
"name": "filter",
"type": "string",
"required": false,
"description": "Filter results by type",
"enum": ["news", "academic", "general"]
}
],
"examples": [
{
"description": "Basic search",
"request": {
"query": "climate change solutions",
"limit": 3
},
"response": "[Example response data...]"
}
],
"usage_limits": {
"requests_per_minute": 30,
"requests_per_day": 5000
},
"documentation_url": "https://docs.agentopia.org/tools/search"
}
Execute Tool
Executes a tool with the provided parameters.
Endpoint
POST /tools/{tool_id}/execute
Path Parameters
tool_id
: Unique identifier for the tool
Example Request (Web Search)
{
"parameters": {
"query": "latest advancements in renewable energy",
"limit": 3,
"filter": "news"
}
}
Example Response
{
"results": [
{
"title": "Breakthrough in Solar Panel Efficiency Reaches 32%",
"url": "https://example.com/solar-breakthrough",
"snippet": "Researchers have developed a new type of solar panel that achieves 32% efficiency, a significant improvement over current commercial panels...",
"published_date": "2025-05-20T08:45:00Z",
"source": "Tech Energy News"
},
{
"title": "Offshore Wind Farm Capacity Doubles in North Sea",
"url": "https://example.com/wind-farm-expansion",
"snippet": "The latest expansion of wind farms in the North Sea has doubled the region's capacity, now providing clean energy to over 10 million homes...",
"published_date": "2025-05-18T14:20:00Z",
"source": "Green Energy Report"
},
{
"title": "New Battery Technology Extends EV Range by 50%",
"url": "https://example.com/ev-battery-advance",
"snippet": "A new solid-state battery technology promises to extend electric vehicle range by up to 50% while reducing charging time to under 15 minutes...",
"published_date": "2025-05-15T11:30:00Z",
"source": "Future Transport Daily"
}
],
"meta": {
"total_results": 1243,
"execution_time": 0.82, // seconds
"query": "latest advancements in renewable energy"
}
}
Data Endpoints
The following endpoints allow you to manage data sources and knowledge bases for your AI agents.
List Data Sources
Returns a list of all data sources associated with your account.
Endpoint
GET /data/sources
Query Parameters
type
: Filter by source typelimit
: Maximum number of resultsoffset
: Pagination offset
Example Response
{
"data": [
{
"id": "src_123456789",
"name": "Company Documentation",
"type": "document_collection",
"created_at": "2025-03-10T14:20:00Z",
"document_count": 42,
"status": "processed"
},
{
"id": "src_987654321",
"name": "Product Database",
"type": "database",
"created_at": "2025-02-15T09:45:00Z",
"record_count": 1250,
"status": "processed"
}
],
"meta": {
"total": 2,
"limit": 20,
"offset": 0
}
}
Create Data Source
Creates a new data source for use with your agents.
Endpoint
POST /data/sources
Request Body
name
: Source name (required)type
: Source type (required)config
: Source configuration
Example Request (Document Collection)
{
"name": "Research Papers",
"type": "document_collection",
"config": {
"chunk_size": 1000,
"chunk_overlap": 200,
"embedding_model": "text-embedding-3-large"
}
}
Example Response
{
"id": "src_567890123",
"name": "Research Papers",
"type": "document_collection",
"created_at": "2025-05-29T22:50:00Z",
"status": "created",
"config": {
"chunk_size": 1000,
"chunk_overlap": 200,
"embedding_model": "text-embedding-3-large"
},
"upload_url": "https://upload.agentopia.org/data/sources/src_567890123/documents"
}
Query Data Source
Performs a semantic search query against a data source.
Endpoint
POST /data/sources/{source_id}/query
Path Parameters
source_id
: Unique identifier for the data source
Example Request
{
"query": "What are the environmental impacts of quantum computing?",
"limit": 5,
"similarity_threshold": 0.75
}
Example Response
{
"results": [
{
"document_id": "doc_123456789",
"chunk_id": "chunk_123456789_5",
"similarity_score": 0.92,
"content": "Quantum computing data centers may consume significantly less energy compared to classical supercomputers for certain computational tasks. A 2024 study by the University of California estimated that quantum computers could reduce energy consumption by up to 90% for specific algorithms like Shor's algorithm and quantum simulation...",
"metadata": {
"title": "Quantum Computing: Environmental Considerations",
"author": "Zhang et al.",
"year": 2024,
"page": 42
}
},
{
"document_id": "doc_987654321",
"chunk_id": "chunk_987654321_12",
"similarity_score": 0.87,
"content": "While quantum computers themselves may be more energy-efficient for certain calculations, the cooling requirements for maintaining quantum coherence present significant energy challenges. Current quantum systems require cooling to near absolute zero temperatures, which demands substantial energy resources...",
"metadata": {
"title": "The Future of Sustainable Computing",
"author": "Johnson et al.",
"year": 2023,
"page": 128
}
}
],
"meta": {
"total_matches": 8,
"returned": 2,
"query_time_ms": 125
}
}