@extends('dashboard') @section('page-title', $agent->name . ' - API Documentation') @section('content')

Authentication

All API requests require authentication using your agent's API key. Include the API key in the header of each request.

API Key Header

X-API-Key: YOUR_API_KEY
Keep your API key secure!

Never share your API key publicly or commit it to version control. You can regenerate your API key at any time from the agent settings page.

Base URL

All API requests should be made to the following base URL:

{{ $agent->deployment_url }}

Endpoints

Send a Message

POST /api/v1/chat

Send a message to the AI agent and receive a response.

Request Parameters

Parameter Type Required Description
message string Yes The message to send to the agent.
conversation_id string No ID of an existing conversation. Include this to continue a previous conversation.
context object No Additional context information to help the agent generate better responses.

Example Request

curl -X POST "{{ $agent->deployment_url }}/api/v1/chat" \
     -H "Content-Type: application/json" \
     -H "X-API-Key: YOUR_API_KEY" \
     -d '{
       "message": "What services do you offer?",
       "context": {
         "user_type": "prospect",
         "referrer": "pricing_page"
       }
     }'

Response

{
  "response": "We offer a wide range of services including web hosting, domain registration, email hosting, and AI-powered solutions. Our hosting plans start at $5.99/month and include 24/7 support. Would you like me to provide more details about any specific service?",
  "conversation_id": "conv_3f8a9d2e7c1b",
  "created_at": "2023-08-15T14:32:07Z"
}

Check Agent Status

GET /api/v1/status

Check if the agent is available and get its current status.

Example Request

curl -X GET "{{ $agent->deployment_url }}/api/v1/status" \
     -H "X-API-Key: YOUR_API_KEY"

Response

{
  "status": "available",
  "version": "1.0.0",
  "model": "{{ $agent->model_type }}"
}

Response Codes

Code Description
200 Success. The request was processed successfully.
400 Bad Request. The request was malformed or missing required parameters.
401 Unauthorized. Invalid or missing API key.
429 Too Many Requests. You've exceeded the rate limit for your plan.
500 Server Error. Something went wrong on our end.

Rate Limits

API requests are subject to rate limiting to ensure fair usage across all users.

Current rate limits for your plan:

Endpoint Limit Window
/api/v1/chat 60 requests per minute
/api/v1/status 300 requests per minute

When a rate limit is exceeded, the API will return a 429 response code with a Retry-After header indicating when you can try again.

SDKs & Libraries

We provide official client libraries to help you integrate with the API more easily:

JavaScript

Easily integrate the agent into your web applications.

View on NPM

Python

Perfect for backend applications and data analysis.

View on PyPI

PHP

Integrate with your PHP applications.

View on Packagist
@endsection @push('styles') @endpush @push('scripts') @endpush