Melso Docs

Runs

Verified request, response and authorization contracts.

A Run belongs to a Task. Follow-ups, manual reruns, automatic retries, Cloud lifetime rollovers and pauses create distinct Run IDs, so follow the Task’s Runs rather than one Run. Read one Run you already know with GET /api/runs/{runId}; list the Task’s Runs to find its successors, then fetch a Run’s events/messages. All resource paths below use UUIDs unless noted.

Examples use the environment variables from Overview. UUID placeholders must be replaced with your own IDs.

GET /api/tasks/{id}/runs

Auth: Workspace member with access to this resource.

Request: Path: Task ID. No body.

Response: RunResponse array, newest first.

Status: 200. Authentication and resource-access errors follow Overview.

A retry, a Cloud lifetime rollover or a pause adds a successor Run whose parent_run_id is the Run it continues. The predecessor ends as failed (a retry keeps its own failure_reason; a rollover uses provider_lifetime_rollover) or, for a pause, as cancelled with user_paused. The successor starts as queued, deferred or paused. Retries increase attempt up to max_attempts; rollovers keep the same attempt. While any Run is queued, dispatched, running or deferred, the Task is still working. When none is, the newest Run is the outcome: completed has a reply in the Task messages, failed and cancelled carry error and failure_reason (a plain cancel by a person has neither), and paused waits for resume.

curl -sS -X GET "$MELSO_URL/api/tasks/$ID/runs" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

GET /api/runs/{runId}

Auth: Workspace member with access to the Run’s Task, under the same rules as GET /api/tasks/{id}/runs. A workspace API key reads Runs of its own workspace.

Request: Path: Run UUID. No body.

Response: RunResponse, identical to the Run’s item in GET /api/tasks/{id}/runs, including usage and attribution.

Status: 200; 400 invalid UUID; 404 unknown Run. A Run the caller may not see (another workspace, a private Area the caller is not in, an isolated Task for another Task’s Run) returns the same 404. Authentication errors follow Overview.

Use it to poll a Run you already know, such as the run_id a create or follow-up returned. When it ends, list the Task’s Runs: a retry, rollover or pause continues in a successor Run whose parent_run_id is this Run’s ID.

curl -sS -X GET "$MELSO_URL/api/runs/$RUN_ID" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

GET /api/runs/{runId}/events

Auth: Workspace member with access to this resource.

Request: Path: Run UUID. No pagination parameters.

Response: {events:RunEventPayload[]}.

Status: 200; 400 invalid UUID. Authentication and resource-access errors follow Overview.

curl -sS -X GET "$MELSO_URL/api/runs/$RUN_ID/events" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

GET /api/runs/{runId}/messages

Auth: Workspace member with access to this resource.

Request: Path: Run UUID; optional since:integer query.

Response: RunMessagePayload array.

Status: 200. Authentication and resource-access errors follow Overview.

curl -sS -X GET "$MELSO_URL/api/runs/$RUN_ID/messages" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

POST /api/runs/{runId}/cancel

Auth: Workspace member with access to this resource.

Request: Path: Run UUID. Query parameters, not a JSON body: optional task_id=<Task UUID> rejects a Run from another Task; cancelling a queued follow-up uses expected_status=queued plus task_id and queue_action=edit|remove.

Response: RunResponse plus optional cancelled_input:{task_id:UUID,message_id:UUID,content:string,restore_to_input:boolean,attachments:object[]}. Cancelling a Run that already ended returns it unchanged.

Status: 200; 400 invalid query parameters; 404 unknown Run; 409 mismatched Task or a follow-up that is no longer queued. Authentication and resource-access errors follow Overview.

curl -sS -X POST "$MELSO_URL/api/runs/$RUN_ID/cancel?task_id=$ID" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

POST /api/runs/{runId}/pause

Auth: Workspace member with access to this resource.

Request: Path: Run UUID.

Response: RunResponse for the Run it acted on. A live Cloud Run drains first and keeps its status until the worker saves; it then ends cancelled with user_paused and a paused successor appears in the Task’s Runs. A queued or deferred Run is cancelled with user_paused; an already paused Run is returned unchanged.

Status: 200; 409 incompatible Run state. Authentication and resource-access errors follow Overview.

curl -sS -X POST "$MELSO_URL/api/runs/$RUN_ID/pause" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" -d '{}'

