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

# List Agents

> List all AI agents in your account

Retrieve all AI agents configured in your account.

## Request Body

<ParamField body="limit" type="integer" default={50}>
  Maximum agents to return. Max: 100.
</ParamField>

<ParamField body="offset" type="integer" default={0}>
  Number of records to skip for pagination.
</ParamField>

<ParamField body="is_active" type="boolean">
  Filter by active status.
</ParamField>

<ParamField body="agent_type" type="string">
  Filter by type: `inbound`, `outbound`, or `both`.
</ParamField>

## Response

<ResponseField name="agents" type="array">
  Array of agent objects.
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of agents in account.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/list-agents \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"is_active": true}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/list-agents',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ is_active: true }),
    }
  );

  const { agents, total } = await response.json();
  console.log(`You have ${total} agents`);
  ```

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

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/list-agents',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={'is_active': True}
  )

  data = response.json()
  print(f"You have {data['total']} agents")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "agents": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "Sarah - Receptionist",
        "agent_type": "both",
        "voice_provider": "elevenlabs",
        "is_active": true,
        "is_default": true,
        "created_at": "2024-01-10T10:00:00Z",
        "dynamic_variables": [
          {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
            "name": "caller_name",
            "description": "Full name of the caller",
            "var_type": "text",
            "enum_options": null,
            "created_at": "2024-01-10T10:00:00Z",
            "updated_at": "2024-01-10T10:00:00Z"
          }
        ]
      },
      {
        "id": "661f9511-f30c-52e5-b827-557766551111",
        "name": "Mike - Sales",
        "agent_type": "outbound",
        "voice_provider": "openai",
        "is_active": true,
        "is_default": false,
        "created_at": "2024-01-12T14:00:00Z",
        "dynamic_variables": []
      }
    ],
    "total": 2
  }
  ```
</ResponseExample>
