Skip to main content

Call Logs API

The Call Logs API allows you to retrieve call history logs for your organization. This endpoint provides comprehensive call details including duration, status, timestamps, and source/destination numbers.
Prerequisites: Make sure you have your API Token. See Authentication for details.

Get Call Logs

Retrieve the call history logs for the organization. Supports filtering, pagination, and provides details like call duration, status, start/end times, and source/destination numbers.
GET /api/v2/platform/call-logs/

Headers

NameTypeRequiredDescription
Org-HandlestringYesOrganization domain handle
AuthorizationstringYesAPI Key format: Token <token>
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Query Parameters

NameTypeRequiredDescription
pageintegerNoPage number (default: 1)
page_sizeintegerNoNumber of call logs per page (default: 20)
start_datestringNoFilter calls starting from this date (ISO format)
end_datestringNoFilter calls until this date (ISO format)
call_typestringNoFilter by call type: inbound / outbound
call_statusstringNoFilter by status: completed / missed / failed

Example Request

GET /api/v2/platform/call-logs/?page=1&page_size=20&call_type=outbound&call_status=completed
Headers:
  Org-Handle: your-organization-handle
  Authorization: Token your-api-token

Success Response (200)

{
  "count": 1,
  "status_code": 200,
  "message": "Call logs fetched successfully",
  "data": [
    {
      "id": "call_abc123def456",
      "source_number": "+919876543210",
      "destination_number": "+911234567890",
      "call_type": "outbound",
      "call_status": "completed",
      "creation_time": "2025-11-18T10:30:00.000Z",
      "start_time": "2025-11-18T10:30:05.000Z",
      "end_time": "2025-11-18T10:35:30.000Z",
      "call_duration": "0:05:25",
      "end_reason": "customer-ended-call",
      "bridge": 1
    }
  ],
}

Response Fields

FieldTypeDescription
countintegerTotal number of call logs
status_codeintegerHTTP status code
messagestringResponse message
dataarrayArray of call log objects

Call Log Object Fields

FieldTypeDescription
idstringUnique call identifier
source_numberstringOriginating phone number
destination_numberstringDestination phone number
call_typestringType of call: inbound or outbound
call_statusstringStatus: completed, missed, or failed
creation_timestringCall creation timestamp (ISO 8601)
start_timestringCall start timestamp (ISO 8601)
end_timestringCall end timestamp (ISO 8601)
call_durationstringDuration in HH:MM:SS format
end_reasonstringReason for call ending
bridgeintegerBridge identifier

Error Response (400 — Bad Request)

{
  "message": "Invalid request parameters",
  "error": "Detailed error description"
}

Common Error Codes

Status CodeDescription
400Bad Request - Invalid parameters provided
401Unauthorized - Invalid or missing API token
403Forbidden - Invalid organization handle
404Not Found - Resource not found
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const fetchCallLogs = async () => {
  const response = await axios.get('https://unpod.dev/api/v2/platform/call-logs/', {
    headers: {
      'Org-Handle': 'your-organization-handle',
      'Authorization': 'Token your-api-token'
    },
    params: {
      page: 1,
      page_size: 20,
      call_type: 'outbound',
      call_status: 'completed',
      start_date: '2025-11-01T00:00:00.000Z',
      end_date: '2025-11-18T23:59:59.000Z'
    }
  });

  console.log(`Total calls: ${response.data.count}`);
  response.data.data.forEach(call => {
    console.log(`Call ${call.id}: ${call.source_number} -> ${call.destination_number} (${call.call_duration})`);
  });
};

fetchCallLogs();

Pagination

The API uses cursor-based pagination. Use the next and previous URLs from the response to navigate between pages:
// Fetch next page
const nextPage = await axios.get(response.data.next);

// Fetch previous page
const previousPage = await axios.get(response.data.previous);

Filtering Best Practices

  1. Date Ranges: Always specify both start_date and end_date for better performance
  2. Page Size: Use appropriate page sizes (20-100) to balance performance and data retrieval
  3. Call Type: Filter by call_type to separate inbound and outbound analytics
  4. Call Status: Use call_status to focus on specific outcomes (completed, missed, failed)
  5. Pagination: Implement proper pagination handling for large datasets

Best Practices

  1. Rate Limiting: Implement proper rate limiting and retry logic
  2. Error Handling: Always handle potential errors and edge cases
  3. Caching: Cache call logs data when appropriate to reduce API calls
  4. Monitoring: Monitor call patterns and trends for insights
  5. Security: Keep API tokens secure and rotate them regularly
  6. Date Filters: Use date filters to limit data retrieval and improve performance