API Reference

The Xagent API provides programmatic access to all platform capabilities — agents, tasks, knowledge bases, models, tools, and more.

Base URL

Singapore:   https://sg-origin.cloud.xagent.co
Australia:   https://au-origin.cloud.xagent.co

Authentication

Most endpoints require a Bearer token:

curl https://sg-origin.cloud.xagent.co/api/agents \
  -H "Authorization: Bearer YOUR_TOKEN"

Interactive Documentation

Every Xagent deployment ships live, auto-generated API explorers built from the server's OpenAPI spec:

ToolPathBest for
Swagger UI/docsTrying requests interactively in the browser.
ReDoc/redocClean, readable reference for the whole API.
OpenAPI JSON/openapi.jsonThe raw spec — import into Postman, codegen, etc.

Live spec

Every deployment serves live explorers generated from its own OpenAPI schema at /docs (Swagger UI) and /redoc. Append those paths to your regional base URL — see Access & Authentication.

Available APIs

Quick Start

Login

curl -X POST https://sg-origin.cloud.xagent.co/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "your-password"}'

Create an Agent

curl -X POST https://sg-origin.cloud.xagent.co/api/agents \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Research Assistant",
    "description": "Helps with research tasks",
    "instructions": "You are a helpful research assistant."
  }'

Submit a Task

This quickstart uses the application API (/api) with the JWT returned from login — see the Chat / Tasks API for the full endpoint reference. For stable, versioned programmatic integration, use the Workspace SDK (/v1) with a runtime key instead.

curl -X POST https://sg-origin.cloud.xagent.co/api/chat/task/create \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Research recent AI trends",
    "description": "Summarize the latest AI research trends",
    "agent_id": 42
  }'

Quotas & Limits

Xagent does not apply per-second or per-minute rate limiting. Instead, each team has monthly usage quotas set by its plan — caps on agents, agent executions per month, and API calls per month.

When a quota is exceeded, the API responds with 402 Payment Required and a message naming the metric that was hit:

HTTP/1.1 402 Payment Required

{ "detail": "Quota exceeded: max_agents (5/5)" }

Check current usage and remaining quota for your team at any time:

GET /api/billing/usage

Error Handling

Errors follow standard HTTP status codes:

CodeMeaning
200Success
400Bad Request
401Unauthorized
422Validation Error
500Server Error

Reference Pages