API Keys API

The API Keys API allows you to create, manage, and revoke API keys for authenticating with the Lumen API.

Overview

There are two types of API keys:

  • Secret Keys: For server-side requests that require full access to the API.
  • Publishable Keys: For client-side requests that require limited, public access (e.g., fetching pricing tables).

Authentication

All API requests require authentication via a secret merchant API key.

Endpoints

List all API Keys

Retrieves a list of all API keys for the authenticated merchant. The full key values are not returned for security reasons.

GET https://api.getlumen.dev/v1/api-keys

Response

{
  "success": true,
  "data": [
    {
      "id": "apk_123",
      "name": "My Secret Key",
      "keyType": "secret",
      "environment": "live",
      "prefix": "lum_sk_live_",
      "createdAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Get Publishable Key

Retrieves the active publishable key for a specific environment.

GET https://api.getlumen.dev/v1/api-keys/publishable

Response

{
  "success": true,
  "data": {
    "id": "apk_456",
    "name": "My Publishable Key",
    "keyType": "publishable",
    "environment": "live",
    "keyValue": "lum_pk_live_...",
    "prefix": "lum_pk_live_",
    "createdAt": "2024-01-01T00:00:00Z"
  }
}

Create API Key

Creates a new API key. The full key value is only returned once upon creation.

POST https://api.getlumen.dev/v1/api-keys

Request Body

{
  "name": "My New Key",
  "keyType": "secret",
  "environment": "live"
}

Request Fields

FieldTypeRequiredDescription
namestringA descriptive name for the API key.
keyTypestringsecret or publishable.
environmentstringlive or test (default: live).

Response

{
  "success": true,
  "data": {
    "id": "apk_789",
    "name": "My New Key",
    "keyType": "secret",
    "environment": "live",
    "keyValue": "lum_sk_live_...",
    "prefix": "lum_sk_live_",
    "createdAt": "2024-01-01T00:00:00Z"
  }
}

Revoke API Key

Revokes an API key, immediately disabling it from further use. This action is irreversible.

DELETE https://api.getlumen.dev/v1/api-keys/{id}

Parameters

ParameterTypeDescription
idstringThe ID of the API key to revoke.

Response

{
  "success": true,
  "data": {
    "id": "apk_789",
    "revokedAt": "2024-01-15T10:30:00Z"
  }
}