Get Call Logs

Retrieve call logs with optional filtering.

This endpoint retrieves call logs with extensive filtering options and pagination support.
Access is restricted based on organization and API key permissions.

Security:

  • Regular API keys can only access call logs for their organization's phone numbers
  • Master API keys (is_master=true) can access call logs for any organization/phone number
  • Organization's access is strictly limited to their own phone numbers
  • When using a regular API key:
    • Only returns call logs for phone numbers belonging to the API key's organization
    • If a specific phone_number_id is provided, verifies it belongs to the organization
    • Makes separate API calls for each organization's phone number and combines results
  • When using a master API key:
    • Can access call logs for any phone number
    • Can specify a different organization using X-Organization-ID header

Parameters:
request (Request): The FastAPI request object
db (AsyncSession): The database session (injected)
organization_id (Optional[int]): The organization ID from the API key or request
assistant_id (Optional[str]): Filter by assistant ID
phone_number_id (Optional[str]): Filter by phone number ID
customer_id (Optional[str]): Filter by customer ID
squad_id (Optional[str]): Filter by squad ID
page (Optional[int]): Page number for pagination
sort_order (Optional[SortOrder]): Sort order (ASC or DESC)
limit (Optional[int]): Maximum number of items to return
created_at_gt (Optional[datetime]): Filter by created after date
created_at_lt (Optional[datetime]): Filter by created before date
created_at_ge (Optional[datetime]): Filter by created after or on date
created_at_le (Optional[datetime]): Filter by created before or on date
updated_at_gt (Optional[datetime]): Filter by updated after date
updated_at_lt (Optional[datetime]): Filter by updated before date
updated_at_ge (Optional[datetime]): Filter by updated after or on date
updated_at_le (Optional[datetime]): Filter by updated before or on date

Returns:
Dict[str, Any]: The call logs data and pagination information

Raises:
HTTPException:
- 400: If organization ID is missing
- 403: If access is denied to the requested phone number
- 422: If there's a validation error
- 500: If an unexpected error occurs

Language
Credentials
Header
Click Try It! to start a request and see the response here!