# One API key per customer, with usage you can bill

_2026-11-26 · Product updates · By Loïc Journée_

![Three Staan API keys whose shafts are usage gauges, showing 410, 128 and 36 billed requests](https://staan.ai/assets/staan-api-keys-usage-cover-Cpn5af7p.jpg)

Staan now has two account management APIs. The API Keys API creates, lists and deletes API keys from your own code, up to 100 per account. The Usage API returns the billed requests of your account, in total and per key, per day or per month. Together, they let you give each of your customers their own Staan key and bill them for the searches they make, without opening the console. Both are available on every Staan account.

## What is an API key management API?

An API key management API lets you create and revoke API keys from code instead of a dashboard. A platform that serves many customers uses it to issue one key per customer at sign-up, and to remove that key when the customer leaves.

A usage API is its counterpart: it reports how many billed requests each key made over a period. With both, the key becomes the unit you meter, bill and cut off.

## Why we built them

Teams that put Staan inside their own product had two options: share one key across all their customers, or create keys by hand in the console. With a shared key, you can't tell which customer made which searches, and you can't cut one off without cutting everyone. With keys made by hand, onboarding a customer waits for someone to log in. In both cases, billing meant reading numbers off a dashboard. The two APIs replace those manual steps with three endpoints for keys and one for usage.

## What can you do with the API Keys and Usage APIs?

Six things a key per customer makes possible.

### Resell web search inside your product

If you run an AI assistant, an agent platform or a vertical SaaS, call `POST /v1/keys` when a customer signs up and store the key with their account. Keys created through the API can only be used for search: they can't read usage or create other keys. That is what makes them safe to hand to a customer.

### Bill each customer for what they use

At the end of the month, call `GET /v1/usage` with `granularity=monthly`. The response lists every key with its billed requests, split between Web Search and Web Search for AI. Multiply by your own price, and you have the usage line of each invoice.

### Split costs between teams, agents or environments

The same works inside one company. Create a key per team, per agent or per environment, name it accordingly, and the Usage API shows which one drives the bill.

### Give a time-limited key for a trial or a pilot

Set `expires_at` when you create the key. A prospect on a two-week trial, or an agency on a three-month project, gets a key that stops working on the date you chose. Nobody has to remember to revoke it.

### Cut off one key without touching the others

When a contract ends or a key leaks, `DELETE /v1/keys/{id}` stops it immediately. Your other customers keep working, and the deleted key's past usage stays in the Usage API, so the last invoice is still right.

### Feed your own dashboard

Pull daily usage into the reporting tool you already use, and follow consumption per customer over time. A request can cover up to 366 days, and `key_id` narrows the result to one key.

## How do you create an API key for a customer?

Call `POST /v1/keys` with a key created in the Staan console, and name the new key, for example after your customer:

```bash
curl -X POST https://api.staan.ai/v1/keys \
  -H "Authorization: Bearer YOUR_CONSOLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Customer A", "expires_at": "2027-12-31T23:59:59Z"}'
```

The response returns the key and its identifier:

```json
{
  "id": "6f1c2a9e-3b4d-4e5f-8a7b-1c2d3e4f5a6b",
  "key": "stn_...",
  "name": "Customer A",
  "expires_at": "2027-12-31T23:59:59.000Z",
  "created_at": "2026-11-02T08:22:46.594Z"
}
```

The `key` field is returned only in this response: store it right away, it can't be retrieved later. `GET /v1/keys` lists the keys of your account, without their secrets.

## How do you track usage per API key?

Call `GET /v1/usage` with a period. Add `key_id` to look at a single key:

```bash
curl "https://api.staan.ai/v1/usage?from=2026-10-01&to=2026-10-31&granularity=daily" \
  -H "Authorization: Bearer YOUR_CONSOLE_API_KEY"
```

You get the total of the account, then each key with its own total and its usage per day (response abridged):

```json
{
  "from": "2026-10-01",
  "to": "2026-10-31",
  "granularity": "daily",
  "total": { "web_search": 410, "web_search_for_ai": 0, "total": 410 },
  "keys": [
    {
      "key_id": "6f1c2a9e-3b4d-4e5f-8a7b-1c2d3e4f5a6b",
      "name": "Customer A",
      "total": { "web_search": 410, "web_search_for_ai": 0, "total": 410 },
      "usage": [
        {
          "date": "2026-10-01",
          "web_search": 12,
          "web_search_for_ai": 0,
          "total": 12
        }
      ]
    }
  ]
}
```

With `granularity=monthly`, each entry covers a month and `date` reads `2026-10`. Days or months without usage are left out.

## What should you know before you start?

- Both APIs are called with a key created in the Staan console. Keep it on your servers: anyone holding it can create keys on your account.
- An account holds up to 100 keys.
- Keys created through the API are for search only, with the default settings: Web Search for AI and the default rate limits.
- Requests made with these keys are billed to your account.
- Usage counts billed Web Search and Web Search for AI requests, up to the previous day. The current day is not included.
- Deleted keys still count in the account total.
- Each endpoint accepts 1 request per second.

## Built on an independent European index

The keys you create give access to Staan's search APIs, which run on an independent European web index, built by European Search Perspective, the joint venture of Qwant and Ecosia.

## Learn more

- Every parameter, response field and error code: read the [API Keys API documentation](https://docs.staan.ai/docs/api-keys) and the [Usage API documentation](https://docs.staan.ai/docs/usage).
- White label, payment and limits: see the [FAQ](https://staan.ai/faq).
- New to Staan? [Get your free API key](https://staan.ai/auth/register) and start with Web Search.

---

**Give each customer their own key** Create a key in the console, then call the API Keys API from your code. Building a platform on Staan? Tell us about your use case and volumes.

[Get your free API key](https://staan.ai/auth/register) · [Talk to sales](https://form.typeform.com/to/xbbrneRe)
