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

# Get All Runs in a Space

> Retrieve all batch executions associated with a specific space

<ResponseExample>
  ```json Success Response (200) theme={null}
  {
    "count": 9,
    "status_code": 200,
    "message": "Runs Fetched Successfully",
    "data": [
      {
        "run_id": "Recac64fe03e911f1878d43cd8a99e069",
        "collection_ref": "collection_data_SA2W8R6NZRK6C9PO3JSL1J85",
        "run_mode": "prefect",
        "status": "completed",
        "created": "2026-02-07T05:57:45",
        "modified": "2026-02-07T05:57:45"
      }
    ]
  }
  ```

  ```json Error Response (206) theme={null}
  {
    "message": "Error fetching runs",
    "errors": "Detailed error description"
  }
  ```
</ResponseExample>

# Get All Runs in a Space

Retrieve all runs associated with a specific space. A run represents a batch execution - a group of tasks triggered together within a space. This endpoint returns run details including run ID, status, timestamps, and associated collection metadata.

<Note>
  **Prerequisites:** Make sure you have your API Token ready. See [Authentication](/api/get-started/authentication) for details.
</Note>

***

### Path Parameters

| Name         | Type   | Required | Description                        |
| ------------ | ------ | -------- | ---------------------------------- |
| space\_token | string | Yes      | Public token identifying the space |

<Note>
  You can get the `space_token` by hitting the [Get All Spaces](/api/space/get-all-spaces) API. The `token` field in the response is your Space Token.
</Note>

### Headers

| Name          | Type   | Required | Description                     |
| ------------- | ------ | -------- | ------------------------------- |
| Authorization | string | Yes      | API Key format: `Token <token>` |
| Content-Type  | string | Yes      | `application/json`              |

### Response Fields

| Field        | Type    | Description          |
| ------------ | ------- | -------------------- |
| count        | integer | Total number of runs |
| status\_code | integer | HTTP status code     |
| message      | string  | Response message     |
| data         | array   | Array of run objects |

### Run Object Fields

| Field           | Type   | Description                                             |
| --------------- | ------ | ------------------------------------------------------- |
| run\_id         | string | Unique run identifier                                   |
| collection\_ref | string | Reference to the data collection                        |
| run\_mode       | string | Execution engine: `prefect`, etc.                       |
| status          | string | Run status: `completed`, `running`, `failed`, `pending` |
| created         | string | Run creation timestamp                                  |
| modified        | string | Last modified timestamp                                 |

## Common Error Codes

| Status Code | Description                                     |
| ----------- | ----------------------------------------------- |
| 200         | Success - Data fetched successfully             |
| 206         | Partial Content - Business logic error occurred |
| 400         | Bad Request - Invalid parameters provided       |
| 401         | Unauthorized - Invalid or missing API token     |
| 403         | Forbidden - Access denied to the resource       |
| 404         | Not Found - Space not found                     |
| 500         | Internal Server Error - Server-side error       |

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const axios = require('axios');

  const headers = {
    'Authorization': 'Token your-api-token',
    'Content-Type': 'application/json'
  };

  // Get all runs in a space
  const getAllRuns = async (spaceToken) => {
    const response = await axios.get(
      `https://unpod.ai/api/v2/platform/spaces/${spaceToken}/runs/`,
      { headers }
    );
    console.log(`Total runs: ${response.data.count}`);
    response.data.data.forEach(run => {
      console.log(`Run ${run.run_id}: ${run.status} (${run.run_mode})`);
    });
    return response.data.data;
  };

  // Example usage
  getAllRuns('8KZAMRAHSXXXXXXMAYNASMJC');
  ```

  ```python Python theme={null}
  import requests

  headers = {
      'Authorization': 'Token your-api-token',
      'Content-Type': 'application/json'
  }

  def get_all_runs(space_token: str):
      """Get all runs in a space"""
      url = f'https://unpod.ai/api/v2/platform/spaces/{space_token}/runs/'
      response = requests.get(url, headers=headers)
      data = response.json()
      print(f"Total runs: {data['count']}")
      for run in data['data']:
          print(f"Run {run['run_id']}: {run['status']} ({run['run_mode']})")
      return data['data']

  # Example usage
  get_all_runs('8KZAMRAHSXXXXXXMAYNASMJC')
  ```

  ```bash cURL theme={null}
  # Get all runs in a space
  curl -X GET "https://unpod.ai/api/v2/platform/spaces/8KZAMRAHSXXXXXXMAYNASMJC/runs/" \
    -H "Authorization: Token your-api-token" \
    -H "Content-Type: application/json"
  ```
</CodeGroup>

## Best Practices

1. **Space Token**: Always use the correct space token for your API requests
2. **Run ID**: Store the `run_id` from each run to query tasks within that run
3. **Status Monitoring**: Poll this endpoint to track the status of ongoing batch executions
4. **Error Handling**: Always handle potential errors and edge cases
5. **Security**: Keep API tokens secure and rotate them regularly


## OpenAPI

````yaml GET /api/v2/platform/spaces/{space_token}/runs/
openapi: 3.0.3
info:
  title: Unpod API
  description: REST API for Unpod Voice AI Platform
  version: 2.0.0
servers:
  - url: https://unpod.ai/
    description: QA
  - url: https://unpod.ai/
    description: Production
security: []
tags:
  - name: Organisation
  - name: Spaces
  - name: Agents
  - name: Tasks
  - name: Runs
  - name: Call Logs
  - name: Analytics
  - name: Providers
  - name: Bridges
  - name: Numbers
  - name: Trunks
  - name: Telephony
  - name: Billing
paths:
  /api/v2/platform/spaces/{space_token}/runs/:
    get:
      tags:
        - Runs
      summary: Get All Runs in a Space
      operationId: getAllRuns
      parameters:
        - name: space_token
          in: path
          required: true
          schema:
            type: string
            example: 8KZAMRAHSXXXXXXMAYNASMJC
        - $ref: '#/components/parameters/OrgHandle'
      responses:
        '200':
          description: List of all runs
          content:
            application/json:
              example:
                count: 9
                status_code: 200
                message: Runs Fetched Successfully
                data:
                  - run_id: Recac64fe03e911f1878d43cd8a99e069
                    collection_ref: collection_data_SA2W8R6NZRK6C9PO3JSL1J85
                    run_mode: prefect
                    status: completed
                    created: '2026-02-07T05:57:45Z'
                    modified: '2026-02-07T05:57:45Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - TokenAuth: []
components:
  parameters:
    OrgHandle:
      name: Org-Handle
      in: header
      required: true
      schema:
        type: string
        example: unpod.tv
      description: Organization domain handle
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API token
      content:
        application/json:
          example:
            status_code: 401
            message: Authentication credentials were not provided.
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Format: Token <your-api-key>'

````