API Documentation

Build with the
XYZGent 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.com/v1/hooks/{agent_id} \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Secret: your-secret" \
  -d '{ "customer_name": "John", "amount": 100 }'

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 XYZgent endpoints.

Authentication

API requests use JWT bearer tokens for authenticated routes. Public webhooks use X-Webhook-Secret header.

# Authenticated API requests (JWT token)
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -H "X-Tenant-ID: YOUR_TENANT_ID" \
  https://api.xyzgent.com/v1/apps

# Public webhook (no auth, uses secret)
curl -H "X-Webhook-Secret: YOUR_WEBHOOK_SECRET" \
     -H "Content-Type: application/json" \
  -X POST https://api.xyzgent.com/v1/hooks/{agent_id} \
  -d '{"input": "value"}'

Agents

GET/v1/appsList all agents
POST/v1/appsCreate a new agent
GET/v1/apps/{id}Get agent details with workflow
PUT/v1/apps/{id}Update an agent
DELETE/v1/apps/{id}Delete an agent
GET/v1/apps/{id}/statsGet execution stats and activity
GET/v1/apps/{id}/executions/{exec_id}Get execution logs

Webhooks

POST/v1/hooks/{agent_id}Trigger agent workflow
POST/v1/hooks/{agent_id}/streamStream execution via SSE

Workflows

GET/v1/workflows/{id}Get workflow graph
PUT/v1/workflows/{id}Update workflow graph
POST/v1/workflows/{id}/publishPublish workflow version
POST/v1/workflows/{id}/runExecute workflow with SSE

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
GET/v1/datasets/{id}/documentsList documents
POST/v1/datasets/{id}/documentsUpload document (PDF, DOCX, TXT, CSV)
DELETE/v1/datasets/{id}/documents/{doc_id}Delete a document

Chat

POST/v1/chat-messagesSend message with streaming response
POST/v1/chat-widgets/{id}/messagePublic chat with RAG support

Chat Widgets

GET/v1/chat-widgetsList all chat widgets
POST/v1/chat-widgetsCreate embeddable widget
GET/v1/chat-widgets/{id}Get widget configuration
PUT/v1/chat-widgets/{id}Update widget settings
DELETE/v1/chat-widgets/{id}Delete a widget
GET/v1/chat-widgets/{id}/publicPublic widget config

Forms

GET/v1/formsList all forms
POST/v1/formsCreate form linked to agent
GET/v1/forms/{id}Get form schema
PUT/v1/forms/{id}Update form fields
DELETE/v1/forms/{id}Delete a form
GET/v1/forms/{id}/submissionsList form submissions
POST/v1/forms/{id}/public/submitPublic form submission

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.xyzgent.com/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.