Accounts

An Account represents a permission boundary around Centrapay resources. Accounts can have API Keys and Account Memberships which grant access to the resources.

Accounts are classified as either “individual” or “org”. Individual accounts can only have a single member and Centrapay users can only be a member of a single individual account.

Attributes

  • id

    string

    The unique identifier.

  • type

    string

    Account type, must be either ‘org’ or ‘individual’.

  • name

    string

    The display name of the Account.

  • region

    string

    The region that the Account will operate in.

  • test

    boolean

    A flag which is only present if the Account is for testing.

  • createdAt

    timestamp

    When the Account was created.

  • modifiedAt

    timestamp

    When the Account was updated.

  • createdBy

    crn

    The User or API Key that created the Account.

  • modifiedBy

    crn

    The User or API Key that updated the Account.

  • subscriptions

    array

    A list of Subscriptions on the Account.

  • parentAccountId

    string

    The unique identifier of the parent account to which the current account is linked. This field establishes a hierarchical relationship between accounts, indicating that the current account was created by the specified parent account.


Attributes

  • name

    string

    The name of the Subscription.


POST /api/accounts

This endpoint allows you to create an Account.

Attributes

  • name

    string required

    The name of the Account.

  • type

    string required

    Account type, must be either “org” or “individual”.

  • owner

    string

    Id of user to add as member with “account-owner” role.

  • test

    boolean

    A flag indicating if the Account is for testing. Test Accounts will not be able to create non-test Accounts.

  • region

    string

    The region that the Account will operate in. Required for ‘org’ Accounts, not allowed for ‘individual’ Accounts. Can be “NZ”, “AU”, or “US”.

Request
curl -X POST \
https://service.centrapay.com/api/accounts \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"name": "Centrapay Cafe",
"type": "org"
}
'
Response
{
"id": "Jaim1Cu1Q55uooxSens6yk",
"name": "Centrapay Cafe",
"type": "org",
"region": "NZ",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"createdAt": "2020-06-12T01:17:46.499Z",
"modifiedAt": "2020-06-12T01:17:46.499Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"version": "1",
"subscriptions": []
}

GET /api/accounts/{accountId}

This endpoint allows you to retrieve an Account.

Request
curl -X GET \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk \
-H 'x-api-key: <TOKEN>'
Response
{
"id": "Jaim1Cu1Q55uooxSens6yk",
"name": "Centrapay Cafe",
"type": "org",
"region": "NZ",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"createdAt": "2020-06-12T01:17:46.499Z",
"modifiedAt": "2020-06-12T01:17:46.499Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"version": "1",
"subscriptions": []
}

PUT /api/accounts/{accountId}

This endpoint allows you to update an account.

Attributes

  • name

    string required

    The name of the Account.

Request
curl -X PUT \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"name": "Shortland St Cafe"
}
'
Response
{
"id": "Jaim1Cu1Q55uooxSens6yk",
"name": "Shortland St Cafe",
"type": "org",
"region": "NZ",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"createdAt": "2020-06-12T01:17:46.499Z",
"modifiedAt": "2020-06-12T02:35:12.112Z",
"modifiedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"version": "2",
"subscriptions": []
}

PUT /api/accounts/{accountId}/subscriptions

This endpoint allows you to update the subscriptions on an account.

Attributes

  • subscriptions

    array required

    The list of subscriptions to assign to the account.

Errors

  • INVALID_ACCOUNT_ID

    403

    The account does not exist.

  • INVALID_SUBSCRIPTION

    403

    One of the subscriptions in the list is not valid.

Request
curl -X PUT \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/subscriptions \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"subscriptions": [
"quartz"
]
}
'
Response
{
"subscriptions": [
"quartz"
]
}