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

> ## Agent Instructions
> ## Submitting feedback
> If you find an error, a missing step, or information that is outdated or misleading on this page — especially if it stopped you from completing your task — report it so the Encrata docs team can fix it.
> Send a POST request to https://docs.encrata.com/feedback with a JSON body containing `path` (the full URL of the page, for example `https://docs.encrata.com/quickstart`) and `feedback` (what was wrong and what you expected):
> curl -X POST https://docs.encrata.com/feedback -H 'Content-Type: application/json' -d '{"path": "https://docs.encrata.com/quickstart", "feedback": "Step 3 uses a parameter that the API rejects."}'
> Do not include API keys, personal data, or other secrets in your feedback.

# Credit Transactions

> List the credit ledger: every charge, top-up, and refund, newest first.

Credit Transactions returns your workspace's credit ledger, newest first. Each malware scan's charge carries its `scan_id` in `reference_id`, so you can match every charge to the scan that caused it.

## Authentication

Send your API key as `Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`.

## Request

**reference\_id** `string`

Only the rows that paid for this unit of work, such as a malware scan's `scan_id`.

**source** `string`

Only charges from this origin: `api` (an API key), `dashboard`, `bulk`, or `ai_chat`.

**api\_key\_id** `string`

Only one API key's charges.

**type** `string`

Only one transaction type, such as `usage`.

**limit** `integer` (default: 100)

Rows per page.

**offset** `integer` (default: 0)

Rows to skip.

## Example request

Find the charge for one malware scan:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl "https://developer.encrata.com/api/account/credit-transactions?reference_id=scn_aa8415cbf35f" \
  -H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

## Example response

This route returns the ledger object directly, without the `{success, result, message}` envelope.

```json theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "items": [
    {
      "id": "4b2cd102-e0ab-453b-8bd3-5be81375b440",
      "type": "usage",
      "amount": -1,
      "balance_after": 1811905192,
      "description": "malware_scan_url",
      "created_at": "2026-11-20T05:50:52.634671Z",
      "source": "api",
      "reference_id": "scn_aa8415cbf35f"
    }
  ],
  "total": 1,
  "key_sources": [
    {
      "id": "6a3dd89c-9f64-4bb8-9ec6-2504561c6e72",
      "name": "demo"
    },
    {
      "id": "db280194-a52f-4bd7-a12e-5f8775de2111",
      "name": "Agent"
    }
  ]
}
```

## Response

**items** `object[]`

The ledger rows.

**item fields**

**id** `string`

The row's ID.

**type** `string`

The transaction type, such as `usage` for a charge.

**amount** `integer`

Credits added (positive) or charged (negative). A malware scan is `-1` per scan, or per code for a QR or barcode image.

**balance\_after** `integer`

The balance after this row.

**description** `string`

What was charged, such as `malware_scan_url` or `malware_scan_file`.

**source** `string`

`api`, `dashboard`, `bulk`, or `ai_chat`.

**reference\_id** `string`

The `scan_id` of the malware scan this row paid for.

**created\_at** `string`

When the row was written, in UTC.

**job\_id** `string`

For a bulk job, the job. Its per-chunk charges are folded into one row.

**parts** `integer`

For a bulk job, how many chunk charges the row sums.

**total** `integer`

How many rows match, across all pages.

**key\_sources** `object[]`

The API keys that appear in the ledger, each with `id` and `name`, for labelling `api` rows.

A repeated scan of the same content is free, so it adds no row.

```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}}
curl "https://developer.encrata.com/api/account/credit-transactions?reference_id=scn_aa8415cbf35f" \
  -H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

```json 200 theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "items": [
    {
      "id": "4b2cd102-e0ab-453b-8bd3-5be81375b440",
      "type": "usage",
      "amount": -1,
      "balance_after": 1811905192,
      "description": "malware_scan_url",
      "created_at": "2026-11-20T05:50:52.634671Z",
      "source": "api",
      "reference_id": "scn_aa8415cbf35f"
    }
  ],
  "total": 1,
  "key_sources": [
    {
      "id": "6a3dd89c-9f64-4bb8-9ec6-2504561c6e72",
      "name": "demo"
    },
    {
      "id": "db280194-a52f-4bd7-a12e-5f8775de2111",
      "name": "Agent"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.