# List runs

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

`GET /api/runs`

List runs

**Operation ID:** `listRuns`

## 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
- `sort` — `string`
  Column name to sort by (validated per-entity)
- `order` — `string`
  Sort direction
  Example: `desc`
  - Allowed values: `asc`, `desc`
  - Default: `desc`
- `task_id` — `integer`
  Filter by task ID
- `status` — `string`
  - Allowed values: `pending`, `running`, `success`, `completed`, `failed`, `cancelled`

## Success responses

### 200

Paginated list of 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<Run>`)
        - Items:
          - Reference: `Run`
            - Type: `object`
            - Properties:
              - `id` (`integer`)
              - `task_id` (`integer`)
              - `task_version` (`integer`)
              - `trigger_type` (`string`)
                - Allowed values: `manual`, `cron`, `api`
              - `status` (`string`)
                - Allowed values: `pending`, `running`, `success`, `completed`, `failed`, `cancelled`
              - `arguments` (`string | null`) — JSON-encoded arguments
                - Description: JSON-encoded arguments
                - Nullable: yes
              - `connector_mapping` (`string | null`) — JSON-encoded map of connector slot name to connector ID
                - Description: JSON-encoded map of connector slot name to connector ID
                - Nullable: yes
              - `started_at` (`string | null`)
                - Format: `date-time`
                - Nullable: yes
              - `completed_at` (`string | null`)
                - Format: `date-time`
                - Nullable: yes
              - `duration_ms` (`integer | null`)
                - Nullable: yes
              - `item_count` (`integer | null`)
                - Nullable: yes
              - `error_message` (`string | null`)
                - Nullable: yes
              - `log_file` (`string | null`)
                - Nullable: yes
              - `metrics_summary` (`string | null`)
                - 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/runs?cursor=YOUR_CURSOR&limit=50' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/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);
```
