Skip to main content
A customer key is an AI Reserve API key that belongs to your organization but is bound to one of your customers. Every request made with it is billed to you and reported under that customer — the gateway stamps the customer id on the usage record itself, so the caller never has to send x-aireserve-customer or user. Hand one to each customer (or to each integration you run on a customer’s behalf) and Spend by Customer splits on its own. A customer key can also carry the customer’s organization / sub-account. That makes it a sub key: usage lands under the customer and that organization, so one customer who runs several workspaces, regions, or business units gets a second level of split. Organization ids mean whatever they mean in your product; AI Reserve treats them as opaque strings.
Customer keys are the recommended way to attribute spend when the requests are made by the customer’s own systems. Keep the per-request tags for traffic your own backend sends on behalf of many customers through one key. A customer key’s binding always wins over a per-request tag; the optional x-aireserve-feature tag is still honored on both.

Authentication

Call these endpoints with one of your organization’s own, organization-level API keys — the kind an enterprise admin creates on the portal’s Keys page with scope Organization. Other keys are refused with 403: The customer id in the path is URL-encoded, exactly as you want it reported — 1 to 128 printable characters, no control characters. Use the opaque id your own system uses for the customer (cust_8f3a2b, a UUID, a tenant slug), never an email or a name: it appears in Analytics, exports, and these responses. Enterprise admins can create the same keys by hand on the Keys page: Create key → One of your customers.

Create a key

POST /v1/customers/{customerId}/keys Returns 201 with the key object plus key, the plaintext secret — it is shown in this response only. Store it before you respond to whatever asked for it; AI Reserve keeps only a hash and cannot show it again.
The customer then uses key exactly like any other AI Reserve key — same base URL, same endpoints, same rate limits as your organization. No header or body field is needed; if the customer’s code does send x-aireserve-customer or user, the key’s customer still wins.

List a customer’s keys

GET /v1/customers/{customerId}/keys Returns every key bound to the customer, newest first, revoked keys included. Secrets are never returned — only the prefix and suffix you need to tell keys apart.

Revoke a key

DELETE /v1/customers/{customerId}/keys/{keyId} Revocation is immediate and permanent: the next request made with the key is refused. The call is idempotent — revoking an already-revoked key returns the same 200. A keyId that does not belong to this customer (or to your organization) returns 404, so a key can never be revoked through the wrong customer’s path.
To rotate, create the new key first, move the customer over, then revoke the old one.

Errors

All three endpoints share your organization’s API rate limit and return the standard error shape. Full request and response schemas are under Customer keys in the API reference.