<!-- ZenPays documentation · https://docs.zenpayz.com/docs/rest-api/endpoints/ledger/ledger-entries -->

# Get Ledger Entries

Retrieve paginated ledger entries (double-entry bookkeeping records) with optional filters.

<EndpointHeader verb="GET" path="/merchant/api/v1/ledger/entries" />

## Request

### Headers

<ParamTable
  label="Header"
  rows={[
    { name: "Authorization", required: true, desc: "`Bearer {api_key}`" },
    { name: "X-Signature", required: true, desc: "HMAC-SHA256 signature" },
    { name: "X-Timestamp", required: true, desc: "ISO 8601 timestamp" },
    { name: "X-Secret-Salt", required: true, desc: "Secret salt for HMAC validation" },
  ]}
/>

### Query Parameters

<ParamTable
  rows={[
    { name: "page", type: "integer", default: "1", desc: "Page number" },
    { name: "limit", type: "integer", default: "20", desc: "Items per page (max 100)" },
    { name: "startDate", type: "string", default: "-", desc: "Filter from date (YYYY-MM-DD)" },
    { name: "endDate", type: "string", default: "-", desc: "Filter to date (YYYY-MM-DD)" },
    { name: "currency", type: "string", default: "-", desc: "Filter by currency code" },
    { name: "entryType", type: "string", default: "-", desc: "Filter by type: `DEBIT` or `CREDIT`" },
  ]}
/>

## Response

### Success (200 OK)

```json
{
  "success": true,
  "data": {
    "entries": [
      {
        "entryId": "le_xxxxx",
        "batchId": "batch_xxxxx",
        "accountId": "acc_xxxxx",
        "merchantId": "mer_xxxxx",
        "entryType": "CREDIT",
        "entryCategory": "DEPOSIT_NET",
        "amount": 950,
        "currency": "INR",
        "balanceBefore": 9050,
        "balanceAfter": 10000,
        "sourceType": "PAYMENT",
        "sourceTransactionId": "txn_xxxxx",
        "sourceOrderId": "order_xxxxx",
        "description": "Payment deposit (net after fees)",
        "postedAt": "2024-01-15T10:30:00.000Z",
        "createdAt": "2024-01-15T10:30:00.000Z"
      },
      {
        "entryId": "le_yyyyy",
        "batchId": "batch_xxxxx",
        "accountId": "acc_xxxxx",
        "merchantId": "mer_xxxxx",
        "entryType": "DEBIT",
        "entryCategory": "PAYOUT",
        "amount": 5000,
        "currency": "INR",
        "balanceBefore": 15000,
        "balanceAfter": 10000,
        "sourceType": "PAYOUT",
        "sourceTransactionId": "po_xxxxx",
        "description": "Payout withdrawal",
        "postedAt": "2024-01-15T09:00:00.000Z",
        "createdAt": "2024-01-15T09:00:00.000Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "totalPages": 8,
      "hasNext": true,
      "hasPrev": false
    },
    "total": 150
  },
  "message": "Ledger entries retrieved successfully"
}
```

### Entry Types

| Type | Description |
|------|-------------|
| `DEBIT` | Decrease in account balance |
| `CREDIT` | Increase in account balance |

### Entry Categories

| Category | Description |
|----------|-------------|
| `DEPOSIT_GROSS` | Gross deposit amount before fees |
| `DEPOSIT_NET` | Net deposit amount after fees |
| `DEPOSIT_FEE` | Fee deducted from deposit |
| `PAYOUT` | Payout withdrawal |
| `PAYOUT_FEE` | Payout processing fee |
| `REFUND` | Refund to customer |
| `CHARGEBACK` | Chargeback deduction |
| `SETTLEMENT` | Settlement transfer |
| `RESERVE_ALLOCATION` | Reserve allocation |
| `RESERVE_RELEASE` | Reserve release |

<CodeRail>

## Examples

<Tabs groupId="language">
  <TabItem value="curl" label="cURL" default>

```bash
curl -X GET "https://api.zenpays.com/merchant/api/v1/ledger/entries?page=1&limit=20&currency=INR&entryType=CREDIT" \
  -H "Authorization: Bearer zp_test_xxxxx" \
  -H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
  -H "X-Signature: a1b2c3d4e5f6..." \
  -H "X-Secret-Salt: your_secret_salt"
```

  </TabItem>
  <TabItem value="sdk" label="SDK">

```javascript
const { entries, pagination } = await zenpays.ledger.getEntries({
  page: 1,
  limit: 20,
  currency: 'INR',
  entryType: 'CREDIT'
});

entries.forEach(entry => {
  console.log(`${entry.entryType}: ${entry.amount} ${entry.currency} - ${entry.description}`);
});
```

  </TabItem>
</Tabs>

</CodeRail>
