API Reference
The CMDOP REST API provides programmatic access to manage sessions, machines, commands, files, schedules, and webhooks. Authenticate with a Bearer token, send requests to https://api.cmdop.com/v1, and receive JSON responses. Rate limits range from 100 req/min (Free) to 10,000 req/min (Enterprise). Official Python SDK is recommended over raw API calls.
What is the base URL?
https://api.cmdop.com/v1For self-hosted:
https://your-domain.com/api/v1How do I authenticate?
All requests require an API key:
# Include API key as Bearer token in Authorization header
curl https://api.cmdop.com/v1/sessions \
-H "Authorization: Bearer cmd_xxx"Get your API key from dashboard settings .
What is the response format?
All responses are JSON:
{
"data": { ... },
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-02-14T10:30:00Z"
}
}What does a success response look like?
{
"data": {
"session_id": "sess_abc123",
"status": "CONNECTED"
}
}What does an error response look like?
{
"error": {
"code": "session_not_found",
"message": "Session not found",
"details": {
"session_id": "sess_invalid"
}
}
}What HTTP status codes does the API return?
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 204 | No Content |
| 400 | Bad Request — Invalid parameters |
| 401 | Unauthorized — Invalid or missing API key |
| 403 | Forbidden — No permission |
| 404 | Not Found — Resource doesn’t exist |
| 409 | Conflict — Resource already exists |
| 422 | Unprocessable — Validation failed |
| 429 | Rate Limited — Too many requests |
| 500 | Server Error — Internal error |
| 503 | Service Unavailable — Temporary outage |
What are the rate limits?
Default limits:
| Tier | Requests/minute |
|---|---|
| Free | 100 |
| Pro | 1,000 |
| Enterprise | 10,000 |
Headers in response:
X-RateLimit-Limit: 1000 # Max requests per window
X-RateLimit-Remaining: 999 # Requests remaining
X-RateLimit-Reset: 1707903600 # Unix timestamp when limit resetsWhen rate limited (429):
{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded",
"details": {
"retry_after": 60
}
}
}How does pagination work?
List endpoints support pagination:
# Paginate with limit (page size) and offset (skip count)
curl "https://api.cmdop.com/v1/sessions?limit=10&offset=0"Parameters:
| Parameter | Default | Max |
|---|---|---|
limit | 20 | 100 |
offset | 0 | — |
Response:
{
"data": [...],
"meta": {
"total": 45,
"limit": 10,
"offset": 0,
"has_more": true
}
}How do I filter results?
Many endpoints support filtering:
# Filter by status
curl "https://api.cmdop.com/v1/sessions?status=CONNECTED"
# Filter by machine
curl "https://api.cmdop.com/v1/sessions?machine_hostname=prod-server"
# Multiple filters
curl "https://api.cmdop.com/v1/sessions?status=CONNECTED&machine_hostname=prod-server"How do I sort results?
# Sort by created date (descending)
curl "https://api.cmdop.com/v1/sessions?sort=-created_at"
# Sort by hostname (ascending)
curl "https://api.cmdop.com/v1/machines?sort=hostname"What endpoints are available?
Sessions
| Method | Endpoint | Description |
|---|---|---|
| GET | /sessions | List sessions |
| GET | /sessions/:id | Get session |
| POST | /sessions/:id/attach | Attach to session |
| POST | /sessions/:id/detach | Detach from session |
Machines
| Method | Endpoint | Description |
|---|---|---|
| GET | /machines | List machines |
| GET | /machines/:id | Get machine |
| DELETE | /machines/:id | Remove machine |
Commands
| Method | Endpoint | Description |
|---|---|---|
| POST | /commands | Execute command |
| GET | /commands/:id | Get command result |
Files
| Method | Endpoint | Description |
|---|---|---|
| GET | /files | List files |
| GET | /files/content | Read file |
| PUT | /files/content | Write file |
| DELETE | /files | Delete file |
Webhooks
| Method | Endpoint | Description |
|---|---|---|
| GET | /webhooks | List webhooks |
| POST | /webhooks | Create webhook |
| DELETE | /webhooks/:id | Delete webhook |
Are there official SDKs available?
We recommend using official SDKs instead of raw API:
- Python SDK — Full-featured async SDK
- CLI — Command-line access
How do I use real-time streaming?
For real-time streaming, use the gRPC API via SDK.
What should I read next?
API keys and OAuth
Session management
Command execution