# List all job runs

> Source: https://docs.clonepartner.com/api-reference/job-runs/list-all-job-runs/

`GET /api/job-runs`

List all job runs

**Operation ID:** `listAllJobRuns`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Query parameters

- `cursor` — `string`
  Pagination cursor from a previous response
- `limit` — `integer`
  Maximum number of results to return
  Example: `50`
  - Default: `50`
  - Maximum: 200
- `job_id` — `integer`
  Filter by job ID
- `status` — `string`
  - Allowed values: `pending`, `running`, `paused`, `completed`, `success`, `failed`, `cancelled`

## Success responses

### 200

Paginated list of job runs

**Content type:** `application/json`

- Type: `PaginatedResult & object`
- All of:
  - Variant 1:
    - Reference: `PaginatedResult`
      - Type: `object`
      - Properties:
        - `result` (`array<unknown>`)
          - Items:
            - Type: `unknown`
        - `nextCursor` (`string | null`)
          - Nullable: yes
        - `prevCursor` (`string | null`)
          - Nullable: yes
        - `total` (`integer`) — Total number of records matching the current filters
  - Variant 2:
    - Type: `object`
    - Properties:
      - `result` (`array<JobRun>`)
        - Items:
          - Reference: `JobRun`
            - Type: `object`
            - Properties:
              - `id` (`integer`)
              - `job_id` (`integer`)
              - `status` (`string`)
                - Allowed values: `pending`, `running`, `paused`, `completed`, `failed`, `cancelled`
              - `started_at` (`string | null`)
                - Format: `date-time`
                - Nullable: yes
              - `completed_at` (`string | null`)
                - Format: `date-time`
                - Nullable: yes
              - `duration_ms` (`integer | null`)
                - Nullable: yes
              - `error_message` (`string | null`)
                - Nullable: yes
              - `selected_tasks` (`string | null`) — JSON-encoded array of task keys to run (null = all)
                - Description: JSON-encoded array of task keys to run (null = all)
                - Nullable: yes
              - `run_state` (`string | null`) — Internal DAG execution state (JSON)
                - Description: Internal DAG execution state (JSON)
                - Nullable: yes
              - `skip_deps` (`integer | null`) — 1 when selected tasks should run without their upstream depends_on tasks; 0/null otherwise.
                - Description: 1 when selected tasks should run without their upstream depends_on tasks; 0/null otherwise.
                - Nullable: yes
              - `created_at` (`string`)
                - Format: `date-time`
              - `updated_at` (`string`)
                - Format: `date-time`

## Examples

### cURL

```bash
curl --request GET \
  --url 'https://your-envoy.example.com/api/job-runs?cursor=YOUR_CURSOR&limit=50' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/job-runs?cursor=YOUR_CURSOR&limit=50', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
