Skip to content

API and MCP

REST API

Authentication, the response envelope, pagination, errors and the OpenAPI document for /api/v1.

Last updated 1 min read Edit this page on GitHub
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:

Bash
curl -H "Authorization: Bearer $USERTASKS_API_KEY" https://tasks.example.com/api/v1/me

GET /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:

JSON
{ "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:

JSON
{
  "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" }]
}
StatusMeaning
400Validation failed (details lists each problem)
401Missing, invalid, expired or revoked credential
403The credential lacks the permission or OAuth scope (insufficient_scope names the missing scope)
404Not found in this workspace
409Conflict (for example a duplicate name)
429Rate limited (agent execution); honour Retry-After
5xxServer 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:

Bash
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:

Bash
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.

Was this page helpful?