Authentication & Environments
Learn how to authenticate with the RevKeen API using Unkey-powered API keys, and how to work with Live, Sandbox, and Mock environments.
The RevKeen API uses API keys and a clear environment model so you can safely build, test, and deploy billing integrations.
This page covers:
- How authentication works (via Unkey)
- Key formats and prefixes
- Available environments (Live, Sandbox, Mock)
- How rate limits are enforced
- How to use the API Playground on this site to try the API
1. Authentication Overview
All requests to the RevKeen API are authenticated with an API key passed in the x-revkeen-key header.
RevKeen uses Unkey under the hood to issue, manage, and rate-limit these keys.
x-revkeen-key: rk_live_your_api_keyIf the header is missing or invalid, the API responds with:
401 Unauthorized- An
authentication_errorbody as defined in the Error schema
2. Key Types & Prefixes
API keys are generated from the RevKeen Dashboard → Developers → API Keys page.
Each key has:
- A prefix (indicating environment)
- A random secret (the sensitive part)
- Associated metadata (tenant, rate plan, roles) managed by Unkey
2.1 Key prefixes
| Prefix | Environment | Description |
|---|---|---|
| rk_live_ | Live | Production, real money |
| rk_sandbox_ | Sandbox | Test mode, no real charges |
rk_live_ keys in client-side code, mobile apps, or public repos.3. Environments
RevKeen exposes three environments, all defined in the OpenAPI spec (revkeen-v1.yaml):
| Environment | Base URL | Purpose |
|---|---|---|
| Live | https://api.revkeen.com/v1 | Production traffic |
| Sandbox | https://sandbox-api.revkeen.com/v1 | Safe testing, no real money |
| Mock | https://mock-api.revkeen.com/v1 | Schema-only mock responses |
3.1 Live
Use Live for:
- Real customers
- Real transactions through NMI
- Production integrations
GET /customers
Host: api.revkeen.com
x-revkeen-key: rk_live_123...3.2 Sandbox
Use Sandbox for:
- Development and staging environments
- Automated tests
- Integration trials with your own systems
Sandbox uses:
- Separate data from Live
- The same API surface and validation
- The
rk_sandbox_key prefix
GET /customers
Host: sandbox-api.revkeen.com
x-revkeen-key: rk_sandbox_123...3.3 Mock
The Mock environment is backed by the Scalar mock server and uses only the OpenAPI specification:
- No persistence
- No real side effects
- Deterministic sample responses
Use it when:
- You want to prototype quickly
- You're building a UI without real data
- You're validating request/response shapes
4. Making Authenticated Requests
4.1 Example with curl
curl https://api.revkeen.com/v1/customers \
-H "x-revkeen-key: rk_live_123..." \
-H "Content-Type: application/json"4.2 Example with the TypeScript SDK (Speakeasy)
import { RevKeenClient } from "@revkeen/sdk";
const rk = new RevKeenClient({
apiKey: process.env.REVKEEN_API_KEY!, // rk_live_ or rk_sandbox_
environment: "live", // or "sandbox"
});
const customers = await rk.customers.list({
page: 1,
limit: 20,
});revkeen-v1.yaml spec and automatically sends x-revkeen-key, uses the correct base URL for live or sandbox, and parses typed responses based on your OpenAPI schemas.5. Rate Limits
Rate limiting is enforced per API key via Unkey. From the spec:
| Plan | Requests / minute | Burst |
|---|---|---|
| Starter | 60 | 10 |
| Growth | 600 | 50 |
| Enterprise | 6000 | 200 |
Each response contains the headers:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset(Unix timestamp)
When a limit is exceeded, the API returns 429 Too Many Requests with a rate_limit_error body.
6. API Playground (Try the API)
You can try the API directly from this documentation using the built-in API Playground:
- Go to the API Reference page.
- Click on any endpoint, for example
GET /customers. - In the Try it panel:
- Select the environment (Live, Sandbox, or Mock)
- Under Headers, set
x-revkeen-key: rk_sandbox_...
- Click Send to see the live response.
7. Choosing the Right Environment
Use this as a rule of thumb:
- Local dev / staging → Sandbox
- QA / client demos → Sandbox or Mock
- Production → Live
Architecture-wise:
- All environments share the same OpenAPI spec
- All are protected by Unkey
- SDKs and docs automatically respect your chosen environment