Docs/API Reference

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

  • Go to /dashboard/settings
  • Navigate to "API Keys"
  • Click "Generate New 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:
    ParameterTypeDescription
    querystringSearch term
    categorystringFilter by category
    sortBystringdownloads, rating, recent, name
    pagenumberPage number
    pageSizenumberItems 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

    CodeHTTP StatusDescription
    INVALID_API_KEY401API key is invalid
    UNAUTHORIZED401Not authenticated
    FORBIDDEN403Insufficient permissions
    NOT_FOUND404Resource not found
    RATE_LIMITED429Too many requests

    Rate Limits

    PlanRequests/minuteRequests/day
    Free201,000
    Pro10010,000
    EnterpriseUnlimitedUnlimited

    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?')