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

> Retrieve all AI agents configured in your organization

<ResponseExample>
  ```json Success Response (200) theme={null}
  {
    "count": 94,
    "status_code": 200,
    "message": "Agents fetched successfully",
    "data": [
      {
        "handle": "space-agent-8qmk42nslp91wrh3dz7btxc4",
        "name": "General Agentic",
        "type": "Voice",
        "state": "published",
        "purpose": "Handle outbound sales calls"
      }
    ]
  }
  ```

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

# Get All Agents

Retrieve detailed information for all registered AI agents in your organization, helping you view and manage agent records within the system.

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

***

### Headers

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

<Note>
  You can get the `Org-Handle` by hitting the [Get All Organizations](/api/space/organizations#get-all-organizations) API. The `domain_handle` field in the response is your Org-Handle.
</Note>

### Response Fields

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

### Agent Object Fields

| Field   | Type   | Description                                   |
| ------- | ------ | --------------------------------------------- |
| handle  | string | Unique agent handle/identifier                |
| name    | string | Agent display name                            |
| type    | string | Agent type: `Voice`, `Chat`, etc.             |
| state   | string | Agent state: `published`, `draft`, `archived` |
| purpose | string | Agent purpose/use case description            |

## 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 agents
  const getAllAgents = async () => {
    const response = await axios.get(
      'https://unpod.ai/api/v2/platform/agents/',
      { headers }
    );
    console.log(`Total agents: ${response.data.count}`);
    response.data.data.forEach(agent => {
      console.log(`${agent.name} (${agent.handle}) - ${agent.state}`);
    });
    return response.data.data;
  };

  // Example usage
  getAllAgents();
  ```

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

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

  def get_all_agents():
      """Get all AI agents in the organization"""
      url = 'https://unpod.ai/api/v2/platform/agents/'
      response = requests.get(url, headers=headers)
      data = response.json()
      print(f"Total agents: {data['count']}")
      for agent in data['data']:
          print(f"{agent['name']} ({agent['handle']}) - {agent['state']}")
      return data['data']

  # Example usage
  get_all_agents()
  ```

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

## Best Practices

1. **Agent Handle**: Note the `handle` field - it is used as the `agent_handle` path parameter in other agent endpoints
2. **State Filtering**: Filter by `state` in your application to show only `published` agents
3. **Org-Handle**: Always include the correct organization handle in requests
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/agents/
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/agents/:
    get:
      tags:
        - Agents
      summary: Get All Agents
      operationId: getAllAgents
      parameters:
        - $ref: '#/components/parameters/OrgHandle'
      responses:
        '200':
          description: List of all agents
          content:
            application/json:
              example:
                count: 94
                status_code: 200
                message: Agents fetched successfully
                data:
                  - handle: space-agent-8qmk42nslp91wrh3dz7btxc4
                    name: General Agentic
                    type: Voice
                    state: published
                    purpose: Handle outbound sales calls
        '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>'

````