API Documentation

Build powerful AI-driven applications with our comprehensive RESTful API. Complete reference guides, code examples, and SDKs to accelerate your development.

Quick Start

Get up and running in minutes

Our API is designed for simplicity and power. Start building intelligent applications with just a few lines of code.

Authentication

All API requests require authentication using your API key. Include it in the Authorization header:

curl -H "Authorization: Bearer your-api-key-here" \
     -H "Content-Type: application/json" \
     https://api.joyfulagents.com/v1/agents

API Endpoints

Comprehensive reference for all available endpoints and their capabilities.

Create Agent

POST

/v1/agents

Create a new AI agent with specified capabilities and configuration.

Request Body:

{
  "name": "Customer Support Agent",
  "description": "Handles customer inquiries and support requests",
  "type": "conversational",
  "capabilities": [
    "natural_language_processing",
    "sentiment_analysis",
    "knowledge_retrieval"
  ],
  "knowledge_base_id": "kb_12345",
  "max_tokens": 2048,
  "temperature": 0.7
}

Response:

{
  "id": "agent_67890",
  "name": "Customer Support Agent",
  "status": "active",
  "created_at": "2024-12-10T10:30:00Z",
  "api_endpoint": "https://api.joyfulagents.com/v1/agents/agent_67890/chat"
}

List Agents

GET

/v1/agents

Retrieve a list of all your AI agents with their current status and configuration.

Query Parameters:

Parameter Type Description
limit integer Number of agents to return (max 100)
status string Filter by status (active, inactive, training)

Response:

{
  "agents": [
    {
      "id": "agent_67890",
      "name": "Customer Support Agent",
      "type": "conversational",
      "status": "active",
      "created_at": "2024-12-10T10:30:00Z"
    }
  ],
  "total": 1,
  "has_more": false
}

Chat with Agent

POST

/v1/agents/{agent_id}/chat

Send a message to an AI agent and receive an intelligent response.

Request Body:

{
  "message": "How do I reset my password?",
  "session_id": "session_12345",
  "context": {
    "user_id": "user_98765",
    "previous_interactions": 3
  },
  "stream": false
}

Response:

{
  "id": "msg_11111",
  "response": "To reset your password, please follow these steps: 1) Go to the login page, 2) Click 'Forgot Password', 3) Enter your email address, 4) Check your email for reset instructions.",
  "session_id": "session_12345",
  "timestamp": "2024-12-10T10:35:00Z",
  "confidence": 0.95,
  "sources": [
    {
      "title": "Password Reset Guide",
      "url": "https://docs.example.com/password-reset"
    }
  ]
}

Agent Analytics

GET

/v1/agents/{agent_id}/analytics

Get detailed analytics and performance metrics for a specific agent.

Response:

{
  "agent_id": "agent_67890",
  "period": "last_30_days",
  "total_interactions": 15420,
  "average_response_time": 1.2,
  "satisfaction_score": 4.7,
  "resolution_rate": 0.89,
  "top_intents": [
    {"intent": "password_reset", "count": 3245},
    {"intent": "billing_inquiry", "count": 2891},
    {"intent": "technical_support", "count": 2156}
  ]
}

SDKs & Libraries

Official SDKs and community libraries to accelerate your integration in your favorite programming language.

Python SDK

Official Python library with full API coverage and async support.

pip install joyful-agents

Node.js SDK

TypeScript-first SDK for Node.js and browser applications.

npm install @joyful-agents/sdk

REST API

Direct HTTP API access for any programming language or platform.

https://api.joyfulagents.com/v1

Rate Limits & Best Practices

Guidelines to ensure optimal performance and reliability in your integrations.

Rate Limits

Starter Plan

100 requests/minute

Professional Plan

1,000 requests/minute

Enterprise Plan

Custom limits based on your needs

Rate limit headers are included in all responses to help you track your usage and implement proper backoff strategies.

Best Practices

  • Implement exponential backoff for rate-limited requests
  • Use session IDs to maintain conversation context
  • Cache responses when appropriate to reduce API calls
  • Monitor API response times and error rates
  • Keep API keys secure and rotate them regularly

Need Help Getting Started?

Our developer support team is here to help you integrate and optimize your AI agents.