API and MCP
REST API
Authentication, the response envelope, pagination, errors and the OpenAPI document for /api/v1.
On this page
Everything in UserTasks is available under /api/v1. The API is described by an OpenAPI 3.1 document at /api/v1/openapi.json (public, no auth), which also generates the SDK types and the CLI commands. Browse it interactively in the API Explorer, or see the endpoint list.
Authentication#
Send an API key or an OAuth access token as a bearer token:
curl -H "Authorization: Bearer $USERTASKS_API_KEY" https://tasks.example.com/api/v1/meGET /api/v1/me describes the credential: workspace, user, kind (API key or OAuth), permissions, scopes and expiry. Each endpoint requires one permission (listed in the endpoint list and the OpenAPI document as x-permission).
Envelope#
Successful responses are wrapped:
{ "success": true, "data": { "workflows": [ … ], "total": 42 } }Errors keep the same shape with an HTTP status, a message, and optionally a machine-readable code and details:
{
"success": false,
"error": "Validation failed: name: Too small: expected string to have >=1 characters",
"code": "validation_error",
"details": [{ "path": "body.name", "message": "Too small: expected string to have >=1 characters", "code": "too_small" }]
}| Status | Meaning |
|---|---|
| 400 | Validation failed (details lists each problem) |
| 401 | Missing, invalid, expired or revoked credential |
| 403 | The credential lacks the permission or OAuth scope (insufficient_scope names the missing scope) |
| 404 | Not found in this workspace |
| 409 | Conflict (for example a duplicate name) |
| 429 | Rate limited (agent execution); honour Retry-After |
| 5xx | Server error — safe to retry idempotent requests |
Pagination#
List endpoints take limit (1–100, default 50; 0 for no limit) and offset, and return total. The event endpoints use a cursor instead (after / next_cursor). The SDK's client.paginate() and the CLI's --all fetch every page for you.
Round-tripping resources#
Update endpoints accept their own GET response as the body: read-only fields are ignored and __SECRET__ keeps a stored credential. So GET → edit → PUT/PATCH works for every resource, and unchanged workflows, decision tables, objects and webhooks report changed: false.
Starting work#
Start a workflow and wait for the result:
curl -X POST "$USERTASKS_URL/api/v1/workflows/start" -H "Authorization: Bearer $USERTASKS_API_KEY" \
-H "Content-Type: application/json" -d '{"workflow_id":"<id>","variables":{"amount":1200}}'Or queue it and poll the run:
curl -X POST "$USERTASKS_URL/api/v1/workflows/start" … -d '{"workflow_id":"<id>","async":true}'
curl "$USERTASKS_URL/api/v1/workflows/runs/<run-id>" -H "Authorization: Bearer $USERTASKS_API_KEY"Events#
GET /api/v1/events and the Server-Sent Events stream GET /api/v1/events/stream expose the event stream.
Same operations everywhere#
REST, MCP and the CLI cover the same operations for every configurable resource; see Surface parity.