Skip to main content
GET
/
calls
/
{agentId}
List calls by agent ID
curl --request GET \
  --url https://app.phonely.ai/api/calls/{agentId} \
  --header 'X-Authorization: <api-key>'
{
  "items": [
    {
      "id": "<string>",
      "agentId": "<string>",
      "business_phone_number": "<string>",
      "customer_phone_number": "<string>",
      "started_at": "2023-11-07T05:31:56Z",
      "ended_at": "2023-11-07T05:31:56Z",
      "duration": 123,
      "status": "COMPLETED",
      "recording_url": "<string>",
      "ended_reason": "<string>",
      "type": "inboundPhoneCall",
      "mode": "<string>",
      "read": true,
      "c_sentiment": "Positive",
      "c_outcome": "<string>",
      "c_topic": "<string>",
      "ab_test_type": "<string>",
      "ab_test_id": "<string>",
      "ab_test_success": true,
      "draft_agent_version": "<string>",
      "draft_agent_id": "<string>",
      "workflow_path_history": [
        {
          "actionId": "<string>",
          "workflowId": "<string>",
          "readableName": "<string>"
        }
      ],
      "campaign_id": "<string>"
    }
  ],
  "total": 123,
  "limit": 123,
  "offset": 123
}
Retrieves a list of calls for a specific agent with comprehensive filtering and pagination options. This endpoint allows you to query call history, filter by various criteria, and paginate through results.

Request

Method: GET
Endpoint: /api/calls/{agentId}
Headers:
  • X-Authorization: Your API key (required)
Path Parameters:
  • agentId (string, required): The ID of the agent whose calls you want to retrieve

Notes

  • Array filters can be specified multiple times in the query string to filter by multiple values
  • All date parameters should be in ISO 8601 format (e.g., 2024-01-01T00:00:00Z)
  • Duration values are in seconds
  • Phone numbers should be URL-encoded (e.g., +1234567890 becomes %2B1234567890)
  • The total field in the response indicates the total count of matching calls, which may be greater than the number of items returned based on the limit parameter

Examples

Basic Request:
curl -X GET "https://app.phonely.ai/api/calls/agent123" \
  -H "X-Authorization: your-api-key"
With Pagination:
curl -X GET "https://app.phonely.ai/api/calls/agent123?limit=50&offset=0" \
  -H "X-Authorization: your-api-key"
With Single Value Filters:
curl -X GET "https://app.phonely.ai/api/calls/agent123?customer_phone_number=%2B1234567890&campaign_id=campaign456" \
  -H "X-Authorization: your-api-key"
With Array Filters:
curl -X GET "https://app.phonely.ai/api/calls/agent123?status=completed&status=in-progress&sentiment=positive" \
  -H "X-Authorization: your-api-key"
With Date Range:
curl -X GET "https://app.phonely.ai/api/calls/agent123?start_date=2024-01-01T00:00:00Z&end_date=2024-12-31T23:59:59Z" \
  -H "X-Authorization: your-api-key"
With Duration Range:
curl -X GET "https://app.phonely.ai/api/calls/agent123?min_duration=60&max_duration=300" \
  -H "X-Authorization: your-api-key"
Complex Query (Multiple Filters):
curl -X GET "https://app.phonely.ai/api/calls/agent123?limit=25&offset=0&status=completed&sentiment=positive&sentiment=neutral&call_type=inbound&start_date=2024-01-01T00:00:00Z&min_duration=30" \
  -H "X-Authorization: your-api-key"

Authorizations

X-Authorization
string
header
required

Path Parameters

agentId
string
required

The ID of the agent whose calls you want to retrieve

Query Parameters

limit
integer
default:100

Maximum number of results to return

offset
integer
default:0

Number of results to skip for pagination

customer_phone_number
string

Filter by customer phone number

campaign_id
string

Filter by campaign ID

status
enum<string>[]

Filter by call status (can specify multiple values)

sentiment
enum<string>[]

Filter by sentiment (can specify multiple values)

call_type
enum<string>[]

Filter by call type (can specify multiple values)

outcome
string[]

Filter by call outcome (can specify multiple values)

ended_reason
string[]

Filter by call ended reason (can specify multiple values)

mode
string[]

Filter by call mode (can specify multiple values)

start_date
string<date-time>

Filter calls after this date (ISO 8601 datetime format)

end_date
string<date-time>

Filter calls before this date (ISO 8601 datetime format)

min_duration
number

Minimum call duration in seconds

max_duration
number

Maximum call duration in seconds

Response

Successful response

items
object[]

Array of call objects matching the filter criteria

total
integer

Total number of calls matching the filters (not limited by pagination)

limit
integer

The limit value used in the request

offset
integer

The offset value used in the request