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

> List all calls with filtering and pagination

Retrieve a paginated list of calls for your account. Supports filtering by date range, status, direction, and agent.

## Request Body

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

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

<ParamField body="direction" type="string">
  Filter by call direction: `inbound` or `outbound`.
</ParamField>

<ParamField body="status" type="string">
  Filter by call status: `completed`, `busy`, `no-answer`, `failed`, `canceled`.
</ParamField>

<ParamField body="agent_id" type="string">
  Filter by specific agent UUID.
</ParamField>

<ParamField body="from_date" type="string">
  Filter calls after this ISO 8601 date.
</ParamField>

<ParamField body="to_date" type="string">
  Filter calls before this ISO 8601 date.
</ParamField>

<ParamField body="phone_number" type="string">
  Filter by phone number (either from or to).
</ParamField>

## Response

<ResponseField name="calls" type="array">
  Array of call objects.
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of calls matching the filters.
</ResponseField>

<ResponseField name="has_more" type="boolean">
  Whether there are more calls to paginate through.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/list-calls \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "limit": 20,
      "direction": "outbound",
      "from_date": "2024-01-01T00:00:00Z"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/list-calls',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        limit: 20,
        direction: 'outbound',
        from_date: '2024-01-01T00:00:00Z'
      }),
    }
  );

  const { calls, total } = await response.json();
  console.log(`Found ${total} calls`);
  ```

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

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/list-calls',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={
          'limit': 20,
          'direction': 'outbound',
          'from_date': '2024-01-01T00:00:00Z'
      }
  )

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

<ResponseExample>
  ```json Success Response theme={null}
  {
    "calls": [
      {
        "id": "7f3d8e00-a1b2-4c3d-9e4f-567890abcdef",
        "agent_id": "550e8400-e29b-41d4-a716-446655440000",
        "from_number": "+16045551234",
        "to_number": "+14155551234",
        "direction": "outbound",
        "status": "completed",
        "duration": 125,
        "sentiment": "positive",
        "call_summary": "Appointment confirmed for tomorrow at 2pm.",
        "created_at": "2024-01-15T10:30:00Z"
      }
    ],
    "total": 156,
    "has_more": true
  }
  ```
</ResponseExample>
