> ## 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 Call Detail Records (CDR)

> Retrieve telephony call detail records with filtering and pagination support

<ResponseExample>
  ```json Success Response (200) theme={null}
  {
    "count": 643,
    "status_code": 200,
    "message": "Call logs fetched successfully",
    "data": [
      {
        "id": 33364,
        "call_status": "completed",
        "end_reason": "call.in-progress.sip-completed-call",
        "call_type": "outbound",
        "bridge": { "id": 12, "name": "Acme Primary Bridge" },
        "creation_time": "2025-11-08T05:32:29Z",
        "start_time": "2025-11-08T05:29:43Z",
        "end_time": "2025-11-08T05:32:28.686639Z",
        "call_duration": 165.686639,
        "source_number": "+15551234567",
        "destination_number": "+15559876543",
        "failure_source": null,
        "sip_cause": null
      }
    ]
  }
  ```

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

# Get Call Detail Records (CDR)

Retrieve telephony call detail records (CDR) for your organization - only SIP-based telephony calls, not voice agent calls.

<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                     |
| ------------- | ------ | -------- | ------------------------------- |
| Org-Handle    | string | Yes      | Organization domain handle      |
| Authorization | string | Yes      | API Key format: `Token <token>` |

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

### Query Parameters

| Name         | Type    | Required | Description                                                |
| ------------ | ------- | -------- | ---------------------------------------------------------- |
| page         | integer | No       | Page number for pagination (default = 1)                   |
| page\_size   | integer | No       | Number of records per page (default = 20)                  |
| call\_type   | string  | No       | Filter by call direction: `inbound` or `outbound`          |
| call\_status | string  | No       | Filter by status: `completed`, `notConnected`, or `failed` |

### Response Fields

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

### CDR Object Fields

| Field               | Type    | Description                                         |
| ------------------- | ------- | --------------------------------------------------- |
| id                  | integer | Unique call record ID                               |
| source\_number      | string  | The number that initiated the call                  |
| destination\_number | string  | The number that received the call                   |
| call\_type          | string  | Direction of call: `outbound`, `inbound`            |
| call\_status        | string  | Outcome: `completed`, `notConnected`, `failed`      |
| bridge              | object  | `{ id, name }` of the bridge, or `null`             |
| creation\_time      | string  | Timestamp when the call was created/scheduled       |
| start\_time         | string  | Timestamp when the call was answered                |
| end\_time           | string  | Timestamp when the call ended                       |
| call\_duration      | number  | Duration of the call in seconds                     |
| end\_reason         | string  | Reason the call ended                               |
| failure\_source     | string  | Which side a failure originated on (`null` if none) |
| sip\_cause          | string  | Human-readable SIP cause (`null` if none)           |

<Note>
  This CDR surface returns **telephony SIP records only** - it intentionally omits
  agent / space / organization attribution (voice-agent call logs live elsewhere).
</Note>

***

## Common Error Codes

| Status Code | Description                                 |
| ----------- | ------------------------------------------- |
| 200         | Success - CDRs fetched successfully         |
| 400         | Bad Request - Invalid filter parameters     |
| 401         | Unauthorized - Invalid or missing API token |
| 403         | Forbidden - Invalid organization handle     |
| 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 CDRs with filters
  const getCDRs = async (filters = {}) => {
    const params = {
      page: 1,
      page_size: 20,
      ...filters
    };
    const response = await axios.get(
      'https://unpod.ai/api/v2/platform/cdr/',
      { headers, params }
    );
    console.log(`Total CDRs: ${response.data.count}`);
    response.data.data.forEach(log => {
      console.log(`${log.call_type} call to ${log.destination_number}: ${log.call_status} (${log.call_duration}s)`);
    });
    return response.data.data;
  };

  // Example: Get outbound completed calls
  getCDRs({
    call_type: 'outbound',
    call_status: 'completed'
  });
  ```

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

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

  def get_cdrs(page: int = 1, page_size: int = 20, **filters):
      """Get CDRs with optional filters"""
      url = 'https://unpod.ai/api/v2/platform/cdr/'
      params = {'page': page, 'page_size': page_size, **filters}
      response = requests.get(url, headers=headers, params=params)
      data = response.json()
      print(f"Total CDRs: {data['count']}")
      for log in data['data']:
          print(f"{log['call_type']} to {log['destination_number']}: {log['call_status']} ({log['call_duration']}s)")
      return data['data']

  # Example: Get outbound completed calls
  get_cdrs(
      page=1,
      page_size=20,
      call_type='outbound',
      call_status='completed'
  )
  ```

  ```bash cURL theme={null}
  # Get CDRs with filters
  curl -X GET "https://unpod.ai/api/v2/platform/cdr/?page=1&page_size=20&call_type=outbound&call_status=completed" \
    -H "Org-Handle: your-org-handle" \
    -H "Authorization: Token your-api-token"
  ```
</CodeGroup>

## Best Practices

1. **Pagination**: Use `page` and `page_size` for large datasets to avoid timeouts
2. **Call Status Filtering**: Filter by `call_status` to focus on specific outcomes
3. **Org-Handle**: Ensure the correct organization handle is included
4. **Security**: Keep API tokens secure and rotate them regularly


## OpenAPI

````yaml GET /api/v2/platform/cdr/
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/cdr/:
    get:
      tags:
        - Call Logs
      summary: Get Call Detail Records
      operationId: getCDRs
      parameters:
        - $ref: '#/components/parameters/OrgHandle'
        - name: page
          in: query
          schema:
            type: integer
            example: 1
        - name: page_size
          in: query
          schema:
            type: integer
            example: 20
        - name: call_type
          in: query
          schema:
            type: string
            enum:
              - inbound
              - outbound
            example: outbound
        - name: call_status
          in: query
          schema:
            type: string
            enum:
              - completed
              - notConnected
              - failed
            example: completed
      responses:
        '200':
          description: List of telephony CDRs
          content:
            application/json:
              example:
                count: 643
                status_code: 200
                message: Call logs fetched successfully
                data:
                  - id: 33364
                    call_status: completed
                    end_reason: call.in-progress.sip-completed-call
                    call_type: outbound
                    bridge:
                      id: 12
                      name: Acme Primary Bridge
                    creation_time: '2025-11-08T05:32:29Z'
                    start_time: '2025-11-08T05:29:43Z'
                    end_time: '2025-11-08T05:32:28.686639Z'
                    call_duration: 165.686639
                    source_number: '+15551234567'
                    destination_number: '+15559876543'
                    failure_source: null
                    sip_cause: null
        '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>'

````