> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://onepin.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://onepin.ai/docs/_mcp/server.

# List Runs

GET https://api.onepin.ai/api/v1/workflows/{workflow_id}/runs

List runs for a workflow, newest first by default.

Returns a counted, paginated list of runs for the specified workflow.
Each item includes the run's status, step progress (`total_steps`,
`finished_steps`), credit usage, and the actor who triggered it.

**Status filter:** Pass `?status=completed,failed` to OR-match multiple
statuses. Values must be the raw lowercase RunStatus strings. Unknown values
or empty tokens (e.g. `a,,b`) return 422.

**Pagination:** `pagination.total` reflects the filtered count. Sort
tiebreaks always append `id ASC` for stable offset/limit pagination.

For aggregate statistics (pass rate, average duration) across all runs,
use `GET /runs/summary` instead.

Reference: https://onepin.ai/docs/reference/api-reference/workflows/runs/list

## Authentication

- `Authorization` header (bearer token, required) — Clerk JWT token
- `Authorization` header (bearer token, required) — Onepin live API key (`op_live_...`). Test and public keys are reserved in Phase 1.

## Servers

- `https://api.onepin.ai` (prod, default)
- `https://dev-api.onepin.ai` (dev)

## Request

### Path parameters

- `workflow_id` (string, required)

### Query parameters

- `offset` (integer, optional, default: 0) — Zero-based pagination offset.
- `limit` (integer, optional, default: 20) — Maximum items to return (1–100).
- `status` (string, optional, nullable) — Comma-separated raw RunStatus values (e.g. `completed,failed`). Values are case-sensitive lowercase: `pending`, `running`, `completed`, `failed`, `cancelled`, `paused`. Multiple values OR-match. Empty tokens (e.g. `a,,b`) and unknown values return 422.
- `search` (string, optional, nullable) — Case-insensitive search over the triggering user's display name (falls back to email).
- `sort` (enum, optional, default: created_at) — Sort field: `created_at` | `started_at` | `completed_at` | `status`. Defaults to `created_at`.
  - Allowed values: `created_at`, `started_at`, `completed_at`, `status`
- `order` (enum, optional, default: desc) — `asc` or `desc`. Defaults to `desc`.
  - Allowed values: `asc`, `desc`

### Headers

- `X-Workspace-Id` (string, optional, nullable)

## Response

### 200

Successful Response

- `data` (list of WorkflowRunListItem, required)
- `meta` (Meta, required)
- `pagination` (CountedPaginationMeta, required) — PaginationMeta variant for endpoints that compute an unpaginated total.

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### WorkflowRunListItem

- `id` (string, required)
- `status` (string, required)
- `run_number` (integer, required)
- `created_at` (datetime, required)
- `total_nodes` (integer, optional, default: 0)
- `total_steps` (integer, optional, default: 0)
- `finished_steps` (integer, optional, default: 0)
- `finished_nodes` (integer, optional, default: 0)
- `credits` (integer, optional, default: 0) — Credits debited from the user's spendable balance for this run; excludes invoiced overage.
- `usage_summary` (map from string to any, optional)
- `started_at` (datetime, optional, nullable)
- `completed_at` (datetime, optional, nullable)
- `pause_requested_at` (datetime, optional, nullable)
- `paused_at` (datetime, optional, nullable)
- `paused_ms` (integer, optional, default: 0)
- `pause_reason` (enum, optional, nullable) — Why the run is paused or draining toward an automatic pause. Manual pauses use user; null when no pause is active.
  - Allowed values: `user`, `provider_outage`, `provider_rate_limited`, `provider_billing`, `node_timeout`
- `pause_error` (string, optional, nullable) — Aggregate customer-facing explanation for an automatic pause. Null for manual pauses and separate from terminal error.
- `triggered_by` (TriggeredByOut, optional, nullable) — Actor that triggered a workflow run. ``user_name`` is guaranteed non-empty: derived from ``donut.utils.user.user_display_name`` which falls back to ``email`` when both first/last names are empty (``email`` is NOT NULL on User).
- `output_line_count` (integer, optional, nullable)
- `delivered_audio_ms` (integer, optional, nullable)

### Meta

- `request_id` (string, required)
- `timestamp` (datetime, required)

### CountedPaginationMeta

PaginationMeta variant for endpoints that compute an unpaginated total.

- `limit` (integer, required)
- `total` (integer, required)
- `next` (string, optional, nullable)
- `prev` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### TriggeredByOut

Actor that triggered a workflow run. ``user_name`` is guaranteed non-empty: derived from ``donut.utils.user.user_display_name`` which falls back to ``email`` when both first/last names are empty (``email`` is NOT NULL on User).

- `user_id` (string, required)
- `user_name` (string, required)

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "string",
      "status": "string",
      "run_number": 1,
      "created_at": "2024-01-15T09:30:00Z",
      "total_nodes": 0,
      "total_steps": 0,
      "finished_steps": 0,
      "finished_nodes": 0,
      "credits": 0,
      "usage_summary": {},
      "started_at": "2024-01-15T09:30:00Z",
      "completed_at": "2024-01-15T09:30:00Z",
      "pause_requested_at": "2024-01-15T09:30:00Z",
      "paused_at": "2024-01-15T09:30:00Z",
      "paused_ms": 0,
      "pause_reason": "user",
      "pause_error": "string",
      "triggered_by": {
        "user_id": "string",
        "user_name": "string"
      },
      "output_line_count": 1,
      "delivered_audio_ms": 1
    }
  ],
  "meta": {
    "request_id": "string",
    "timestamp": "2024-01-15T09:30:00Z"
  },
  "pagination": {
    "limit": 1,
    "total": 1,
    "next": "string",
    "prev": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.onepin.ai/api/v1/workflows/workflow_id/runs"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.onepin.ai/api/v1/workflows/workflow_id/runs';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.onepin.ai/api/v1/workflows/workflow_id/runs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.onepin.ai/api/v1/workflows/workflow_id/runs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.onepin.ai/api/v1/workflows/workflow_id/runs")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.onepin.ai/api/v1/workflows/workflow_id/runs', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.onepin.ai/api/v1/workflows/workflow_id/runs");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.onepin.ai/api/v1/workflows/workflow_id/runs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```