---
title: "Create license key"
method: POST
path: "/api/v1/licenses/keys"
tags: ["internal"]
---

# Create license key

`POST /api/v1/licenses/keys`

## Request

- Base URL: `https://app.scanopy.net`
- URL: `https://app.scanopy.net/api/v1/licenses/keys`
- Auth: one of:
  - API key in header `Authorization`
  - API key in cookie `session_id`

Mints a license key for this organization's self-hosted servers.
Online keys work on any plan with a self-hosted license. Offline keys need
a plan with air-gapped deployment.

## Request body

- CreateLicenseKeyRequest: The license key to mint.
  - `key_type` 'Online' | 'Offline', required: The two keys an org owner can copy for a self-hosted server. An organization has one of these issued at a time, stored on the org row. Serde keeps the API spelling (`"Online"` / `"Offline"`); strum supplies the snake_case text the column is stored as, the way `PlanStatus` does.

## Response `200`

Signed license key

- ApiResponseLicenseKeyResponse: Envelope for a successful response. Failures are sent with a non-2xx status and an `ApiErrorResponse` body instead.
  - `data` object: The result payload. Omitted on failure.
    - `key` string, required: Signed key to set as `SCANOPY_LICENSE_KEY` on a self-hosted server.
    - `key_type` 'Online' | 'Offline', required: The two keys an org owner can copy for a self-hosted server. An organization has one of these issued at a time, stored on the org row. Serde keeps the API spelling (`"Online"` / `"Offline"`); strum supplies the snake_case text the column is stored as, the way `PlanStatus` does.
  - `error` string, nullable: Not sent on a successful response. Failure messages arrive in an `ApiErrorResponse`.
  - `meta` ApiMeta, required: API metadata included in all responses
    - `api_version` integer, required: API version (integer, increments on breaking changes)
    - `server_version` string, required: Server version (semver)
  - `success` boolean, required: Always `true` on a successful response.

## Other responses

- `403`: Not an owner, the plan has no license key, or the plan does not include this key type

## Changes

- **2026-10-26** `c9d9d46d1ae8`: 1 info
  - api tag `billing` removed
- **2026-09-24** `aa9c34a755ae`: 1 info
  - added the required property `data/key_type` to the response with the `200` status
- **2026-09-24** `7ff37ad8c4cc`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/scanopy/apis/scanopy-api/changes/api/v1/licenses/keys/post.md)

---

[API](https://skmtc.dev/scanopy/apis/scanopy-api.md) - [All operations](https://skmtc.dev/scanopy/apis/scanopy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/scanopy/apis/scanopy-api/revisions/966ba786bdb5?raw)
