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

# Call Cost

Retrieve call execution records joined with transaction/cost metadata. This global API mirrors the internal `/api/agent/agent-executions/list` behavior and returns a `transactions` array with headers and pagination metadata.

## API Endpoint

**GET** `/api/v1/global/transactions/calling-list-with-transaction`

**Content-Type:** `application/json`

**Authentication:** Required (API token validated by middleware `apiauth.verifyToken`). Provide token via header `token` or `api_access_token`.

## Query Parameters / Request Body

| Parameter     | Type    | Required | Description                                                        |
| ------------- | ------- | -------- | ------------------------------------------------------------------ |
| `agent_id`    | string  | No       | Comma-separated agent IDs to filter (e.g., `962` or `962,963`).    |
| `call_status` | string  | No       | Comma-separated call statuses to filter (mapped to `CALL_STATUS`). |
| `fromdate`    | string  | No       | Start date/time (e.g., `2025-01-01` or ISO datetime).              |
| `todate`      | string  | No       | End date/time.                                                     |
| `search`      | string  | No       | Search string applied to `TRACK_ID` and `CALLING_NUMBER`.          |
| `page`        | integer | No       | Page number (default 1).                                           |
| `limit`       | integer | No       | Page size (default 10).                                            |

## Example Requests

### Basic - get first page for an agent

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/transactions/calling-list-with-transaction?agent_id=962&page=1&limit=20" \
  -H "token: YOUR_API_TOKEN"
```

### Filter by call status and date range

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/transactions/calling-list-with-transaction?agent_id=962&call_status=completed&fromdate=2025-01-01&todate=2025-01-31" \
  -H "token: YOUR_API_TOKEN"
```

### Search by calling number or track id

```bash theme={null}
curl -X GET "https://www.tryunleashx.com/api/v1/global/transactions/calling-list-with-transaction?agent_id=962&search=91234" \
  -H "token: YOUR_API_TOKEN"
```

### POST example (if you prefer JSON body)

```bash theme={null}
curl -X POST "https://www.tryunleashx.com/api/v1/global/transactions/calling-list-with-transaction" \
  -H "Content-Type: application/json" \
  -H "token: YOUR_API_TOKEN" \
  -d '{ "agent_id": "962", "call_status": "completed", "fromdate": "2025-01-01", "todate": "2025-01-31", "page": 1, "limit": 20 }'
```

## Successful Response (200)

The response contains `headers`, `transactions` (array), and `pagination` metadata:

```json theme={null}
{
  "headers": [ { "key": "track_id", "label": "Call ID", "type": "number", "clickable": true }, ... ],
  "transactions": [
    {
      "calling_number": "+919876543210",
      "provider_number": "+14045551234",
      "status": "completed",
      "track_id": "abc123",
      "call_id": "call-xyz",
      "total_duration": 185,
      "detected_emotion": null,
      "transcript": "Customer said ...",
      "comments": "test comment",
      "call_status": "completed",
      "disposition": "resolved",
      "overall_sentiment": "positive",
      "error_message": null,
      "cost_breakdown": null,
      "voice_call_analysis": null,
      "tts_cost": "0.00",
      "llm_cost": "0.00",
      "stt_cost": "0.00",
      "infra_cost": "0.00",
      "analysis_cost": "0.00",
      "agent_name": "Support Agent A",
      "agent_icon": null,
      "agent_id": 962,
      "id": 12345,
      "total_cost": "0.00",
      "created_at": "15 Jan 2025, 10:12 AM",
      "CALL_JSON": "{...}"
    }
  ],
  "pagination": {
    "totalRecords": 100,
    "currentPage": 1,
    "limit": 20,
    "totalPages": 5,
    "has_next": true,
    "has_prev": false
  }
}
```

## Notes

* `agent_id` accepts comma-separated values and is applied as an `IN` filter.
* `call_status` accepts comma-separated values and is applied as an `IN` filter against `CALL_STATUS`.
* `search` performs a LIKE search on `TRACK_ID` and `CALLING_NUMBER`.
* `total_duration` is returned as raw seconds; controller does not format this field here (use UI to format as needed).
* The endpoint returns `headers` to help front-end table rendering and `transactions` array for rows.

## Error Responses

* `400 Bad Request` for invalid params.
* `401 Unauthorized` for auth failures.
* `500 Internal Server Error` for server errors.

***


## OpenAPI

````yaml api-reference/openapi.json GET /transactions/calling-list-with-transaction
openapi: 3.1.0
info:
  title: >-
    UnleashX - Build human like conversations | Voice Agents | Automations | AI
    Workforce
  version: 1.0.0
  description: UnleashX - Your home for human like conversations
servers:
  - url: https://www.tryunleashx.com/api/v1/global/
security:
  - bearerAuth: []
paths:
  /transactions/calling-list-with-transaction:
    get:
      tags:
        - Call Logs
      summary: Get calling list with transaction (call cost)
      parameters:
        - name: token
          in: header
          required: true
          description: API token for authentication
          schema:
            type: string
        - name: agent_id
          in: query
          required: false
          schema:
            type: string
        - name: call_status
          in: query
          required: false
          schema:
            type: string
        - name: fromdate
          in: query
          required: false
          schema:
            type: string
        - name: todate
          in: query
          required: false
          schema:
            type: string
        - name: search
          in: query
          required: false
          schema:
            type: string
        - name: page
          in: query
          required: false
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Transactions retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  headers:
                    type: array
                    items:
                      type: object
                  transactions:
                    type: array
                    items:
                      type: object
                  pagination:
                    type: object
                    properties:
                      totalRecords:
                        type: integer
                      currentPage:
                        type: integer
                      limit:
                        type: integer
                      totalPages:
                        type: integer
                      has_next:
                        type: boolean
                      has_prev:
                        type: boolean
        '400':
          description: Bad Request - Invalid parameters
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````