> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentgate.mynewapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Work Orders

> Retrieve a paginated list of work orders with optional filtering

# List Work Orders

Returns a paginated list of work orders with optional status filtering.

## Request

<ParamField query="status" type="string">
  Filter by work order status. One of: `queued`, `running`, `waiting_for_children`, `integrating`, `succeeded`, `failed`, `canceled`
</ParamField>

<ParamField query="limit" type="number" default="20">
  Maximum number of results to return (1-100)
</ParamField>

<ParamField query="offset" type="number" default="0">
  Number of results to skip for pagination
</ParamField>

```bash theme={null}
curl "https://agentgate.mynewapi.com/api/v1/work-orders?status=running&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

<ResponseField name="success" type="boolean" required>
  Indicates if the request was successful
</ResponseField>

<ResponseField name="data" type="object" required>
  Paginated work order list

  <Expandable title="properties">
    <ResponseField name="items" type="array" required>
      Array of work order summaries

      <Expandable title="properties">
        <ResponseField name="id" type="string">
          Work order ID (e.g., `wo_abc123`)
        </ResponseField>

        <ResponseField name="taskPrompt" type="string">
          Task description
        </ResponseField>

        <ResponseField name="status" type="string">
          Current status: `queued`, `running`, `waiting_for_children`, `integrating`, `succeeded`, `failed`, `canceled`
        </ResponseField>

        <ResponseField name="workspaceSource" type="object">
          Workspace source information

          <Expandable title="properties">
            <ResponseField name="type" type="string">
              Source type: `local`, `github`, `github-new`
            </ResponseField>

            <ResponseField name="path" type="string">
              Local path (for local type)
            </ResponseField>

            <ResponseField name="repo" type="string">
              Repository `owner/repo` (for github types)
            </ResponseField>

            <ResponseField name="branch" type="string">
              Branch name (for github type)
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="agentType" type="string">
          Agent driver type
        </ResponseField>

        <ResponseField name="createdAt" type="string">
          ISO 8601 timestamp
        </ResponseField>

        <ResponseField name="updatedAt" type="string">
          ISO 8601 timestamp of last update
        </ResponseField>

        <ResponseField name="runCount" type="number">
          Number of runs for this work order
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number" required>
      Total number of matching work orders
    </ResponseField>

    <ResponseField name="limit" type="number" required>
      Number of results per page
    </ResponseField>

    <ResponseField name="offset" type="number" required>
      Current offset
    </ResponseField>

    <ResponseField name="hasMore" type="boolean" required>
      Whether more results are available
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "wo_abc123",
        "taskPrompt": "Add input validation to login form",
        "status": "running",
        "workspaceSource": {
          "type": "github",
          "repo": "myorg/frontend",
          "branch": "main"
        },
        "agentType": "claude-code-subscription",
        "createdAt": "2024-01-15T10:30:00.000Z",
        "updatedAt": "2024-01-15T10:35:00.000Z",
        "runCount": 1
      },
      {
        "id": "wo_def456",
        "taskPrompt": "Fix authentication bug",
        "status": "running",
        "workspaceSource": {
          "type": "github",
          "repo": "myorg/backend",
          "branch": "develop"
        },
        "agentType": "claude-code-subscription",
        "createdAt": "2024-01-15T09:00:00.000Z",
        "updatedAt": "2024-01-15T10:30:00.000Z",
        "runCount": 2
      }
    ],
    "total": 45,
    "limit": 10,
    "offset": 0,
    "hasMore": true
  },
  "requestId": "req_xyz789"
}
```

## Status Values

| Status                 | Description                       |
| ---------------------- | --------------------------------- |
| `queued`               | Waiting to be processed           |
| `running`              | Currently being executed          |
| `waiting_for_children` | Waiting for sub-tasks to complete |
| `integrating`          | Merging results                   |
| `succeeded`            | Completed successfully            |
| `failed`               | Execution failed                  |
| `canceled`             | Canceled by user                  |

## Pagination Example

```bash theme={null}
# First page
curl "https://agentgate.mynewapi.com/api/v1/work-orders?limit=20&offset=0" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Second page
curl "https://agentgate.mynewapi.com/api/v1/work-orders?limit=20&offset=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Filter by Status

```bash theme={null}
# Get only running work orders
curl "https://agentgate.mynewapi.com/api/v1/work-orders?status=running" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Get only failed work orders
curl "https://agentgate.mynewapi.com/api/v1/work-orders?status=failed&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
```
