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

# Credits & Billing

> Pricing, per-endpoint credit costs, X-Credits-Remaining header, auto-refund on errors, balance API, usage reporting, and top-up flow.

Scanner uses a prepaid credit model. You're granted credits when your key is issued (free tier or invoiced), and each scan/batch/test debits your balance. Reads are always free. Validation errors and server errors are **automatically refunded** — you never burn credits on a 4xx or 5xx.

## Pricing

Sly Scanner is available through two channels:

* **Partner channel (this page)** — prepaid credits with a `psk_live_*` key. List price **$0.025/credit**, scaling down to **~$0.007/credit** at Enterprise volume. Use this when you're integrating directly.
* **Agentic.market / x402** — pay-per-call in USDC, no key, no commitment. **\$0.05/scan** at the marketplace. See the [x402 marketplace page](/scanner/x402) for full details. Partners are **always at least 50% cheaper** than the same call on x402.

### Partner per-call rates

**List price: \$0.025 per credit.** Reads cost nothing for partners.

| Action                    | Credits | Price       |
| ------------------------- | ------- | ----------- |
| Single scan               | 1       | **\$0.025** |
| Batch of 100 domains      | 50      | \$1.25      |
| Batch of 500 domains      | 250     | \$6.25      |
| Batch of 5,000 domains    | 2,500   | \$62.50     |
| Synthetic shopping test   | 5       | \$0.125     |
| All reads (shared corpus) | 0       | Free        |

### Credit packs

Buy in bulk for a per-credit discount. Packs **don't expire** — unused credits sit on your tenant until consumed.

| Pack                 | Credits  | Price          | Effective \$/credit | vs x402 (\$0.05/call) |
| -------------------- | -------- | -------------- | ------------------- | --------------------- |
| **List** (no commit) | per-call | \$0.025/credit | \$0.025             | **50% off**           |
| **Starter**          | 10,000   | \$200          | \$0.020             | **60% off**           |
| **Growth**           | 50,000   | \$750          | \$0.015             | **70% off**           |
| **Scale**            | 200,000  | \$2,000        | \$0.010             | **80% off**           |
| **Enterprise**       | 500,000+ | Custom         | \~\$0.007           | **86% off**           |

Contact [partners@getsly.ai](mailto:partners@getsly.ai) to purchase a pack or discuss enterprise pricing.

### Why partners always pay less than x402

The x402 marketplace serves on-demand AI agents that pay per call without an account. That convenience earns a premium price — **$0.05/scan**. Partners commit to volume up front, so they pay **$0.025/scan list**, dropping to **\$0.007/scan at Enterprise**. The savings recover the integration effort within a few hundred scans.

### Free trial — auto-granted on first key

Every new tenant gets **100 free credits** automatically the first time they create a scanner key (no signup, no email, no ops touch). That's enough to:

* Run **100 single scans** (`POST /scan`)
* Or **200 batch domains** (at 0.5 credit each)
* Or **20 synthetic agent tests** (at 5 credits each)

