> ## Documentation Index
> Fetch the complete documentation index at: https://agents.docs.timepay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Logs

> Retrieve paginated communication logs (calls, WhatsApp, SMS) with optional filters.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication (e.g., `Bearer <your_token>`).
</ParamField>

### Query Parameters

<ParamField query="type" type="string">
  Filter by communication type.

  <Expandable title="options">
    * `call` — Voice calls
    * `whatsapp` — WhatsApp messages
  </Expandable>
</ParamField>

<ParamField query="status" type="string">
  Filter by log status (e.g., `No Contact`, `Completed`, `Failed`).
</ParamField>

<ParamField query="disposition" type="string">
  Filter by call disposition (e.g., `Voicemail`, `Promise to Pay`, `Not Interested`).
</ParamField>

<ParamField query="from_phone" type="string">
  Filter by caller/sender phone number (e.g., `+918035450808`).
</ParamField>

<ParamField query="phone" type="string">
  Filter by customer phone number (e.g., `8888889956`).
</ParamField>

<ParamField query="campaign_id" type="string">
  Filter by campaign ID.
</ParamField>

<ParamField query="agent_id" type="string">
  Filter by agent ID.
</ParamField>

<ParamField query="start_time" type="string">
  Filter logs from this datetime (inclusive). Format: ISO 8601 (e.g., `2026-01-17T00:00:00`).
</ParamField>

<ParamField query="end_time" type="string">
  Filter logs until this datetime (inclusive). Format: ISO 8601 (e.g., `2026-01-17T23:59:59`).
</ParamField>

<ParamField query="page" type="integer" default={1}>
  Page number (1-indexed). Each page returns **10** logs.
</ParamField>

<ParamField query="count_only" type="string" default="false">
  If `true`, returns only the total count of matching logs without fetching log data.
</ParamField>

### Response

#### Standard Response (count\_only=false)

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful.
</ResponseField>

<ResponseField name="data" type="array">
  Array of log entries. Fields vary slightly based on type.

  <Expandable title="Common fields (all types)">
    <ResponseField name="date" type="string">Date of the log entry (`YYYY-MM-DD`).</ResponseField>
    <ResponseField name="loan_id" type="string">Present only for Collection organizations. Unique loan identifier of the customer.</ResponseField>
    <ResponseField name="lead_id" type="string">Present only for Lead Generation organizations. Unique lead identifier of the customer.</ResponseField>
    <ResponseField name="start_time" type="string">Start timestamp (ISO 8601).</ResponseField>
    <ResponseField name="end_time" type="string">End timestamp (ISO 8601). `null` for WhatsApp/SMS.</ResponseField>
    <ResponseField name="campaign_name" type="string">Name of the campaign.</ResponseField>
    <ResponseField name="campaign_id" type="string">Campaign ID.</ResponseField>
    <ResponseField name="name" type="string">Customer's name as specified in campaign data</ResponseField>
    <ResponseField name="duration" type="number">Duration in seconds (0 for WhatsApp/SMS).</ResponseField>
    <ResponseField name="direction" type="string">Direction: `outbound` or `inbound`.</ResponseField>
    <ResponseField name="from" type="string">Caller/sender phone number.</ResponseField>
    <ResponseField name="to" type="string">Customer phone number.</ResponseField>
    <ResponseField name="status" type="string">Log status.</ResponseField>
    <ResponseField name="disposition" type="string">Call disposition/outcome.</ResponseField>
    <ResponseField name="extracted_data" type="object">Data extracted by the AI agent during the conversation.</ResponseField>
    <ResponseField name="agent_id" type="string">Agent ID that handled the interaction.</ResponseField>
    <ResponseField name="disposition_id" type="string">Disposition configuration ID.</ResponseField>
    <ResponseField name="summary" type="string">AI-generated call summary.</ResponseField>
    <ResponseField name="type" type="string">Communication type: `call`, `whatsapp`, or `sms`.</ResponseField>
  </Expandable>

  <Expandable title="Call-only fields">
    <ResponseField name="call_id" type="string">Unique call identifier.</ResponseField>
    <ResponseField name="transcript_id" type="string">Transcript ID extracted from the transcript file path. Use the [Get Transcript](/api-reference/get-transcript) endpoint to fetch the full transcript.</ResponseField>
    <ResponseField name="recording_id" type="string">Recording ID. Use the [Get Recording](/api-reference/get-recording) endpoint to stream the audio.</ResponseField>
  </Expandable>

  <Expandable title="WhatsApp-only fields">
    <ResponseField name="message_id" type="string">Unique message identifier.</ResponseField>
    <ResponseField name="wamid" type="string">WhatsApp message ID assigned by Meta.</ResponseField>

    <ResponseField name="conversation" type="array">
      WhatsApp conversation thread.

      <Expandable title="message object">
        <ResponseField name="role" type="string">Message role: `assistant` or `user`.</ResponseField>
        <ResponseField name="content" type="string">Message content.</ResponseField>
        <ResponseField name="timestamp" type="string">Message timestamp (ISO 8601).</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="errors" type="array">
      WhatsApp delivery errors from Meta API.

      <Expandable title="error object">
        <ResponseField name="code" type="integer">Meta error code.</ResponseField>
        <ResponseField name="title" type="string">Error title.</ResponseField>
        <ResponseField name="message" type="string">Error message.</ResponseField>
        <ResponseField name="href" type="string">Link to Meta error documentation.</ResponseField>
        <ResponseField name="error_data" type="object">Additional error details.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination metadata.

  <Expandable title="properties">
    <ResponseField name="page" type="integer">Current page number.</ResponseField>
    <ResponseField name="per_page" type="integer">Results per page (always 10).</ResponseField>
    <ResponseField name="total" type="integer">Total matching logs.</ResponseField>
    <ResponseField name="total_pages" type="integer">Total number of pages.</ResponseField>
    <ResponseField name="has_next" type="boolean">Whether a next page exists.</ResponseField>
    <ResponseField name="has_prev" type="boolean">Whether a previous page exists.</ResponseField>
  </Expandable>
