logo

API Reference

Welcome to the AI Agent Storefront API documentation. This API allows you to programmatically access and manage AI agents, workflows, and integrations. You can use our API to build custom applications, automate workflows, and integrate our AI capabilities into your existing systems.

Base URL

https://api.aiagent-storefront.com/v1

Secure Authentication

Our API uses API keys for authentication. All API requests must include your API key in the Authorization header.

Global Endpoints

Our API is deployed globally with edge servers to ensure low latency responses no matter where your users are located.

SDKs Available

We provide official SDKs for JavaScript, Python, Ruby, PHP, and Go to make integration even easier.

Comprehensive Docs

Our documentation includes detailed request/response examples, error codes, and integration guides.

cURL
curl -X GET "https://api.aiagent-storefront.com/v1/agents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
JavaScript
import { AIAgentClient } from '@aiagent-storefront/sdk';
const client = new AIAgentClient('YOUR_API_KEY');
async function getAgents() {
try {
const agents = await client.agents.list();
console.log(agents);
} catch (error) {
console.error('Error fetching agents:', error);
}
}
Python
from aiagent_storefront import AIAgentClient
client = AIAgentClient('YOUR_API_KEY')
try:
agents = client.agents.list()
print(agents)
except Exception as e:
print(f"Error fetching agents: {e}")
Ruby
require 'aiagent_storefront'
client = AIAgentStorefront::Client.new(api_key: 'YOUR_API_KEY')
begin
agents = client.agents.list
puts agents
rescue AIAgentStorefront::Error => e
puts "Error fetching agents: #{e.message}"
end
PHP
<?php
require_once 'vendor/autoload.php';
$client = new \AIAgentStorefront\Client('YOUR_API_KEY');
try {
$agents = $client->agents->list();
print_r($agents);
} catch (\AIAgentStorefront\Exception\ApiException $e) {
echo 'Error fetching agents: ' . $e->getMessage();
}

Authentication

All API requests must include an API key in the Authorization header. You can generate an API key from your account dashboard.

API Key Authentication

HTTP Header
Authorization: Bearer YOUR_API_KEY

Security Warning

Never share your API keys or include them in client-side code. Always make API requests from your server-side code to protect your API keys.

API Key Permissions

You can create API keys with different permission levels:

Permission Level Description Recommended For
Read-only Can only access GET endpoints Dashboards, reporting tools
Standard Can access GET, POST, and PUT endpoints Most integrations
Admin Full access to all endpoints Administrative tools

API Key Management

We recommend rotating your API keys periodically for security. You can create new API keys and delete old ones from your account dashboard.

Errors

Our API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided information (e.g., a required parameter was missing), and codes in the 5xx range indicate an error with our servers.

Error Code Description
400 Bad Request - Your request is invalid or malformed.
401 Unauthorized - Your API key is invalid or missing.
404 Not Found - The specified resource could not be found.
429 Too Many Requests - You've exceeded the rate limit.
500 Internal Server Error - We had a problem with our server.

Error Response Format

All error responses include a JSON object with the following properties:

JSON
{
"error": {
"code": "invalid_request",
"message": "The request was unacceptable, often due to missing a required parameter.",
"status": 400,
"details": {
"missing_fields": ["name"]
}
}
}

Common Error Codes

Error Code Description
invalid_request The request was unacceptable, often due to missing a required parameter.
authentication_error Authentication failed, typically due to an invalid API key.
rate_limit_exceeded You've exceeded the rate limit for API requests.
resource_not_found The requested resource does not exist.
server_error Something went wrong on our end.

Rate Limits

To ensure the stability of our API and provide fair usage for all users, we implement rate limits on API requests. Rate limits vary based on your subscription plan.

Plan Rate Limit Burst Limit
Free 60 requests per minute 100 requests per minute
Basic 300 requests per minute 500 requests per minute
Pro 1,000 requests per minute 1,500 requests per minute
Enterprise Custom Custom

Rate Limit Headers

All API responses include headers that provide information about your current rate limit status:

Header Description
X-RateLimit-Limit The maximum number of requests you're permitted to make per minute.
X-RateLimit-Remaining The number of requests remaining in the current rate limit window.
X-RateLimit-Reset The time at which the current rate limit window resets in UTC epoch seconds.

Rate Limit Exceeded