Self-serve a Sly account at [app.getsly.ai](https://app.getsly.ai), go to **Developers → API Keys → Scanner API Keys → Create Scanner Key**, and your first 100 credits land instantly. Beyond the trial, see paid tiers above or the design-partner program below.

### Design-partner program (free beta)

For partners ready to commit to a relationship, we offer a larger grant in exchange for product feedback and a case study. You get:

* **5,000 free credits** up front (\~3 months of typical usage at a small shop)
* **Scale pricing** (\$0.010/credit) locked in for 12 months after the free credits exhaust
* **First-right-of-refusal** on new scanner features before public launch

What we ask in return:

* A **logo + 1 case study** we can reference on the Sly site and in sales decks.
* A **30-min monthly feedback call** with your product lead for 6 months.
* An **early-bird testimonial** with a 2-week turnaround.

Interested? Email [partners@getsly.ai](mailto:partners@getsly.ai) with your use case and expected monthly scan volume.

## Credit costs

| Endpoint                                                                                 | Cost                        |
| ---------------------------------------------------------------------------------------- | --------------------------- |
| `POST /v1/scanner/scan`                                                                  | 1                           |
| `POST /v1/scanner/scan/batch`                                                            | 0.5 per target (rounded up) |
| `POST /v1/scanner/tests`                                                                 | 5                           |
| `GET /v1/scanner/scan/:id`                                                               | 0                           |
| `GET /v1/scanner/scans`, `scans/stats`, `scans/protocol-adoption`, `scans/by-domain/:id` | 0                           |
| `GET /v1/scanner/prospects`, `prospects/heat-map`, `prospects/export`                    | 0                           |
| `GET /v1/scanner/reports/*`, `observatory/*`, `snapshots/*`                              | 0                           |
| `GET /v1/scanner/credits/*`, `usage`                                                     | 0                           |

## Check your balance

```bash theme={null}
curl -H "Authorization: Bearer $SCANNER_KEY" \
  https://scanner.getsly.ai/v1/scanner/credits/balance
```

```json theme={null}
{
  "balance": 8432,
  "grantedTotal": 10000,
  "consumedTotal": 1568
}
```

## `X-Credits-Remaining` header

Every billed response includes an **`X-Credits-Remaining`** header so you can track your balance without an extra round-trip. Available on success responses **and** on auto-refunded 4xx/5xx responses.

```
HTTP/2 200
content-type: application/json
x-credits-remaining: 96
x-request-id: 2fb64db5-…
```

The TypeScript SDK reads this header automatically and exposes it as `scanner.balance` — see the [SDK reference](/scanner/sdk#auto-tracked-balance).

## Insufficient-credit errors

When your balance is below the cost of a requested operation, the endpoint returns:

```json theme={null}
// HTTP 402 Payment Required
{
  "error": "insufficient_credits",
  "balance": 0,
  "required": 1,
  "docs": "https://docs.getsly.ai/scanner/credits-and-billing"
}
```

Handle this in your integration by falling back to cached data, queueing for later, or notifying the operator. The 402 path is **never** debited — it's the gate that prevents work from starting.

## Auto-refund on 4xx and 5xx

The credits middleware debits your balance **before** the route handler runs (so we can return 402 cleanly when funds are short). If the handler then returns any 4xx or 5xx **other than** 402 / 429, the debit is **automatically reversed**:

| Status                     | Refunded?                                           |
| -------------------------- | --------------------------------------------------- |
| 200–299                    | No (you got the work)                               |
| 400 (Validation)           | **Yes**                                             |
| 401 (Unauthorized)         | n/a — auth runs before credits, never debited       |
| 402 (Insufficient credits) | n/a — never debited                                 |
| 403 (Forbidden)            | **Yes**                                             |
| 404 (Not found)            | **Yes**                                             |
| 422 (Unprocessable)        | **Yes**                                             |
| 429 (Rate limited)         | n/a — rate limit runs before credits, never debited |
| 5xx (Server error)         | **Yes**                                             |

The original consume row stays in the ledger for audit, paired with a matching `refund` row. Net `consumedTotal` reflects the refund — you can tell what was charged vs returned by inspecting the ledger directly.

## Ledger

Every grant, consume, refund, and adjustment is recorded in an append-only ledger. Retrieve history with optional pagination + scan-result join:

```bash theme={null}
curl -H "Authorization: Bearer $SCANNER_KEY" \
  "https://scanner.getsly.ai/v1/scanner/credits/ledger?from=2026-04-01&limit=50&page=1&expand=scan"
```

Response:

```json theme={null}
{
  "data": [
    {
      "id": "uuid",
      "delta": -1,
      "reason": "consume",
      "source": "request:e4f2…",
      "balance_after": 8432,
      "metadata": { "endpoint": "POST /v1/scanner/scan", "key_id": "uuid" },
      "created_at": "2026-04-22T10:15:03Z",
      "scan": {
        "id": "scan-uuid",
        "domain": "shopify.com",
        "readiness_score": 72,
        "scan_status": "completed"
      }
    }
  ],
  "pagination": { "page": 1, "limit": 50, "total": 23, "totalPages": 1 }
}
```

`reason` is one of `grant`, `consume`, `refund`, `adjustment`. With `expand=scan` (recommended) each consume row joins to the merchant\_scans row that paid for it via `request_id` — perfect for audit trails. Scans created before 2026-05-02 don't have the join; their rows still appear, just without the `scan` field.

See [Credits & Usage Endpoints](/scanner/endpoints/credits) for the full param list and other ledger calls (`/credits/balance`, `/credits/activity`).

## Ledger

Every debit and grant is recorded in an append-only ledger. Retrieve history:

```bash theme={null}
curl -H "Authorization: Bearer $SCANNER_KEY" \
  "https://scanner.getsly.ai/v1/scanner/credits/ledger?from=2026-04-01&limit=100"
```

Each entry:

```json theme={null}
{
  "id": "uuid",
  "delta": -1,
  "reason": "consume",
  "source": "request:e4f2...",
  "balance_after": 8432,
  "metadata": { "endpoint": "POST /v1/scanner/scan", "key_id": "uuid" },
  "created_at": "2026-04-22T10:15:03Z"
}
```

`reason` is one of: `grant`, `consume`, `refund`, `adjustment`. `refund` appears when a batch is cancelled before workers process the remaining targets.

## Usage reporting

Two flavors:

**`/v1/scanner/credits/activity`** — day-bucketed billable scan counts sourced from the credit ledger (ground truth, never undercounts). Use this for usage charts and billing reconciliation.

```bash theme={null}
curl -H "Authorization: Bearer $SCANNER_KEY" \
  "https://scanner.getsly.ai/v1/scanner/credits/activity?from=2026-04-01"
```

```json theme={null}
{ "data": [{ "day": "2026-05-02", "scans": 17, "credits": 17 }] }
```

**`/v1/scanner/usage`** — aggregated request counts per endpoint or per day (includes free reads, errors, latency). Use this when you also want read-traffic + per-endpoint breakdowns.

```bash theme={null}
curl -H "Authorization: Bearer $SCANNER_KEY" \
  "https://scanner.getsly.ai/v1/scanner/usage?group_by=day&from=2026-04-01"
```

See [Credits & Usage Endpoints](/scanner/endpoints/credits) for the full reference.

## Topping up

Partners can top up in two ways:

1. **Invoiced** — pay your Sly invoice; credits are granted against your tenant within 1 business day (source tag references the invoice).
2. **Prepaid bundles** — purchase credit packs in the Sly dashboard. Instant grant.

Both appear in your ledger with `reason: "grant"`.

## Cancelling a batch

```bash theme={null}
curl -X DELETE -H "Authorization: Bearer $SCANNER_KEY" \
  https://scanner.getsly.ai/v1/scanner/scan/batch/<batch_id>
```

Unprocessed targets are refunded at 0.5 credits each. Already-processed targets are not refunded.
