API Keys

API keys provide enduring access to a single Centrapay Account .

API Key Model

Attributes

  • 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

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

  • enabled

    boolean

    Flag indicating the API Key is usable for authentication.

  • createdAt

    timestamp

    When the API Key was created.

  • createdBy

    crn

    The User or API Key that created the API Key.

  • modifiedAt

    timestamp

    When the API Key was modified.

  • modifiedBy

    crn

    The User or API Key that modified the API Key.

  • version

    string

    An API Key version that is incremented when the API Key is updated.


Create an API Key

This endpoint allows you to create an API key.

Attributes

  • name

    string required

    The alphanumeric name of the API key, must be unique within the account.

  • role

    string required

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

Request
curl -X POST \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"name": "MyAPIkey",
"role": "merchant-terminal"
}
'
Response
{
"name": "MyAPIkey",
"createdAt": "2020-06-01T22:32:56.631Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"modifiedAt": "2020-06-01T22:32:56.631Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"enabled": true,
"role": "merchant-terminal",
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"version": "1",
"secret": "EoaEL7skkedBBy9MzrBSyxG95vUAKjYkiFvWEfiAx"
}

List API Keys

This endpoint allows you to list all API Keys for an Account.

Request
curl -X GET \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys \
-H 'x-api-key: <TOKEN>'
Response
[
{
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"name": "MyOtherAPIkey",
"createdAt": "2020-06-01T21:57:25.888Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"modifiedAt": "2020-06-01T21:57:25.888Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"enabled": false,
"version": "1",
"role": "merchant-terminal"
},
{
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"name": "MyAPIkey",
"createdAt": "2020-06-01T22:34:31.308Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"modifiedAt": "2020-06-01T22:34:31.308Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"enabled": true,
"version": "1",
"role": "merchant-terminal"
}
]

Update an API Key

This endpoint allows you to enable or disable an API key.

Attributes

  • enabled

    boolean required

    Flag indicating the API Key is usable for authentication.

Request
curl -X PUT \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/api-keys/MyAPIkey \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"enabled": false
}
'
Response
{
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"name": "MyAPIkey",
"createdAt": "2020-06-01T22:34:31.308Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:AdminKey",
"modifiedAt": "2020-07-02T22:34:31.308Z",
"modifiedBy": "crn:Jaim1Cu1Q55uooxSens6yk:api-key:MyAPIkey",
"enabled": false,
"version": "2",
"role": "merchant-terminal"
}