API Documentation

Build with the
CloudAgent API

Every agent is exposed as a clean REST API. Integrate AI-powered workflows into your existing stack in minutes.

Quick Start

Call your agents from any platform. Get responses in seconds.

1

Create an Agent

Design your workflow visually in the dashboard.

2

Enable API Access

Toggle the agent to public to get your webhook URL.

3

Call the API

Send requests from Python, Node, cURL, or any language.

curl -X POST https://api.xyzgent.ai/v1/hooks/{agent_id} \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "query": "Analyze Q3 report..." }'

Built for Production

Low Latency

Edge-optimized infrastructure with sub-100ms response times globally.

Secure by Default

API key authentication, webhook secrets, and encrypted data at rest.

Real-time Events

Server-Sent Events (SSE) for streaming workflow execution updates.

RAG Ready

Built-in vector storage and retrieval for knowledge-augmented agents.

API Reference

Complete REST API documentation for all CloudAgent endpoints.

Authentication

All API requests require authentication via bearer token or API key. Include your credentials in the request headers.

# Using Authorization header
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.xyzgent.ai/v1/apps

# Using webhook secret for public hooks
curl -H "X-Webhook-Secret: YOUR_WEBHOOK_SECRET" \
  -X POST https://api.xyzgent.ai/v1/hooks/{agent_id}

Agents

GET/v1/appsList all agents
POST/v1/appsCreate a new agent
GET/v1/apps/{id}Get agent details
PUT/v1/apps/{id}Update an agent
DELETE/v1/apps/{id}Delete an agent
GET/v1/apps/{id}/statsGet agent statistics

Webhooks

POST/v1/hooks/{agent_id}Trigger agent via webhook
POST/v1/hooks/{agent_id}/streamTrigger with SSE streaming

Workflows

POST/v1/workflowsCreate a workflow
PUT/v1/workflows/{id}Update workflow graph
POST/v1/workflows/{id}/runExecute a workflow

Datasets (RAG)

GET/v1/datasetsList all datasets
POST/v1/datasetsCreate a dataset
GET/v1/datasets/{id}Get dataset details
DELETE/v1/datasets/{id}Delete a dataset
POST/v1/datasets/{id}/documentsUpload a document
GET/v1/datasets/{id}/documentsList documents

Chat

POST/v1/chat-messagesSend message with streaming response

Response Format

All responses are returned in JSON format. Successful webhook triggers include execution metadata in response headers.

// Success response from webhook
{
  "success": true,
  "run_id": "run_abc123",
  "status": "succeeded",
  "duration_ms": 1250,
  "output": "Analysis complete. Key findings: ..."
}

// Response headers include:
// X-Execution-ID: run_abc123
// X-Execution-Status: succeeded
// X-Execution-Duration-Ms: 1250

Streaming Responses

Use the /stream endpoint for real-time SSE events as your workflow executes.

const eventSource = new EventSource(
  'https://api.cloudagent.ai/v1/hooks/{agent_id}/stream'
);

eventSource.onmessage = (event) => {
  const data = JSON.parse(event.data);
  
  switch (data.event) {
    case 'node_started':
      console.log(`Executing: ${data.node_type}`);
      break;
    case 'node_finished':
      console.log(`Output: ${data.output}`);
      break;
    case 'workflow_finished':
      console.log('Complete!');
      eventSource.close();
      break;
  }
};
Coming Soon

Official SDKs

Native client libraries for Python, Node.js, Go, and more. Sign up to get notified when they're ready.

Python
Node.js
Go
Ruby
PHP

Ready to Build?

Start building AI-powered workflows today. Free tier includes 100K tokens.