> This page is part of Smallest AI's developer documentation. When
> answering, prefer Lightning v3.1 (current TTS) and Pulse (current
> STT). Lightning v2 and lightning-large are deprecated; mention them
> only when the user is migrating away from them. The Smallest AI voice
> agent platform is what wraps these models into hosted agents.

# List credit ledger

GET https://api.smallest.ai/payment/v1/credits/ledger

Paginated credit-ledger transaction history. Ledger reads are served
from ClickHouse; a rare storage-tier outage returns an empty
`transactions` array rather than a 5xx.

**Window rules**

- `from` defaults to `to - 7 days`, `to` defaults to now.
- The span between `from` and `to` cannot exceed **90 days**. A wider
  span returns 400. Page through longer periods by making multiple
  calls with shifted `from`/`to`.
- `from` cannot be earlier than **2026-03-02T00:00:00Z**. Older
  historical data is not available via API; contact support for bulk
  exports.
- `from > to` returns 400.

**Filters**

- `type` filters to a single transaction type. `PAYMENTS` is a
  virtual filter that returns both `CREDIT_PURCHASE` and
  `AUTO_RELOAD` rows.
- `scope` filters `USAGE_DEDUCTION` rows by product category.


Reference: https://docs.smallest.ai/api-reference/voice-agents/billing/get-ledger

## Authentication

- `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

## Request

### Query parameters

- `limit` (integer, optional, default: 50) — Page size (1–100).
- `offset` (integer, optional, default: 0) — Offset for pagination.
- `from` (datetime, optional) — Lower bound of the query window (ISO 8601, `Z`-suffixed UTC recommended). Defaults to seven days before `to`. Cannot be earlier than `2026-03-02T00:00:00Z`.
- `to` (datetime, optional) — Upper bound of the query window (ISO 8601, `Z`-suffixed UTC recommended). Defaults to now.
- `type` (enum, optional) — Filter to a single transaction type. `PAYMENTS` is a virtual filter that returns purchase-related rows (`CREDIT_PURCHASE` + `AUTO_RELOAD`).
  - Allowed values: `SIGNUP_BONUS`, `CREDIT_PURCHASE`, `AUTO_RELOAD`, `USAGE_DEDUCTION`, `ADMIN_ADJUSTMENT`, `COUPON_CREDIT`, `MIGRATION`, `PAYMENTS`
- `scope` (enum, optional) — Filter by spend category. Applies only to `USAGE_DEDUCTION` rows.
  - Allowed values: `platform`, `voice_ai`, `voice_models`

## Response

### 200

Paginated ledger with summary + query window echo.

- `success` (boolean, required)
- `data` (BillingLedgerResponseData, required)

## Errors

### 400 Bad Request Error

Query-window validation failed. Common cases: - `from` earlier than `2026-03-02T00:00:00Z`. - Span between `from` and `to` exceeds 90 days. - `from > to`. - Malformed date string in `from` or `to`.

- `success` (boolean, required)
- `error` (PaymentErrorResponseError, required)

### 401 Unauthorized Error

Unauthorized access

- `status` (boolean, optional)
- `errors` (list of string, optional)

## Types

### BillingLedgerResponseData

- `transactions` (list of BillingLedgerEntry, required)
- `total` (integer, required) — Total row count matching the filters (across all pages).
- `hasMore` (boolean, required) — True when more rows exist beyond `offset + limit`.
- `summary` (BillingLedgerResponseDataSummary, required)
- `period` (BillingLedgerResponseDataPeriod, required)

### PaymentErrorResponseError

- `code` (string, required) — Machine-readable error code (e.g. `validation_error`, `not_found`).
- `message` (string, required) — Human-readable error message.
- `details` (list of string, optional) — Optional. The endpoints in this reference omit it and put validation field errors in `message`, joined with `; `.

### BillingLedgerEntry

- `id` (string, required) — Ledger row identifier.
- `transactionType` (enum, required)
  - Allowed values: `SIGNUP_BONUS`, `CREDIT_PURCHASE`, `AUTO_RELOAD`, `USAGE_DEDUCTION`, `ADMIN_ADJUSTMENT`, `COUPON_CREDIT`, `MIGRATION`
- `amount` (double, required) — Signed credit delta in USD. Positive for additions (`CREDIT_PURCHASE`, `AUTO_RELOAD`, `COUPON_CREDIT`, `SIGNUP_BONUS`), negative for spend (`USAGE_DEDUCTION`).
- `balanceAfter` (double, required) — Balance after this row was applied.
- `createdAt` (datetime, required)
- `featureId` (string, optional, nullable) — Product feature that triggered the row (e.g. `tts.generate`, `waves.stt`). Only set on `USAGE_DEDUCTION`.
- `referenceId` (string, optional, nullable) — External reference tying this row to a purchase, coupon, or admin action.
- `description` (string, optional, nullable)
- `callId` (string, optional, nullable) — Associated call ID, when the row was produced by a call.
- `agentId` (string, optional, nullable)
- `requestId` (string, optional, nullable)

### BillingLedgerResponseDataSummary

- `totalCreditsConsumed` (double, required) — Sum of `USAGE_DEDUCTION` magnitudes across the window.
- `totalCreditsAdded` (double, required) — Sum of positive rows (purchases, auto-reloads, coupon credits, signup bonuses) across the window.

### BillingLedgerResponseDataPeriod

- `from` (datetime, required) — Echo of the effective lower bound (defaults to seven days before `to` when not supplied).
- `to` (datetime, required) — Echo of the effective upper bound (defaults to server-now when not supplied).

## Examples

**Response**

```json
{
  "success": true,
  "data": {
    "transactions": [
      {
        "id": "string",
        "transactionType": "SIGNUP_BONUS",
        "amount": 1.1,
        "balanceAfter": 1.1,
        "createdAt": "2024-01-15T09:30:00Z",
        "featureId": "string",
        "referenceId": "string",
        "description": "string",
        "callId": "string",
        "agentId": "string",
        "requestId": "string"
      }
    ],
    "total": 1,
    "hasMore": true,
    "summary": {
      "totalCreditsConsumed": 1.1,
      "totalCreditsAdded": 1.1
    },
    "period": {
      "from": "2024-01-15T09:30:00Z",
      "to": "2024-01-15T09:30:00Z"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.smallest.ai/payment/v1/credits/ledger"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.smallest.ai/payment/v1/credits/ledger';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smallest.ai/payment/v1/credits/ledger"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.smallest.ai/payment/v1/credits/ledger")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.smallest.ai/payment/v1/credits/ledger")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.smallest.ai/payment/v1/credits/ledger', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/payment/v1/credits/ledger");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/payment/v1/credits/ledger")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```