POST /api/tasks/{id}/resume

Auth: Human workspace member; rejects Run and MCP actors.

Request: Path: Task UUID. No execution override.

Response: RunResponse for the resumed successor, now queued.

Status: 200; 409 nothing resumable. Authentication and resource-access errors follow Overview.

curl -sS -X POST "$MELSO_URL/api/tasks/$ID/resume" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" -d '{}'

POST /api/tasks/{id}/rerun

Auth: Workspace member with access to this resource.

Request: run_id:UUID: historical source Run in this Task.

Response: RunResponse for the new attempt.

Status: 202; 400 invalid source; 403 execution denied. Authentication and resource-access errors follow Overview.

curl -sS -X POST "$MELSO_URL/api/tasks/$ID/rerun" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" -d '{"run_id":"00000000-0000-4000-8000-000000000001"}'

GET /api/tasks/{id}/execution

Auth: Human workspace member; rejects Run and MCP actors.

Request: Path: Task ID.

Response: {execution:TaskExecutionSettings|null}.

Status: 200. Authentication and resource-access errors follow Overview.

curl -sS -X GET "$MELSO_URL/api/tasks/$ID/execution" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

PUT /api/tasks/{id}/execution

Auth: Human workspace member; rejects Run and MCP actors.

Request: harness:string, optional model:string, thinking_level:string, service_tier:string.

Response: {execution:TaskExecutionSettings}.

Status: 200; 400 invalid selection. Authentication and resource-access errors follow Overview.

curl -sS -X PUT "$MELSO_URL/api/tasks/$ID/execution" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" -d '{"harness":"codex"}'

POST /api/tasks/{id}/start

Auth: Human workspace member; rejects Run and MCP actors.

Request: Optional top-level harness:string, model:string, thinking_level:string, service_tier:string (TaskExecutionRequest). Cannot override max_attempts. Requires saved conversation instructions and an idle open Task.

Response: {run:RunResponse,execution?:TaskExecutionSettings}.

Status: 202; 400 no instructions/invalid selection; 409 not idle or no target. Authentication and resource-access errors follow Overview.

curl -sS -X POST "$MELSO_URL/api/tasks/$ID/start" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" -d '{}'

GET /api/tasks/{id}/queue

Auth: Workspace member with access to this resource.

Request: Path: Task UUID.

Response: TaskRunQueueResponse.

Status: 200. Authentication and resource-access errors follow Overview.

curl -sS -X GET "$MELSO_URL/api/tasks/$ID/queue" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

DELETE /api/tasks/{id}/queue

Auth: Workspace member with access to this resource.

Request: Path: Task UUID.

Response: Empty.

Status: 204. Authentication and resource-access errors follow Overview.

curl -sS -X DELETE "$MELSO_URL/api/tasks/$ID/queue" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

RunResponse

