API Authentication

The first step to using Lydian's API suite is to create an API token. This can be done through the merchant portal.

Lydian uses two API key types:

  • API Key (ak_, sent as X-Api-Key) — for direct server-to-server communication between your backend and Lydian's backend.
  • Publishable Key (pk_, sent as X-Publishable-Key) — for frontend calls, most notably creating transactions.

For when to use each and the security model, see API Key vs Publishable Key and Authentication & Environments.

Sandbox Configuration

Production Configuration


API Key Management

API keys can be managed through the Merchant Portal or programmatically using the endpoints below.

Create API Key

POST /accounts/{accountUUID}/keys

POST
/accounts/{accountUUID}/keys
curl --location '{API_BASE_URL}/accounts/{AccountUUID}/keys' \
--header 'X-Api-Key: {API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "keyType": "{KEY_TYPE}",
    "name": "{KEY_NAME}"
}'

keyType must be one of: api or publishable. For publishable keys, an optional merchantUUID query parameter scopes the key to a specific merchant (e.g. ?merchantUUID={MERCHANT_UUID}).

Create API Key Response

  • Name
    generatedKey
    Type
    string
    Description

    The generated key. API keys are prefixed with ak_, publishable keys with pk_.

  • Name
    privateKey
    Type
    string
    Description

    Base64-encoded private key. Only returned for API keys, empty for publishable keys. Store this securely — it cannot be retrieved again.

example response

{
    "generatedKey": "ak_1a2b3c4d5e6f7890",
    "privateKey": "{BASE64_PRIVATE_KEY}"
}

List API Keys

GET /accounts/{accountUUID}/keys

GET
/accounts/{accountUUID}/keys
curl --location '{API_BASE_URL}/accounts/{AccountUUID}/keys' \
--header 'X-Api-Key: {API_KEY}' \
--header 'Content-Type: application/json'

List API Keys Response

  • Name
    keys
    Type
    object
    Description

    Object containing key arrays grouped by type.

    • Name
      api
      Type
      array
      Description

      List of API keys, each with UUID, key, status, role, and name.

    • Name
      publishable
      Type
      array
      Description

      List of publishable keys, each with UUID, key, status, name, and merchantUUID (set when the key is scoped to a merchant).

example response

{
    "keys": {
        "api": [
            {
                "UUID": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                "key": "ak_1a2b3c4d5e6f7890",
                "status": 1,
                "role": "admin",
                "name": "Production API Key"
            }
        ],
        "publishable": [
            {
                "UUID": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
                "key": "pk_9a8b7c6d5e4f3210",
                "status": 1,
                "name": "Checkout Publishable Key",
                "merchantUUID": ""
            }
        ]
    }
}

Revoke API Key

DELETE /accounts/{accountUUID}/keys/{keyUUID}

DELETE
/accounts/{accountUUID}/keys/{keyUUID}
curl --location --request DELETE '{API_BASE_URL}/accounts/{AccountUUID}/keys/{keyUUID}' \
--header 'X-Api-Key: {API_KEY}' \
--header 'Content-Type: application/json'

Returns 204 No Content on success.