> ## 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 Spaces

> Retrieve details of all created spaces in your organization

<ResponseExample>
  ```json Success Response (200) theme={null}
  {
    "count": 207,
    "status_code": 200,
    "message": "Spaces fetched successfully",
    "data": [
      {
        "id": "sp_001",
        "name": "Sales Outreach Q1",
        "token": "8KZAMRAHSXXXXXXMAYNASMJC",
        "agent_handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
        "created_at": "2026-01-10T08:00:00Z"
      }
    ]
  }
  ```

  ```json Error Response (401) theme={null}
  {
    "status_code": 401,
    "message": "Authentication credentials were not provided."
  }
  ```
</ResponseExample>

***

## Get All Spaces

Retrieve a list of all spaces within your organization. Spaces are containers that organize your tasks, runs, and data collections.

### Headers

| Name          | Type   | Required | Description                     |
| ------------- | ------ | -------- | ------------------------------- |
| Authorization | string | Yes      | API Key format: `Token <token>` |
| Org-Handle    | string | Yes      | Organization domain handle      |

### Response Fields

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

### Space Object Fields

| Field         | Type   | Description                                       |
| ------------- | ------ | ------------------------------------------------- |
| id            | string | Unique space identifier                           |
| name          | string | Space display name                                |
| token         | string | Public token for API access (use as space\_token) |
| agent\_handle | string | Handle of the agent assigned to the space         |
| created\_at   | string | Space creation timestamp (ISO 8601)               |

***

## Common Error Codes

| Status Code | Description                                 |
| ----------- | ------------------------------------------- |
| 200         | Success - Request completed successfully    |
| 400         | Bad Request - Invalid parameters provided   |
| 401         | Unauthorized - Invalid or missing API token |
| 403         | Forbidden - Access denied to the resource   |
| 404         | Not Found - Organization 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',
    'Org-Handle': 'your-org-handle'
  };

  // Get all spaces
  const getAllSpaces = async () => {
    const response = await axios.get(
      'https://unpod.ai/api/v2/platform/spaces/',
      { headers }
    );
    console.log(`Total spaces: ${response.data.count}`);
    response.data.data.forEach(space => {
      console.log(`${space.name} - Token: ${space.token}`);
    });
    return response.data.data;
  };

  // Example usage
  getAllSpaces();
  ```

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

  headers = {
      'Authorization': 'Token your-api-token',
      'Org-Handle': 'your-org-handle'
  }

  def get_all_spaces():
      """Get all spaces in the organization"""
      url = 'https://unpod.ai/api/v2/platform/spaces/'
      response = requests.get(url, headers=headers)
      data = response.json()
      print(f"Total spaces: {data['count']}")
      for space in data['data']:
          print(f"{space['name']} - Token: {space['token']}")
      return data['data']

  # Example usage
  get_all_spaces()
  ```

  ```bash cURL theme={null}
  # Get all spaces
  curl -X GET "https://unpod.ai/api/v2/platform/spaces/" \
    -H "Authorization: Token your-api-token" \
    -H "Org-Handle: your-org-handle"
  ```
</CodeGroup>

## Best Practices

1. **Org-Handle**: Always include the correct organization handle in your requests
2. **Space Token**: Note the `token` field - it is used as the `space_token` path parameter in other endpoints
3. **Agent Handle**: Use the `agent_handle` when creating tasks to assign them to the correct agent
4. **Error Handling**: Always handle potential errors and edge cases
5. **Caching**: Consider caching space data to reduce API calls since spaces change infrequently


## OpenAPI

````yaml GET /api/v2/platform/spaces/
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/:
    get:
      tags:
        - Spaces
      summary: Get All Spaces
      operationId: getAllSpaces
      parameters:
        - $ref: '#/components/parameters/OrgHandle'
      responses:
        '200':
          description: List of all spaces
          content:
            application/json:
              example:
                count: 207
                status_code: 200
                message: Spaces fetched successfully
                data:
                  - id: sp_001
                    name: Sales Outreach Q1
                    token: 8KZAMRAHSXXXXXXMAYNASMJC
                    agent_handle: space-agent-8qmk42nslp91wrh3dz7btxc4
                    created_at: '2026-01-10T08:00:00Z'
        '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>'

````