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

# Transaktionsverlauf abrufen

> Dieser Endpunkt liefert den Credit-Transaktionsverlauf des Nutzers.

## GET /credits/history

Dieser Endpunkt gibt eine Liste der Credit-Transaktionen des authentifizierten Nutzers zurück (Käufe, Verbrauch, Erstattungen). Erfordert Sitzungsauthentifizierung (JWT-Access-Token).

<Note>
  **Für Drittanbieter-Integrationen:** Verwenden Sie stattdessen `GET /credits/history/api` mit API-Schlüssel-Authentifizierung.
</Note>

### Abfrageparameter

<ParamField query="limit" type="number" default="20">
  Anzahl zurückzugebender Transaktionen (max. 100).
</ParamField>

<ParamField query="offset" type="number" default="0">
  Anzahl zu überspringender Transaktionen für die Paginierung.
</ParamField>

<ParamField query="type" type="string">
  Filter nach Typ: `purchase`, `usage` oder `refund`.
</ParamField>

### Antwort

<ResponseField name="transactions" type="array">
  Array von Transaktionsobjekten.

  <Expandable title="Eigenschaften einer transaction">
    <ResponseField name="id" type="string">
      Eindeutige Kennung der Transaktion.
    </ResponseField>

    <ResponseField name="type" type="string">
      Transaktionstyp: `purchase`, `usage` oder `refund`.
    </ResponseField>

    <ResponseField name="amount" type="number">
      Credit-Betrag (positiv bei Zugängen, negativ bei Verbrauch).
    </ResponseField>

    <ResponseField name="description" type="string">
      Beschreibung der Transaktion.
    </ResponseField>

    <ResponseField name="siteId" type="string">
      Zugehörige Website-Kennung (bei Nutzungs-Transaktionen).
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO-8601-Zeitstempel der Transaktion.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="number">
  Gesamtanzahl der Transaktionen.
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  Ob weitere Transaktionen abrufbar sind.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/credits/history?limit=10" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/credits/history?limit=10&type=usage',
    {
      headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }
    }
  );

  const history = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Erfolg (200) theme={null}
  {
    "transactions": [
      {
        "id": "txn_abc123",
        "type": "purchase",
        "amount": 500,
        "description": "Purchased Professional Pack",
        "siteId": null,
        "createdAt": "2026-01-15T10:00:00.000Z"
      },
      {
        "id": "txn_def456",
        "type": "usage",
        "amount": -50,
        "description": "llms.txt generation for example.com (enhanced)",
        "siteId": "550e8400-e29b-41d4-a716-446655440000",
        "createdAt": "2026-01-20T14:30:00.000Z"
      },
      {
        "id": "txn_ghi789",
        "type": "usage",
        "amount": -25,
        "description": "llms.txt generation for another-site.com (simple)",
        "siteId": "660e8400-e29b-41d4-a716-446655440001",
        "createdAt": "2026-01-22T09:15:00.000Z"
      }
    ],
    "total": 47,
    "hasMore": true
  }
  ```
</ResponseExample>

***

## GET /credits/history/api

Liefert den Credit-Transaktionsverlauf mit API-Schlüssel-Authentifizierung. Geeignet für Drittanbieter-Integrationen.

### Authentifizierung

API-Schlüssel erforderlich. Übergeben Sie ihn im Header `Authorization`:

```
Authorization: Bearer llmgen_your_api_key_here
```

### Abfrageparameter

Wie bei `/credits/history` oben.

### Antwort

Wie bei `/credits/history` oben.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/credits/history/api?limit=10" \
    -H "Authorization: Bearer llmgen_your_api_key_here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/credits/history/api?limit=10&type=usage',
    {
      headers: { 'Authorization': 'Bearer llmgen_your_api_key_here' }
    }
  );

  const history = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.llmgenerator.com/api/v1/credits/history/api',
      headers={'Authorization': 'Bearer llmgen_your_api_key_here'},
      params={'limit': 10, 'type': 'usage'}
  )

  history = response.json()
  ```
</RequestExample>
