Link Search Menu Expand Document

API Keys

API keys provide enduring access to a single Centrapay Account.

Contents

Models

API Key

Mandatory Fields

Field Type Description
accountId String The id of the Centrapay Account the API Key is scoped to.
name String The alphanumeric name of the API key, must be unique within the account.
role String The role governing API key permissions.
enabled Boolean Flag indicating the API Key is usable for authentication.
createdAt Timestamp When the API Key was created.

Roles and Permissions

Supported roles are: “account-owner” and “merchant-terminal”. See Auth Permissions for role details.

Operations

Create an API Key

POST /api/accounts/{accountId}/api-keys

curl -X POST https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MyAPIkey",
    "role": "merchant-terminal"
  }'

Example response payload

{
  "name": "MyAPIkey",
  "createdAt": "2020-06-01T22:32:56.631Z",
  "enabled":true,
  "role": "merchant-terminal",
  "accountId": "Jaim1Cu1Q55uooxSens6yk",
  "secret": "EoaEL7skkedBBy9MzrBSyxG95vUAKjYkiFvWEfiAx"
}

List API Keys

GET /api/accounts/{accountId}/api-keys

curl https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \
  -H "X-Api-Key: $api_key"

Example response payload

[
  {
    "accountId": "Jaim1Cu1Q55uooxSens6yk",
    "name": "MyOtherAPIkey",
    "createdAt": "2020-06-01T21:57:25.888Z",
    "enabled":false,
    "role": "merchant-terminal"
  },
  {
    "accountId": "Jaim1Cu1Q55uooxSens6yk",
    "name": "MyAPIkey",
    "createdAt": "2020-06-01T22:34:31.308Z",
    "enabled":true,
    "role": "merchant-terminal"
  }
]

Update an API Key

PUT /api/accounts/{accountId}/api-keys/{apiKeyName}

curl -X PUT https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys/MyAPIkey \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

Required Fields

Field Type Description
enabled Boolean Enable/Disable API key

Example response payload

{
  "accountId": "Jaim1Cu1Q55uooxSens6yk",
  "name": "MyAPIkey",
  "createdAt": "2020-06-01T22:34:31.308Z",
  "enabled":false,
  "role": "merchant-terminal"
}