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. |
region | String | The region that the Account will operate in. Only defined for ‘org’ Accounts. |
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. |
Subscription
Field | Type | Description |
---|---|---|
name | String | The name of the Subscription. |
Operations
Create an Account
POST /
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. |
test | Boolean | A flag indicating if the Account is for testing. |
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”. |
Example response payload
{
"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 an Account
GET /
curl https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk \
-H "X-Api-Key: $api_key"
Example response payload
{
"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": [
]
}
Update an Account
PUT /
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",
"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": [
]
}