API Reference
SecureAgent provides a RESTful API for programmatic access.
Base URL
https://secureagent.vercel.app/api
Authentication
Include your API key in request headers:
Authorization: Bearer YOUR_API_KEY
Getting Your API Key
Endpoints
POST /api/chat
Send a message and get an AI response.
curl -X POST https://secureagent.vercel.app/api/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "What is the capital of France?",
"model": "gpt-4o"
}'
Response:
{
"success": true,
"response": "The capital of France is Paris.",
"model": "gpt-4o",
"usage": {
"promptTokens": 12,
"completionTokens": 8,
"totalTokens": 20
}
}
GET /api/skills/marketplace
List available marketplace skills.
curl https://secureagent.vercel.app/api/skills/marketplace \
-H "Authorization: Bearer YOUR_API_KEY"
Query Parameters:
| Parameter | Type | Description |
| query | string | Search term |
| category | string | Filter by category |
| sortBy | string | downloads, rating, recent, name |
| page | number | Page number |
| pageSize | number | Items per page |
GET /api/integrations
List user's connected integrations.
curl https://secureagent.vercel.app/api/integrations \
-H "Authorization: Bearer YOUR_API_KEY"
Error Handling
{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid"
}
}
Common Error Codes
| Code | HTTP Status | Description |
| INVALID_API_KEY | 401 | API key is invalid |
| UNAUTHORIZED | 401 | Not authenticated |
| FORBIDDEN | 403 | Insufficient permissions |
| NOT_FOUND | 404 | Resource not found |
| RATE_LIMITED | 429 | Too many requests |
Rate Limits
| Plan | Requests/minute | Requests/day |
| Free | 20 | 1,000 |
| Pro | 100 | 10,000 |
| Enterprise | Unlimited | Unlimited |
SDKs
JavaScript/TypeScript
npm install @secureagent/sdk
import { SecureAgent } from '@secureagent/sdk';
const agent = new SecureAgent({ apiKey: 'YOUR_API_KEY' });
const response = await agent.chat('What is 2+2?');
Python
pip install secureagent
from secureagent import SecureAgent
agent = SecureAgent(api_key='YOUR_API_KEY')
response = agent.chat('What is 2+2?')