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

# Transactions

> View and track all transaction history

View and filter all debits and credits across your accounts for reconciliation and reporting.

## Endpoints

| Endpoint                  | Method | Description                    |
| ------------------------- | ------ | ------------------------------ |
| `/bila/transactions`      | GET    | List all transactions          |
| `/bila/transactions/{id}` | GET    | Get a single transaction by ID |

## Transaction Object

```json theme={null}
{
  "id": "txn-001",
  "type": "credit",
  "amount": 1000.00,
  "currency": "ZMW",
  "status": "successful",
  "description": "Mobile money collection",
  "reference": "order-12345",
  "accountId": "acc-001",
  "balanceBefore": 5000.00,
  "balanceAfter": 6000.00,
  "createdAt": "2024-01-15T10:30:00Z"
}
```

## Transaction Types

| Type     | Description                            |
| -------- | -------------------------------------- |
| `credit` | Money received (collections, deposits) |
| `debit`  | Money sent (transfers, fees)           |

## Filtering Transactions

You can filter transactions using query parameters:

| Parameter   | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| `page`      | number | Page number (default: 1)               |
| `perPage`   | number | Items per page (default: 50, max: 100) |
| `type`      | string | Filter by type: `credit` or `debit`    |
| `accountId` | string | Filter by account ID                   |
| `startDate` | string | Filter from date (ISO 8601)            |
| `endDate`   | string | Filter to date (ISO 8601)              |

## Example: Get Recent Credits

```bash theme={null}
curl -X GET "https://api.usebila.com/api/v1/bila/transactions?type=credit&perPage=20" \
  -H "x-api-key: sk_test_your_api_key"
```

## Example: Get Transactions for Date Range

```bash theme={null}
curl -X GET "https://api.usebila.com/api/v1/bila/transactions?startDate=2024-01-01&endDate=2024-01-31" \
  -H "x-api-key: sk_test_your_api_key"
```

## Paginated Response

```json theme={null}
{
  "status": true,
  "message": "Transactions retrieved successfully",
  "data": {
    "data": [
      // Transaction objects
    ],
    "meta": {
      "total": 150,
      "page": 1,
      "perPage": 50,
      "totalPages": 3
    }
  }
}
```

## Use Cases

<AccordionGroup>
  <Accordion title="Daily reconciliation">
    Fetch transactions for the previous day to reconcile with your internal records.
  </Accordion>

  <Accordion title="Generate statements">
    Use date filters to generate monthly or weekly transaction statements.
  </Accordion>

  <Accordion title="Monitor account activity">
    List recent transactions to monitor account activity in real-time.
  </Accordion>
</AccordionGroup>

<a href="/docs/api-reference" style={{ textDecoration: 'none', borderBottom: 'none', display: 'block' }}>
  <div
    style={{
  borderRadius: '16px',
  padding: '32px',
  height: '120px',
  display: 'flex',
  flexDirection: 'column',
  justifyContent: 'flex-end',
  border: '0.5px solid #f16101',
  cursor: 'pointer',
  transition: 'all 0.15s ease-in-out',
  boxShadow: '0 4px 14px 0 rgba(241, 97, 1, 0.1)',
}}
    onMouseEnter={e => {
  e.currentTarget.style.background = 'rgba(241, 97, 1, 0.05)';
  e.currentTarget.style.boxShadow = '0 6px 20px 0 rgba(241, 97, 1, 0.2)';
  e.currentTarget.style.transform = 'translateY(-2px)';
}}
    onMouseLeave={e => {
  e.currentTarget.style.background = 'transparent';
  e.currentTarget.style.boxShadow = '0 4px 14px 0 rgba(241, 97, 1, 0.1)';
  e.currentTarget.style.transform = 'none';
}}
  >
    <div style={{ fontSize: '24px', marginBottom: '8px' }}>⟡</div>
    <div style={{ fontWeight: '500', fontSize: '16px' }}>API Reference</div>
    <div style={{ opacity: 0.6, fontSize: '13px', marginTop: '4px' }}>Explore the complete API reference</div>
  </div>
</a>
