> ## 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 Space by Token

> Retrieve configuration and metadata of a specific space by its token

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

  ```json Error Response (404) theme={null}
  {
    "status_code": 404,
    "message": "Space not found."
  }
  ```

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

# Get Space by Token

Retrieve configuration and metadata of a specific space identified by its token. This allows you to view a space's current setup, properties, and organization context.

***

### 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          |
| ------------ | ------- | -------------------- |
| status\_code | integer | HTTP status code     |
| message      | string  | Response message     |
| data         | object  | Space object details |

### Space Object Fields

| Field         | Type   | Description                                |
| ------------- | ------ | ------------------------------------------ |
| id            | string | Unique space identifier                    |
| name          | string | Space display name                         |
| token         | string | Public token for API access                |
| agent\_handle | string | Handle of the agent assigned to this 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 - Space or 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 space by token
  const getSpaceByToken = async (spaceToken) => {
    const response = await axios.get(
      `https://unpod.ai/api/v2/platform/spaces/${spaceToken}/`,
      { headers }
    );
    console.log(`Space name: ${response.data.data.name}`);
    console.log(`Agent handle: ${response.data.data.agent_handle}`);
    return response.data.data;
  };

  // Example usage
  getSpaceByToken('8KZRTQP7BNW5XEDLORYUHMJC');
  ```

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

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

  def get_space_by_token(space_token: str):
      """Get a specific space by its token"""
      url = f'https://unpod.ai/api/v2/platform/spaces/{space_token}/'
      response = requests.get(url, headers=headers)
      data = response.json()
      print(f"Space name: {data['data']['name']}")
      print(f"Agent handle: {data['data']['agent_handle']}")
      return data['data']

  # Example usage
  get_space_by_token('8KZRTQP7BNW5XEDLORYUHMJC')
  ```

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

## Best Practices

1. **Space Token**: Ensure you are using a valid space token from your organization
2. **Org-Handle**: Always include the correct organization handle in requests
3. **Error Handling**: Handle 404 responses when a space token may have been deleted or is invalid
4. **Security**: Keep API tokens secure and rotate them regularly
5. **Caching**: Consider caching space details to avoid repeated lookups for the same space


## OpenAPI

````yaml GET /api/v2/platform/spaces/{space_token}/
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}/:
    get:
      tags:
        - Spaces
      summary: Get Space by Token
      operationId: getSpaceByToken
      parameters:
        - name: space_token
          in: path
          required: true
          schema:
            type: string
            example: 8KZAMRAHSXXXXXXMAYNASMJC
        - $ref: '#/components/parameters/OrgHandle'
      responses:
        '200':
          description: Space details
          content:
            application/json:
              example:
                status_code: 200
                message: Space fetched successfully
                data:
                  id: sp_001
                  name: Sales Outreach Q1
                  token: 8KZRTQP7BNW5XEDLORYUHMJC
                  agent_handle: space-agent-8qmk42nslp91wrh3dz7btxc4
                  created_at: '2026-01-10T08:00:00Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      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.
    NotFound:
      description: Resource not found
      content:
        application/json:
          example:
            status_code: 404
            message: Not found.
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Format: Token <your-api-key>'

````