Departments Docs

API Reference

Complete API documentation for the Departments neural operating system. All endpoints are available via both GraphQL and REST, secured by Bearer token authentication.

Base URL

https://api.departments.cyrus365.com/v1

Authentication: Bearer token via Authorization header

Authentication

All API requests require a valid API token. Pass it in the Authorization header:

curl https://api.departments.cyrus365.com/v1/agents \
  -H "Authorization: Bearer dep_live_c7x3k9m2_..." \
  -H "Content-Type: application/json"
HeaderValueRequired
AuthorizationBearer dep_live_<token>Yes
Content-Typeapplication/jsonYes
X-Departments-Version4.2.7No (defaults to latest)
X-Request-Id<uuid>Recommended

Agents

Manage agent lifecycles — deploy, list, inspect, and terminate.

GET
/agents

Returns all agents in the nexus.

// Response
{
  "data": [
    {
      "id": "agt_c7x3k9m2",
      "name": "cogniscan-Ω",
      "status": "ACTIVE",
      "role": "market-intelligence",
      "uptime_seconds": 8472,
      "throughput_ops": 847.3,
      "latency_ms": 12,
      "model": "gpt-4o",
      "created_at": "2026-06-01T10:00:00Z"
    }
  ],
  "meta": {
    "total": 4,
    "page": 1,
    "per_page": 10
  }
}
POST
/agents/deploy

Deploy a new agent from a configuration file.

// Request
{
  "config": "agents/cogniscan.yml",
  "replicas": 2,
  "region": "us-neural-1",
  "environment": { "DEP_DEBUG": "false" }
}

// Response
{
  "job_id": "j_8k2m4x9q",
  "agent_id": "agt_c7x3k9m2",
  "status": "PROVISIONING",
  "estimated_ready_seconds": 4
}
DELETE
/agents/:id

Terminate an agent and free its resources.

// Response
{
  "id": "agt_c7x3k9m2",
  "status": "TERMINATED",
  "terminated_at": "2026-06-09T14:23:00Z",
  "uptime_seconds": 15283,
  "total_ops_processed": 12456789
}

GraphQL Endpoint

The GraphQL endpoint is available at https://api.departments.cyrus365.com/graphql.

query GetAgentStatus {
  agent(id: "agt_c7x3k9m2") {
    name
    status
    metrics {
      throughput
      latency
      memoryUsage
    }
    currentTask {
      id
      type
      progress
    }
  }
  nexus {
    clusters {
      id
      region
      activeAgents
      loadPercent
    }
  }
}

Example response:

{
  "data": {
    "agent": {
      "name": "cogniscan-Ω",
      "status": "ACTIVE",
      "metrics": {
        "throughput": 847.3,
        "latency": 12.4,
        "memoryUsage": 0.67
      },
      "currentTask": {
        "id": "task_m9k2x7p3",
        "type": "competitive-analysis",
        "progress": 0.73
      }
    }
  }
}

WebSocket / Events

Subscribe to real-time agent events via WebSocket at wss://api.departments.cyrus365.com/events.

// Connect
const ws = new WebSocket("wss://api.departments.cyrus365.com/events?token=dep_live_...");

ws.onmessage = (event) => {
  const { type, data } = JSON.parse(event.data);
  switch (type) {
    case "agent.status_change":
      console.log(`Agent ${data.agent_id} is now ${data.status}`);
      break;
    case "consensus.result":
      console.log(`Consensus reached: ${data.decision}`);
      break;
    case "alert.threshold":
      console.warn(`${data.metric} exceeded threshold: ${data.value}`);
      break;
  }
};

// Available event types
// agent.status_change      → Agent state transitions
// consensus.result         → Decision outcomes
// alert.threshold          → Metric threshold breaches
// task.completed           → Task execution results
// nexus.scale_event        → Auto-scaling notifications

Error Codes

CodeHTTP StatusDescription
INVALID_AUTH401Missing or expired token
RATE_LIMITED429Too many requests (1000 req/s per token)
AGENT_NOT_FOUND404Agent ID does not exist
INSUFFICIENT_CREDITS402Account balance too low
DEPLOYMENT_FAILED500Agent failed to provision
CONSENSUS_TIMEOUT408Voting round exceeded timeout