Link Search Menu Expand Document

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.

Contents

Models

Account

Field Type Description
id String The unique identifier.
type String Account type, must be either ‘org’ or ‘individual’.
name String The display name of the Account.
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.

Operations

Create an Account

POST /api/accounts

curl -X POST https://service.centrapay.com/api/accounts \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Centrapay Cafe",
    "type": "org"
  }'

Required Fields

Field Type Description
name String The name of the account
type String Account type, must be either ‘org’ or ‘individual’

Optional Fields

Field Type Description
owner String Id of user to add as member with “account-owner” role.

Example response payload

{
  "id": "Jaim1Cu1Q55uooxSens6yk",
  "name": "Centrapay Cafe",
  "type": "org",
  "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"
}

Get an Account

GET /api/accounts/{accountId}

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

Example response payload

{
  "id": "Jaim1Cu1Q55uooxSens6yk",
  "name": "Centrapay Cafe",
  "type": "org",
  "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"
}

Update an Account

PUT /api/accounts/{accountId}

curl -X PUT https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Shortland St Cafe"
  }'

Required Fields

Field Type Description
name String The name of the account

Example response payload

{
  "id": "Jaim1Cu1Q55uooxSens6yk",
  "name": "Shortland St Cafe",
  "type": "org",
  "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"
}