---
title: Sell API access with per-key billing in 10 minutes · Stevens Keys
source: https://stevens-keys.pages.dev/sell-api-access-per-key-billing
description: Step-by-step: issue a license key per customer, validate and meter every call with one request, and revoke instantly. Real endpoints, test mode.
publisher: Stevens Keys (Canada Site Ops)
---

# Sell API access with per-key billing in 10 minutes

Give each customer their own key, check and count every call with one request, and cut off anyone instantly. This works for any HTTP API, including remote MCP servers. Every endpoint below is live in test mode; the full list is in the [OpenAPI spec](https://stevens-keys.pages.dev/openapi.json).

**Before you start, honestly:** Stevens Keys is in preview. Keys, validation, metering and revocation work today. Checkout works in Stripe test mode only (test cards, no real money), and payouts via Stripe Connect are not live, so for real money you collect payment yourself for now, or just meter a free tier. Accounts are verified for test mode by a human check at sign-up (no email).

## 1. Sign up and pass the human check (2 min)

Create an account in the [dashboard](https://stevens-keys.pages.dev/dashboard?signup=1) and pass the quick human check. That verifies you for test mode immediately, so you can issue keys right away. You can also try the flow with a sandbox key in the [demo](https://stevens-keys.pages.dev/demo).

## 2. Create an API secret and a product (2 min)

In the dashboard, create an API secret (`sk_creator_test_…`, shown once). Then create a product, which holds your quota and cache settings:

```
curl -s -X POST https://stevens-keys.pages.dev/v1/products \
  -H "authorization: Bearer sk_creator_test_..." \
  -H "content-type: application/json" \
  -d '{"name":"My API","monthly_quota":3000,"price_cents":900}'
# → 201 { "id": "prod_...", "name": "My API", ... }
```

## 3. Issue a key per customer (1 min)

```
curl -s -X POST https://stevens-keys.pages.dev/v1/keys \
  -H "authorization: Bearer sk_creator_test_..." \
  -H "content-type: application/json" \
  -d '{"product_id":"prod_...","label":"customer@example.com"}'
# → 201 { "id": "key_...", "key": "sk_mcp_test_...", ... } (plaintext shown once)
```

Keys are stored only as SHA-256 hashes, so you can't look the plaintext up later. Give it to your customer; they send it as `Authorization: Bearer …`.

## 4. Check and meter every call (3 min)

Add one validate call in front of your handler. Get code for your stack from the [snippet generator](https://stevens-keys.pages.dev/snippets); the core is:

```
async function requireLicense(req) {
  const auth = req.headers.get("authorization") || "";
  if (!auth.startsWith("Bearer ")) return { allow: false, status: "missing_key" };
  const res = await fetch("https://stevens-keys.pages.dev/v1/validate", {
    method: "POST",
    headers: { authorization: auth, "content-type": "application/json" },
    body: JSON.stringify({ product_id: "prod_...", units: 1 }),
  });
  return res.json(); // 200 allow · 403 deny · 401 missing key
}
```

Each allowed call is counted against the key's monthly quota (send `"meter": false` for checks that shouldn't count; `"units"` up to 1000 for heavier calls). Over quota returns `403 over_quota`.

## 5. Watch usage, revoke when needed (2 min)

The dashboard shows daily usage and top keys (`GET /v1/usage`). To cut someone off:

```
curl -s -X POST https://stevens-keys.pages.dev/v1/keys/key_.../revoke \
  -H "authorization: Bearer sk_creator_test_..."
```

The next validation anywhere is denied. If you cache allows using the `cache_ttl` hint (30s default), it takes up to that long.

## 6. Price it

Per-call or subscription? Model it in the [revenue calculator](https://stevens-keys.pages.dev/calculator) (85/15 is our planned rate; no fees are charged in preview). Background in the [monetization FAQ](https://stevens-keys.pages.dev/mcp-monetization-faq).

## Related

[Docs](https://stevens-keys.pages.dev/docs) · [Snippet generator](https://stevens-keys.pages.dev/snippets) · [Calculator](https://stevens-keys.pages.dev/calculator) · [OpenAPI](https://stevens-keys.pages.dev/openapi.json) · [llms.txt](https://stevens-keys.pages.dev/llms.txt)

### More from Stevens Keys

- [Surface](https://nova-otter-delta-cloud.grok.me): free MCP server with per-request metering
- [Usage Lab](https://usage-lab.pages.dev/)
- [Server Track Lab](https://server-track-lab.pages.dev/)
- [API Meter Lab](https://api-meter-lab.pages.dev/)

Machine files: https://stevens-keys.pages.dev/llms.txt · https://stevens-keys.pages.dev/openapi.json · https://stevens-keys.pages.dev/mcp · https://stevens-keys.pages.dev/agent-quickstart.md