If you exceed the rate limit, you will receive a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait before retrying.

HTTP Response
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 30
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1617203146
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please retry after 30 seconds.",
"status": 429
}
}

Best Practices

To avoid hitting rate limits, implement exponential backoff with jitter for retries and cache responses when appropriate.

Versioning

Our API uses versioning to ensure backward compatibility as we evolve the platform. The current version is v1, which is included in the URL path.

https://api.aiagent-storefront.com/v1/agents

Version Lifecycle

We follow these principles for API versioning:

  • New features and non-breaking changes are added to the current version
  • Breaking changes trigger a new version
  • We maintain at least two versions simultaneously
  • We provide at least 6 months notice before deprecating a version

Version Header

You can also specify the API version using the X-API-Version header:

HTTP Header
X-API-Version: v1

Note

If both the URL path and header specify a version, the header takes precedence.

Agents

GET

List Agents

/agents

Returns a list of all agents associated with your account.

Query Parameters

Parameter Type Required Description
limit integer No Maximum number of agents to return (default: 20, max: 100)
offset integer No Number of agents to skip (default: 0)
category string No Filter agents by category
status string No Filter agents by status (active, inactive)
cURL
curl -X GET "https://api.aiagent-storefront.com/v1/agents?limit=10&category=sales" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
JavaScript
import { AIAgentClient } from '@aiagent-storefront/sdk';
const client = new AIAgentClient('YOUR_API_KEY');
async function listAgents() {
try {
const agents = await client.agents.list({
limit: 10,
category: 'sales'
});
console.log(agents);
} catch (error) {
console.error('Error listing agents:', error);
}
}
Python
from aiagent_storefront import AIAgentClient
client = AIAgentClient('YOUR_API_KEY')
try:
agents = client.agents.list(
limit=10,
category='sales'
)
print(agents)
except Exception as e:
print(f"Error listing agents: {e}")

Response

JSON
{
"data": [
{
"id": "agt_1234567890",
"name": "SalesGPT Pro",
"description": "AI-powered sales assistant that qualifies leads and books meetings",
"category": "sales",
"status": "active",
"created_at": "2025-03-15T14:30:45Z",
"updated_at": "2025-04-10T09:12:33Z",
"capabilities": ["lead_qualification", "meeting_scheduling", "follow_up"],
"pricing": {
"monthly": 49,
"yearly": 490,
"currency": "USD"
}
},
{
"id": "agt_0987654321",
"name": "ContentWizard",
"description": "Multi-format content creator for blogs, social media, and ads",
"category": "marketing",
"status": "active",
"created_at": "2025-02-20T11:15:22Z",
"updated_at": "2025-04-08T16:45:10Z",
"capabilities": ["blog_writing", "social_media_posts", "ad_copy"],
"pricing": {
"monthly": 39,
"yearly": 390,
"currency": "USD"
}
}
],
"meta": {
"total": 42,
"limit": 10,
"offset": 0
}
}
GET

Get Agent

/agents/:id

Retrieves the details of an existing agent by ID.

Path Parameters

Parameter Type Required Description
id string Yes The ID of the agent to retrieve
cURL
curl -X GET "https://api.aiagent-storefront.com/v1/agents/agt_1234567890" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
JavaScript
import { AIAgentClient } from '@aiagent-storefront/sdk';
const client = new AIAgentClient('YOUR_API_KEY');
async function getAgent() {
try {
const agent = await client.agents.retrieve('agt_1234567890');
console.log(agent);
} catch (error) {
console.error('Error retrieving agent:', error);
}
}
Python
from aiagent_storefront import AIAgentClient
client = AIAgentClient('YOUR_API_KEY')
try:
agent = client.agents.retrieve('agt_1234567890')
print(agent)
except Exception as e:
print(f"Error retrieving agent: {e}")

Response

JSON
{
"id": "agt_1234567890",
"name": "SalesGPT Pro",
"description": "AI-powered sales assistant that qualifies leads and books meetings",
"category": "sales",
"status": "active",
"created_at": "2025-03-15T14:30:45Z",
"updated_at": "2025-04-10T09:12:33Z",
"capabilities": ["lead_qualification", "meeting_scheduling", "follow_up"],
"pricing": {
"monthly": 49,
"yearly": 490,
"currency": "USD"
},
"configuration": {
"language_model": "gpt-4",
"temperature": 0.7,
"max_tokens": 2048
},
"integrations": [
{
"id": "int_5678901234",
"type": "crm",
"name": "Salesforce",
"status": "active"
},
{
"id": "int_6789012345",
"type": "calendar",
"name": "Google Calendar",
"status": "active"
}
],
"usage": {
"current_month": {
"api_calls": 1245,
"tokens": 3567890
}
}
}
POST

