# Resume Execution

`POST /api/resume/{workflowId}/{executionId}/{contextId}`

## Description
Submit a decision for a paused Human in the Loop block and continue the run. Requires write access to the workflow. The body is the resume input, either wrapped in input or sent as top-level fields. The decision is approved unless the input sets _humanInTheLoopDecision (or decision) to denied or rejected. Each resume chooses its own response mode: synchronous by default, Server-Sent Events with Accept: text/event-stream or X-Stream-Response: true, or asynchronous with X-Execution-Mode: async (async wins when both are sent).

## Parameters

- **workflowId** (path) (required) — `string`: The unique identifier of the workflow.

- **executionId** (path) (required) — `string`: The execution that paused.

- **contextId** (path) (required) — `string`: The pause point to resume, from the pause point or its resumeLinks.

- **X-Execution-Mode** (header) — `string`: Set to async to return 202 immediately with a statusUrl to poll.

- **X-Stream-Response** (header) — `string`: Set to true to stream post-resume events as Server-Sent Events.

## Request Body

```json
{
  "type": "object",
  "properties": {
    "input": {
      "type": "object",
      "description": "Values for the Resume Form fields, plus an optional _humanInTheLoopDecision."
    }
  },
  "additionalProperties": true
}
```

## Responses

### 200 — Synchronous result of the resumed run, an opened Server-Sent Events stream, or status queued with a queuePosition when another resume for this execution is already running. A queued response is JSON even when streaming was requested. A resumed run that reaches another Human in the Loop block returns status paused with new _resume links in output. With Accept: text/event-stream or X-Stream-Response: true, consume the SSE data frames described below.

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "The runtime result status is returned unchanged. Successful completion can be success (per-block execution) or completed (legacy execution or the fallback when a successful result omits status). Other outcomes are failed, cancelled, paused when more human input is needed, or queued when another resume is already running. paused and queued are not terminal outcomes.",
      "example": "success"
    },
    "executionId": {
      "type": "string",
      "description": "The execution ID of the resumed run."
    },
    "rootExecutionId": {
      "type": "string"
    },
    "output": {
      "description": "The workflow output."
    },
    "error": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "properties": {
        "duration": {
          "type": "number"
        },
        "startTime": {
          "type": "string",
          "format": "date-time"
        },
        "endTime": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "queuePosition": {
      "type": "integer",
      "description": "Present when status is queued."
    },
    "message": {
      "type": "string"
    }
  }
}
```

### 202 — The resume was accepted and is running. Returned for X-Execution-Mode: async, or when a synchronous wait timed out (status processing). Poll statusUrl with Get Job Status.

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "async": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "accepted, queued, or processing."
    },
    "jobId": {
      "type": "string"
    },
    "executionId": {
      "type": "string"
    },
    "rootExecutionId": {
      "type": "string"
    },
    "statusUrl": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  }
}
```

### 400 — The resume could not be queued. error carries the reason.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
```

### 401 — Invalid or missing API key. Ensure the X-API-Key header is set with a valid key.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 403 — Access denied. You do not have permission to access this resource. For audit log endpoints, this requires an Enterprise subscription and organization admin/owner role.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 404 — The requested resource was not found. Verify the ID is correct and belongs to your workspace.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 409 — The pause point named by contextId is not waiting: "Resume request does not match the durable execution state".

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
```

### 503 — The durable resume service or the resume event stream is temporarily unavailable. Retry later.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
```
