# Get Job Status

`GET /api/jobs/{jobId}`

## Description
Poll an execution by its execution ID: the jobId from an async receipt, or the executionId from a pending receipt or an X-Execution-Id header. Statuses are pending, processing, paused, completed, failed, and cancelled. The same API key that started the run can poll it. After the run's execution record expires (7 days after it finishes on SteelEngine Cloud), the status comes from run history: metadata.source is run-history and output is the run-history copy. Once run history is deleted (30 days on SteelEngine Cloud), the lookup returns 404.

## Parameters

- **jobId** (path) (required) — `string`: The execution ID (returned as jobId in the async receipt).

## Responses

### 200 — Current status of the execution. output is present once the run has a result.

```json
{
  "type": "object",
  "description": "Status of an execution looked up by its execution ID.",
  "properties": {
    "success": {
      "type": "boolean",
      "description": "Whether the lookup succeeded.",
      "example": true
    },
    "jobId": {
      "type": "string",
      "description": "The execution ID that was looked up.",
      "example": "exec_9f8e7d6c5b"
    },
    "taskId": {
      "type": "string",
      "description": "Same value as jobId, kept for compatibility.",
      "example": "exec_9f8e7d6c5b"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "processing",
        "paused",
        "completed",
        "failed",
        "cancelled"
      ],
      "description": "pending: admitted but not yet running. processing: running. paused: waiting for human input, not finished. completed, failed, and cancelled are terminal.",
      "example": "completed"
    },
    "metadata": {
      "type": "object",
      "description": "Execution metadata: workflowId, workspaceId, userId, and executionId. Once the run has finished, it also contains the timing fields startTime, endTime, duration, and the timingSemanticsVersion 2 fields.",
      "additionalProperties": true,
      "properties": {
        "workflowId": {
          "type": "string"
        },
        "workspaceId": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        },
        "executionId": {
          "type": "string"
        },
        "startTime": {
          "type": "string",
          "format": "date-time"
        },
        "endTime": {
          "type": "string",
          "format": "date-time"
        },
        "duration": {
          "type": "integer",
          "description": "Duration in milliseconds."
        },
        "source": {
          "type": "string",
          "enum": [
            "run-history"
          ],
          "description": "Present when the status comes from run history because the run's execution record has expired."
        }
      }
    },
    "output": {
      "description": "Present once the run has a result. For an async execution this is the workflow output, or {data, status, headers} when the workflow ended in a Response block. For a synchronous run that returned a pending receipt, this is the full execution result (success, executionId, output, error, status, metadata). When metadata.source is run-history, this is the run-history copy of the workflow output, which is size-capped and has secrets removed.",
      "example": {
        "result": "Hello, world!"
      }
    },
    "error": {
      "type": "string",
      "description": "Present when status is failed or cancelled.",
      "example": "Workflow execution failed"
    },
    "startedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the run started. Present once the result is available."
    },
    "completedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the run finished. Absent for paused runs."
    },
    "executedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Same as completedAt. Present for async executions only."
    }
  }
}
```

### 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."
    }
  }
}
```

### 503 — The execution result could not be recovered. Retry this status lookup. Do not resubmit the execution.

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "example": false
    },
    "code": {
      "type": "string",
      "example": "RESULT_UNAVAILABLE"
    },
    "error": {
      "type": "string"
    },
    "executionId": {
      "type": "string"
    },
    "jobId": {
      "type": "string"
    },
    "taskId": {
      "type": "string"
    },
    "statusUrl": {
      "type": "string"
    }
  }
}
```