</ResponseField>

#### Count-Only Response (count\_only=true)

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful.
</ResponseField>

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

<ResponseExample>
  ```json 200 Call Logs theme={null}
  {
    "success": true,
    "data": [
      {
        "call_id": "KjbdfYCefvutafHGCDhgfhgafhdyfyg",
        "date": "2026-01-17",
        "start_time": "2026-01-17T08:33:36",
        "end_time": "2026-01-17T08:35:08",
        "campaign_name": "August EMI Reminder Campaign",
        "campaign_id": "LKsfiGVdygfvYFGCdygayhf",
        "name": "John Wick",
        "loan_id": "LOAN-ABC-123",
        "duration": 14,
        "direction": "outbound",
        "from": "+918888888888",
        "to": "9999999999",
        "status": "No Contact",
        "disposition": "Voicemail",
        "transcript_id": "7437557f-7ab9-4012-b411-a6f534c5aaf0",
        "recording_id": "9242c009-1f8f-4bd6-a40c-e40926d1fd88",
        "extracted_data": {},
        "summary": "Customer acknowledged the pending EMI of ₹12,500 due on August 15 and promised to deposit the amount by tomorrow.",
        "agent_id": "lGJVyhgvayGDtfsfdfdf",
        "disposition_id": "YefgTYRCdygdygw",
        "type": "call"
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 10,
      "total": 2450,
      "total_pages": 245,
      "has_next": true,
      "has_prev": false
    }
  }
  ```

  ```json 200 WhatsApp Logs theme={null}
  {
    "success": true,
    "data": [
      {
        "message_id": "kajdfahbfuyFYtdygfvygYFDCycf",
        "date": "2026-01-22",
        "start_time": "2026-01-22T19:04:31",
        "end_time": null,
        "campaign_name": "August EMI Reminder Campaign",
        "campaign_id": "khYTFvdygvgYCFDgvhbfvn",
        "name": "John Wick",
        "loan_id": "LOAN-ABC-123",
        "duration": 0,
        "direction": "outbound",
        "from": null,
        "to": "8264705488",
        "status": "Read",
        "disposition": null,
        "extracted_data": {},
        "agent_id": "",
        "disposition_id": null,
        "type": "whatsapp",
        "wamid": "wamid.HBgMOTE4MjY0NzA1NDg4FQIAERgSMUREQzk0RjExNTQzMzE3RkZGAA==",
        "conversation": [
          {
            "role": "assistant",
            "content": "नमस्ते john\n\nआपका timepay.ai लोन किस्त (Loan ID: 243410) 18 दिन से बकाया पड़ा है।\n\nबकाया राशि: ₹7442\n\nकृपया तुरंत timepay.ai ऐप के ज़रिए पेमेंट क्लियर करें।",
            "timestamp": "2026-01-22T19:04:31"
          }
        ],
        "errors": [
          {
            "code": 131042,
            "href": "https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes/",
            "title": "Business eligibility payment issue",
            "message": "Business eligibility payment issue",
            "error_data": {
              "details": "Message failed to send because there were one or more errors related to your payment method."
            }
          }
        ]
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 10,
      "total": 1250,
      "total_pages": 125,
      "has_next": true,
      "has_prev": false
    }
  }
  ```

  ```json 200 Count Only theme={null}
  {
    "success": true,
    "total": 15340
  }
  ```

  ```json 200 Mixed Types (no type filter) theme={null}
  {
    "success": true,
    "data": [
      {
        "message_id": "IbugvFCTDFCdgtfdhgCTYRFCYGEf",
        "date": "2026-01-22",
        "start_time": "2026-01-22T19:04:31",
        "end_time": null,
        "campaign_name": "Aug Campaign",
        "campaign_id": "tcELESaJAtDfnWxJvzLU",
        "name": "Rajesh Joshi",
        "loan_id": "LOAN-ABC-334",
        "to": "8264705488",
        "status": "Failed",
        "agent_id": "",
        "type": "whatsapp",
        "wamid": "wamid.HBgMOTE4MjY0NzA1NDg4FQIAERgSMUREQzk0RjExNTQzMzE3RkZGAA==",
        "conversation": [],
        "errors": []
      },
      {
        "date": "2026-01-17",
        "start_time": "2026-01-17T08:33:36",
        "end_time": "2026-01-17T08:35:08",
        "campaign_name": "Jan Campaign",
        "campaign_id": "MboeowkjabsXlVwgkwlm",
        "name": "Trilok",
        "loan_id": "LOAN-ABC-334",
        "duration": 14,
        "direction": "outbound",
        "from": "+918035450808",
        "to": "8888889956",
        "status": "No Contact",
        "disposition": "Voicemail",
        "transcript_id": "7437557f-7ab9-4012-b411-a6f534c5aaf0",
        "recording_id": "9242c009-1f8f-4bd6-a40c-e40926d1fd88",
        "extracted_data": {},
        "agent_id": "lHLbgcfaUBTFvYodWKUR",
        "disposition_id": "ZvhjjEIldlzSEcCWibNM",
        "type": "call"
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 10,
      "total": 15340,
      "total_pages": 1534,
      "has_next": true,
      "has_prev": false
    }
  }
  ```

  ```json 400 Validation Error theme={null}
  {
    "success": false,
    "message": "Validation failed",
    "errors": [
      "Invalid type 'email'. Must be one of: call, whatsapp, sms"
    ]
  }
  ```

  ```json 500 Server Error theme={null}
  {
    "success": false,
    "error": "Internal Server Error",
    "message": "An unexpected error occurred"
  }
  ```
</ResponseExample>

### Usage Examples

**Get all logs (page 1):**

```
GET /api/v1/logs
```

**Get only call logs:**

```
GET /api/v1/logs?type=call
```

**Get WhatsApp logs for a specific campaign:**

```
GET /api/v1/logs?type=whatsapp&campaign_id=tcELESaJAtDfnWxJvzLU
```

**Get logs within a date range:**

```
GET /api/v1/logs?start_time=2026-01-17T00:00:00&end_time=2026-01-17T23:59:59
```

**Get failed WhatsApp messages:**

```
GET /api/v1/logs?type=whatsapp&status=Failed
```

**Filter by customer phone and disposition:**

```
GET /api/v1/logs?phone=8888889956&disposition=Voicemail
```

**Get logs from a specific caller number:**

```
GET /api/v1/logs?from_phone=+918035450808&type=call
```

**Get page 3 of call logs:**

```
GET /api/v1/logs?type=call&page=3
```

**Count total failed logs:**

```
GET /api/v1/logs?status=Failed&count_only=true
```

**Combine multiple filters:**

```
GET /api/v1/logs?type=call&status=No Contact&disposition=Voicemail&start_time=2026-01-01T00:00:00&end_time=2026-01-31T23:59:59&page=1
```
