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

# Získat využití kreditů

> Načtení stránkované historie kreditových transakcí.

## Query parametry

<ParamField query="page" type="integer" default="1">
  Číslo stránky pro stránkování.
</ParamField>

<ParamField query="limit" type="integer" default="25">
  Počet položek na stránku (max 100).
</ParamField>

<ParamField query="from" type="string">
  Filtrování transakcí od tohoto data ISO 8601.
</ParamField>

<ParamField query="to" type="string">
  Filtrování transakcí do tohoto data ISO 8601.
</ParamField>

<ParamField query="service" type="string">
  Filtrování podle typu služby (např. `extraction`, `enhancement`).
</ParamField>

## Odpověď

<ResponseField name="data" type="array">
  <Expandable title="Objekt transakce">
    <ResponseField name="id" type="string">Jedinečný identifikátor transakce.</ResponseField>
    <ResponseField name="service" type="string">Služba, která spotřebovala kredity.</ResponseField>
    <ResponseField name="amount" type="number">Spotřebované kredity (záporná hodnota).</ResponseField>
    <ResponseField name="table_id" type="string | null">Přidružené ID tabulky, pokud je k dispozici.</ResponseField>
    <ResponseField name="description" type="string">Lidsky čitelný popis.</ResponseField>
    <ResponseField name="created_at" type="string">Časové razítko ISO 8601.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  <Expandable title="Metadata stránkování">
    <ResponseField name="page" type="integer">Aktuální stránka.</ResponseField>
    <ResponseField name="limit" type="integer">Položek na stránku.</ResponseField>
    <ResponseField name="total" type="integer">Celkový počet transakcí.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total_used" type="number">
  Celkový počet spotřebovaných kreditů napříč všemi odpovídajícími transakcemi (nejen aktuální stránka).
</ResponseField>

<RequestExample>
  ```typescript TypeScript theme={null}
  const usage = await client.credits.usage({
    from: "2025-01-01T00:00:00Z",
    to: "2025-03-31T23:59:59Z",
    limit: 50,
  });

  console.log(`Total used: ${usage.total_used} credits`);
  for (const tx of usage.data) {
    console.log(`${tx.service}: ${tx.amount} credits - ${tx.description}`);
  }
  ```

  ```python Python theme={null}
  usage = client.credits.usage(
      from_="2025-01-01T00:00:00Z",
      to="2025-03-31T23:59:59Z",
      limit=50,
  )

  print(f"Total used: {usage['total_used']} credits")
  for tx in usage["data"]:
      print(f"{tx['service']}: {tx['amount']} credits - {tx['description']}")
  ```

  ```bash cURL theme={null}
  curl -X GET "https://hub.banditshq.com/api/v1/credits/usage?from=2025-01-01T00:00:00Z&to=2025-03-31T23:59:59Z&limit=50" \
    -H "Authorization: Bearer lasso_..."
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": [
      {
        "id": "tx_abc123",
        "service": "enhancement",
        "amount": -12,
        "table_id": "tbl_xyz789",
        "description": "Enhanced 6 rows × description column",
        "created_at": "2025-03-10T14:30:00.000Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 50,
      "total": 128
    },
    "total_used": 3420
  }
  ```
</ResponseExample>
