Tasks

These endpoints require a task-specific access token issued by Munchii. The token must belong to the task identified in the URL. Standard session tokens are not accepted.

/tasks/{taskId}
  • GETGet the task’s details and execution inputs.

    Sample request

    GET /tasks/task_123 HTTP/1.1
    Host: api.munchii.com
    Authorization: Bearer <task-token>

    Example response

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "data": {
        "type": "munchii:pipeline:update@1",
        "parameters": {},
        "state": "",
        "inputs": [
          {
            "name": "bundle",
            "size": 2048,
            "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
          }
        ],
        "context": {
          "spaceId": "space_123",
          "pipelineName": "web"
        }
      }
    }

    Common errors

    • 403 The caller lacks permission for this operation.
    • 404 The task was not found.
/tasks/{taskId}/access-token
  • GETGet an access token scoped to the task.

    Sample request

    GET /tasks/task_123/access-token HTTP/1.1
    Host: api.munchii.com
    Authorization: Bearer <task-token>

    Example response

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "data": {
        "value": "<task-access-token>"
      }
    }

    Common errors

    • 403 The caller lacks permission for this operation.
    • 404 The task was not found.
/tasks/{taskId}/status
  • POSTReport a task status change, such as starting, succeeding, or failing.

    Sample request

    POST /tasks/task_123/status HTTP/1.1
    Host: api.munchii.com
    Authorization: Bearer <task-token>
    Content-Type: application/json
    
    {
      "status": "running"
    }

    Example response

    HTTP/1.1 204 No Content

    Empty response body.

    Common errors

    • 400 Use application/json and send valid JSON that matches the expected schema.
    • 403 The caller lacks permission for this operation.
    • 404 The task was not found.
/tasks/{taskId}/continuation
  • POSTSave the task’s continuation state and schedule it to resume after a delay.

    Sample request

    POST /tasks/task_123/continuation HTTP/1.1
    Host: api.munchii.com
    Authorization: Bearer <task-token>
    Content-Type: application/json
    
    {
      "state": "eyJzdGVwIjoxfQ==",
      "resume": {
        "delay": "PT5M"
      }
    }

    Example response

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "data": {
        "taskId": "task_123",
        "version": 2,
        "runnableAt": "2026-01-15T12:05:00.000Z"
      }
    }

    Common errors

    • 400 The body is invalid or the resume delay is outside 30 seconds to 4 hours.
    • 403 The caller lacks permission for this operation.
    • 404 The task was not found.
/tasks/{taskId}/metering
  • POSTReport usage measured by the task runner.

    Sample request

    POST /tasks/task_123/metering HTTP/1.1
    Host: api.munchii.com
    Authorization: Bearer <task-token>
    Content-Type: application/json
    
    {
      "input": {
        "artifacts": [
          {
            "name": "bundle",
            "uncompressedBytes": 4096
          }
        ]
      }
    }

    Example response

    HTTP/1.1 204 No Content

    Empty response body.

    Common errors

    • 400 Use application/json and send valid JSON that matches the expected schema.
    • 403 The caller lacks permission for this operation.
    • 404 The task was not found.