Source: server/internal/handler/run_response.go (RunResponse). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
accessRunAccessReceipt or null (may be omitted)
funding_sourcestring (may be omitted)
hosted_gatewayHostedGatewayExecution or null (may be omitted)
provider_account_idstring (may be omitted)
idstring
execution_owner_idstring
worker_idstring
modelstring (may be omitted)
thinking_levelstring (may be omitted)
service_tierstring (may be omitted)
execution_receiptRunExecutionReceipt or null (may be omitted)
task_idstring
task_identifierstring (may be omitted)
workspace_idstring
plugin_execution_manifestPluginExecutionManifestData or null (may be omitted)
remote_mcp_connectionsRemoteMCPConnection[] (may be omitted)
remote_mcp_daemon_tokenstring (may be omitted)
github_checkout_tokenstring (may be omitted)
github_agent_write_tokenstring (may be omitted)
github_credential_grantstring (may be omitted)
github_pull_request_read_tokenstring (may be omitted)
workspace_contextstring (may be omitted)
thread_namestring (may be omitted)
statusstring
dispatched_atstring or null
started_atstring or null
completed_atstring or null
resultany
errorstring or null
failure_reasonstring (may be omitted)
attemptinteger
max_attemptsinteger
parent_run_idstring or null (may be omitted)
executionRunConfiguration or null (may be omitted)
connected_appsConnectedAppData[] (may be omitted)
reposRepoData[] (may be omitted)
secret_valuesstring[] (may be omitted)
vault_itemsRunVaultItem[] (may be omitted)
vault_filesRunVaultFile[] (may be omitted)
repository_environmentsRunRepositoryEnvironment[] (may be omitted)
area_idstring (may be omitted)
area_titlestring (may be omitted)
area_descriptionstring (may be omitted)
area_resourcesAreaResourceData[] (may be omitted)
created_atstring
prior_session_idstring (may be omitted)
prior_work_dirstring (may be omitted)
prior_session_resume_unavailableboolean (may be omitted)
work_dirstring (may be omitted)
relative_work_dirstring (may be omitted)
branch_namestring (may be omitted)
trigger_message_idstring or null (may be omitted)
coalesced_message_idsstring[] (may be omitted)
coalesced_messagesCoalescedMessageData[] (may be omitted)
delivered_message_idsstring[]
trigger_thread_idstring (may be omitted)
trigger_message_contentstring (may be omitted)
trigger_summarystring or null (may be omitted)
trigger_author_typestring (may be omitted)
trigger_author_namestring (may be omitted)
new_comment_countinteger (may be omitted)
new_comments_sincestring (may be omitted)
chat_messagestring (may be omitted)
chat_message_attachmentsChatAttachmentMeta[] (may be omitted)
chat_transcript_injectedboolean (may be omitted)
chat_transcriptChatTranscriptMessage[] (may be omitted)
automation_invocation_idstring (may be omitted)
automation_idstring (may be omitted)
automation_titlestring (may be omitted)
automation_descriptionstring (may be omitted)
automation_sourcestring (may be omitted)
automation_trigger_payloadJSON (may be omitted)
require_pr_checks_watchboolean (may be omitted)
is_github_pr_review_childboolean (may be omitted)
interaction_continuationInteractionContinuationData or null (may be omitted)
continuation_kindstring (may be omitted)
requesting_user_namestring (may be omitted)
requesting_user_profile_descriptionstring (may be omitted)
initiator_typestring (may be omitted)
initiator_idstring (may be omitted)
initiator_namestring (may be omitted)
initiator_emailstring (may be omitted)
kindstring
attributionRunAttribution or null (may be omitted)
usageRunUsageData[] (may be omitted)
auth_tokenstring (may be omitted)
mount_fs_tokenstring (may be omitted)

TaskRunQueueResponse

Source: server/internal/handler/task_input.go (TaskRunQueueResponse). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
run_idstring (may be omitted)
statusstring (may be omitted)
created_atstring (may be omitted)
queued_runsQueuedRunResponse[] (may be omitted)

GET /api/tasks/{id}/usage

Auth: Workspace member with access to this resource.

Request: No body.

Response: Object of token counters: total_input_tokens, total_output_tokens, total_cache_read_tokens, total_cache_write_tokens, cost_usd_ticks, uncosted_input_tokens, uncosted_output_tokens, uncosted_cache_read_tokens, uncosted_cache_write_tokens, run_count (integers).

Status: 200. Authentication and resource-access errors follow Overview.

curl -sS -X GET "$MELSO_URL/api/tasks/$ID/usage" \
  -H "Authorization: Bearer $MELSO_TOKEN" -H "X-Workspace-ID: $WORKSPACE_ID"

RunEventPayload

Source: server/pkg/protocol/messages.go (RunEventPayload). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
idstring
run_idstring
task_idstring (may be omitted)
sourcestring
kindstring
labelstring (may be omitted)
detailobject (may be omitted)
occurred_atstring
source_atstring (may be omitted)
recorded_atstring

RunMessagePayload

Source: server/pkg/protocol/messages.go (RunMessagePayload). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
run_idstring
task_idstring (may be omitted)
seqinteger
typestring
toolstring (may be omitted)
contentstring (may be omitted)
inputobject (may be omitted)
outputstring (may be omitted)
created_atstring (may be omitted)

QueuedRunResponse

Source: server/internal/handler/task_input.go (QueuedRunResponse). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
run_idstring
statusstring
created_atstring
message_idstring (may be omitted)
contentstring (may be omitted)

TaskExecutionSettings

Source: server/internal/service/run_execution.go (TaskExecutionSettings). Referenced nested objects retain their handler-defined fields; clients should tolerate additional fields.

FieldJSON type
versionstring
harnessstring
modelstring
thinking_levelstring
service_tierstring