API Endpoint

POST /generate

Create a new license for a slug. Intended for trusted backend systems after payment success.

POST /generate

Endpoint context

Use these endpoints for license lifecycle operations. /generate and /revoke require a generated active server API key. Runtime endpoints use license_key plus fingerprint.

  • Requires a generated active server API key.
  • Supports Idempotency-Key for safe webhook retries.
  • Resolves slug expiration policy at generation time and stores expires_at on the license.
bash
curl -X POST http://localhost:8080/generate \
  -H "Authorization: Bearer <generated_server_api_key>" \
  -H "Idempotency-Key: evt_123" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "default",
    "metadata": {
      "email": "user@example.com",
      "external_customer_id": "cus_123",
      "external_order_id": "ord_456"
    }
  }'

Request body

json
{
  "slug": "my-product",
  "metadata": {
    "email": "user@example.com",
    "external_customer_id": "cus_123",
    "external_order_id": "ord_456"
  }
}

Response body

json
{
  "license_key": "XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX",
  "slug": "my-product",
  "status": "inactive",
  "metadata": {
    "email": "user@example.com",
    "external_customer_id": "cus_123",
    "external_order_id": "ord_456"
  },
  "expires_at": "2026-10-20T12:00:00Z",
  "created_at": "2026-04-20T12:00:00Z"
}

Response field types

license_key

string

Generated license key.

slug

string

Slug used at generation time.

status

"inactive" | "active" | "revoked"

Current license status.

metadata

object

Arbitrary metadata stored with the license.

expires_at

string | null

RFC3339 expiration timestamp, or null for non-expiring policies.

created_at

string

RFC3339 creation timestamp.

Error codes

400

Invalid JSON, missing slug, oversized fields, or invalid metadata shape.

401

Missing or invalid API key.

404

Referenced slug not found.

409

Idempotency key conflict or in-progress idempotent request.

500

Unexpected server or storage error.

Back to API overview