Skip to content

API Overview

Moxxy v4 exposes a REST API for managing agents, runs, memory, skills, vault secrets, channels, and more.

Base URL

http://127.0.0.1:3000

The port is configurable via the MOXXY_PORT environment variable.

All endpoints are prefixed with /v1/.

Authentication

Bearer Tokens

Moxxy uses Bearer tokens with a mox_ prefix. Tokens are SHA-256 hashed at rest.

bash
curl -H "Authorization: Bearer mox_your_token_here" http://127.0.0.1:3000/v1/agents

Loopback Mode

By default, Moxxy runs in loopback mode, which bypasses authentication for requests originating from localhost (127.0.0.1 or ::1). This simplifies local development.

Bootstrap Flow

The very first token creation requires no authentication. This allows you to bootstrap the system:

bash
# First token (no auth required)
curl -X POST http://127.0.0.1:3000/v1/auth/tokens \
  -H "Content-Type: application/json" \
  -d '{"scopes": ["*"]}'

Subsequent token creation requires a token with the tokens:admin scope.

Token Scopes

ScopeDescription
agents:readRead agent details and list agents
agents:writeCreate, update, and delete agents
runs:writeStart runs, stop agents, reset sessions
vault:readList vault secrets
vault:writeCreate, delete secrets and grants
tokens:adminCreate and revoke API tokens
events:readSubscribe to SSE event stream
channels:readList channels
channels:writeCreate, delete, and pair channels
*Wildcard -- grants all scopes

Response Format

All responses return direct JSON (not wrapped in a {success, data} envelope). For example, listing agents returns an array directly:

json
[
  {
    "name": "researcher",
    "created_at": "2025-03-15T10:00:00Z"
  }
]

Errors

Errors return the appropriate HTTP status code with a JSON body:

json
{
  "error": "Agent 'unknown' not found"
}

HTTP Status Codes

CodeMeaning
200Success
201Created
204No Content (successful deletion)
400Bad Request
401Unauthorized
403Forbidden (insufficient scope)
404Not Found
429Too Many Requests
500Internal Server Error

Rate Limiting

Rate limiting is configurable via RateLimitConfig (powered by tower-governor). The default configuration is permissive. The health check endpoint (/v1/health) is exempt from rate limiting.

SSE Event Stream

Moxxy provides a Server-Sent Events stream for real-time event monitoring:

GET /v1/events/stream

Filter events with query parameters:

ParameterDescription
agent_idFilter by agent
run_idFilter by run
event_typeFilter by event type

Events are delivered as EventEnvelope objects:

json
{
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2025-03-15T10:00:00Z",
  "agent_id": "researcher",
  "run_id": "run_abc123",
  "sequence": 1,
  "event_type": "run.started",
  "payload": {}
}

There are roughly 60 event types including run.started, run.completed, run.failed, message.user, message.assistant, model.request, model.response, skill.invoked, skill.completed, memory.stored, vault.accessed, heartbeat.fired, channel.message_received, and more.

API Endpoints Overview

Auth

MethodEndpointDescription
POST/v1/auth/tokensCreate API token
GET/v1/auth/tokensList tokens
DELETE/v1/auth/tokens/{id}Revoke token

Agents

MethodEndpointDescription
POST/v1/agentsCreate agent
GET/v1/agentsList agents
GET/v1/agents/{name}Get agent details
PATCH/v1/agents/{name}Update agent
DELETE/v1/agents/{name}Delete agent
POST/v1/agents/{name}/runsStart a run
POST/v1/agents/{name}/stopStop running agent
POST/v1/agents/{name}/resetReset session
GET/v1/agents/{name}/historyGet conversation history
POST/v1/agents/{name}/ask-responses/{question_id}Answer agent question

Providers

MethodEndpointDescription
GET/v1/providersList installed providers
POST/v1/providersInstall provider
GET/v1/providers/{id}/modelsList models for provider

Memory

MethodEndpointDescription
GET/v1/agents/{id}/memory/searchSemantic + keyword search
POST/v1/agents/{id}/memory/compactTrigger memory compaction

Skills

MethodEndpointDescription
GET/v1/agents/{id}/skillsList skills
POST/v1/agents/{id}/skills/installInstall skill
DELETE/v1/agents/{id}/skills/{skill_id}Delete skill

Heartbeats

MethodEndpointDescription
POST/v1/agents/{id}/heartbeatsCreate scheduled heartbeat
GET/v1/agents/{id}/heartbeatsList heartbeats
DELETE/v1/agents/{id}/heartbeats/{hb_id}Disable heartbeat

Vault

MethodEndpointDescription
POST/v1/vault/secretsCreate secret reference
GET/v1/vault/secretsList secret references
DELETE/v1/vault/secrets/{id}Delete secret
POST/v1/vault/grantsGrant agent access to secret

Templates

MethodEndpointDescription
POST/v1/templatesCreate template
GET/v1/templatesList templates
GET/v1/templates/{slug}Get template

Webhooks

MethodEndpointDescription
POST/v1/hooks/{token}Receive inbound webhook (HMAC verified, no auth)
GET/v1/agents/{name}/webhooksList agent webhooks
DELETE/v1/agents/{name}/webhooks/{slug}Delete webhook

Channels

MethodEndpointDescription
POST/v1/channelsCreate channel
GET/v1/channelsList channels
POST/v1/channels/pairPair chat to agent
DELETE/v1/channels/{id}Delete channel

MCP

MethodEndpointDescription
GET/v1/agents/{id}/mcpList MCP servers
POST/v1/agents/{id}/mcpAdd MCP server
DELETE/v1/agents/{id}/mcp/{id}Remove MCP server

Events & Health

MethodEndpointDescription
GET/v1/events/streamSSE event stream
GET/v1/auditQuery audit log
GET/v1/healthHealth check

Client Examples

cURL

bash
curl http://127.0.0.1:3000/v1/agents \
  -H "Authorization: Bearer mox_your_token_here"

JavaScript/TypeScript

typescript
const response = await fetch('http://127.0.0.1:3000/v1/agents', {
  headers: { 'Authorization': 'Bearer mox_your_token_here' }
});
const agents = await response.json();

Python

python
import requests

response = requests.get(
    'http://127.0.0.1:3000/v1/agents',
    headers={'Authorization': 'Bearer mox_your_token_here'}
)
agents = response.json()

Open source · Self-hosted · Data sovereign