---
title: "Reveal Key"
method: POST
path: "/billing/keys"
tags: ["billing"]
---

# Reveal Key

`POST /billing/keys`

## Request

- Base URL: `https://api.licenscheck.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.licenscheck.com/billing/keys`
- Auth: none declared

Issue the API key for a paid Checkout Session, once.

The welcome page Stripe returns the buyer to calls this with the session
id. The session is checked with Stripe (paid, recent, its subscription
live), the key is created on the plan the subscription was bought for
(its metadata; the API plan if it names none), linked to that
subscription, and returned; a second call for the same session is a 409, so a leaked
welcome link can't mint more keys.

Args:
    body: The session id.
    caller: Injected caller, for the per-visitor limit.
    gateway: Injected Stripe gateway.
    repo: Injected `ApiKeyRepository`.

Returns:
    The new key.

Raises:
    HTTPException: 404, 402 or 409 as described in the responses.

## Request body

- RevealIn: The Checkout Session to issue a key for.
  - `session_id` string, required: The `session` parameter Stripe put on the welcome page's URL.

## Response `201`

Successful Response

- IssuedKeyOut: A newly issued key, shown this once.
  - `key` string, required: The full API key (lc_live_...). It's never shown again.
  - `prefix` string, required: The key's readable prefix, for telling keys apart.
  - `email` string, nullable, required: The email the subscription was bought with.
  - `plan` string, required: The plan bought: "starter" or "api".
  - `included_verifications` integer, required: Verifications a month the plan includes.
  - `overage_cents` integer, required: What each verification after those costs, in cents.

## Other responses

- `402`: That checkout isn't paid (or is too old to reveal a key).
- `404`: No such checkout.
- `409`: Its key was already shown; email support for a new one.
- `422`: Validation Error

---

[API](https://skmtc.dev/licenscheck/apis/licenscheck-api.md) · [All operations](https://skmtc.dev/licenscheck/apis/licenscheck-api/llms.txt) · [OpenAPI document](https://skmtc.dev/licenscheck/apis/licenscheck-api/revisions/472db933f385?raw)