Create Agent

/agents

Creates a new agent with the provided parameters.

Request Body

Parameter Type Required Description
name string Yes Name of the agent
description string Yes Description of the agent
category string Yes Category of the agent (sales, marketing, support, etc.)
capabilities array No Array of capabilities the agent has
configuration object No Configuration settings for the agent
cURL
curl -X POST "https://api.aiagent-storefront.com/v1/agents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "CustomSalesBot",
"description": "Customized sales assistant for our team",
"category": "sales",
"capabilities": ["lead_qualification", "meeting_scheduling"],
"configuration": {
"language_model": "gpt-4",
"temperature": 0.7,
"max_tokens": 2048
}
}'
JavaScript
import { AIAgentClient } from '@aiagent-storefront/sdk';
const client = new AIAgentClient('YOUR_API_KEY');
async function createAgent() {
try {
const agent = await client.agents.create({
name: "CustomSalesBot",
description: "Customized sales assistant for our team",
category: "sales",
capabilities: ["lead_qualification", "meeting_scheduling"],
configuration: {
language_model: "gpt-4",
temperature: 0.7,
max_tokens: 2048
}
});
console.log(agent);
} catch (error) {
console.error('Error creating agent:', error);
}
}
Python
from aiagent_storefront import AIAgentClient
client = AIAgentClient('YOUR_API_KEY')
try:
agent = client.agents.create(
name="CustomSalesBot",
description="Customized sales assistant for our team",
category="sales",
capabilities=["lead_qualification", "meeting_scheduling"],
configuration={
"language_model": "gpt-4",
"temperature": 0.7,
"max_tokens": 2048
}
)
print(agent)
except Exception as e:
print(f"Error creating agent: {e}")

Response

JSON
{
"id": "agt_2345678901",
"name": "CustomSalesBot",
"description": "Customized sales assistant for our team",
"category": "sales",
"status": "active",
"created_at": "2025-04-12T10:15:30Z",
"updated_at": "2025-04-12T10:15:30Z",
"capabilities": ["lead_qualification", "meeting_scheduling"],
"configuration": {
"language_model": "gpt-4",
"temperature": 0.7,
"max_tokens": 2048
}
}

API Console

Test API requests directly from your browser. Select an endpoint, customize parameters, and see the response in real-time.

Request Builder

Response

// Response will appear here after sending a request

SDKs & Libraries

We provide official SDKs for multiple programming languages to make integration with our API even easier.

JavaScript SDK

Our JavaScript SDK works in both Node.js and browser environments.

npm
npm install @aiagent-storefront/sdk
JavaScript
import { AIAgentClient } from '@aiagent-storefront/sdk';
// Initialize the client with your API key
const client = new AIAgentClient('YOUR_API_KEY');
// List agents
async function listAgents() {
try {
const agents = await client.agents.list({
limit: 10,
category: 'sales'
});
console.log(agents);
} catch (error) {
console.error('Error:', error);
}
}
// Execute a workflow
async function executeWorkflow() {
try {
const result = await client.workflows.execute('wf_1234567890', {
input: {
customer_name: 'John Doe',
email: 'john@example.com'
}
});
console.log(result);
} catch (error) {
console.error('Error:', error);
}
}

Python SDK

Our Python SDK is compatible with Python 3.7 and above.

pip
pip install aiagent-storefront
Python
from aiagent_storefront import AIAgentClient
# Initialize the client with your API key
client = AIAgentClient('YOUR_API_KEY')
# List agents
def list_agents():
try:
agents = client.agents.list(
limit=10,
category='sales'
)
print(agents)
except Exception as e:
print(f"Error: {e}")
# Execute a workflow
def execute_workflow():
try:
result = client.workflows.execute(
'wf_1234567890',
input={
'customer_name': 'John Doe',
'email': 'john@example.com'
}
)
print(result)
except Exception as e:
print(f"Error: {e}")