Account Memberships
An Account Membership represents a user having access to a Centrapay Account. An Account Membership has a role which grants the user access to some or all of the operations and resources within the account.
Contents
Models
Account Member
A Member contains extended information about an user’s access to an account.
Required Fields
Field | Type | Description |
---|---|---|
accountId | String | The id of the Account the Membership is scoped to. |
accountType | String | The type of the Account the Membership is scoped to. |
accountName | String | The name of the Account the Membership is scoped to. |
userId | String | The id of the user the Membership belongs to. |
role | String | The role governing Membership permissions. |
Optional Fields
Field | Type | Description |
---|---|---|
subject | CRN | User or API key resource name for the membership. |
createdAt | Timestamp | When the Membership was created. |
createdBy | CRN | Resource that created the member. |
modifiedAt | Timestamp | When the Membership was last modified. |
modifiedBy | CRN | Resource that last modified the account member. |
testAccount | Boolean | A flag which is present if the Account is test |
firstName | String | First name of the user the membership belongs to. |
lastName | String | Last name of the user the membership belongs to. |
String | Email of the user the membership belongs to. |
Operations
Add Member EXPERIMENTAL
POST /
curl -X POST https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members \
-H "X-Api-Key: $api_key" \
-H "Content-Type: application/json" \
-d '{
"userId": "da75ad90-9a5b-4df0-8374-f48b3a8fbfcc",
"role": "account-owner"
}'
Example response payload
{
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"accountType": "org",
"userId": "da75ad90-9a5b-4df0-8374-f48b3a8fbfcc",
"role": "account-owner",
"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"
}
List Members
GET /
curl https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members \
-H "X-Api-Key: $api_key"
Example response payload
[
{
"accountName": "Centrapay Cafe",
"accountType": "org",
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"userId": "b657195e-dc2f-11ea-8566-e7710d592c99",
"createdAt": "2020-06-01T21:57:25.888Z",
"role": "account-owner",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@centrapay.com"
},
{
"accountName": "Centrapay Tea Warehouse",
"accountType": "org",
"accountId": "0f9nvqdcn5eaaDLefkg1Xt",
"userId": "9f4b3bae-dc30-11ea-ab70-2743d9be3dd5",
"createdAt": "2020-06-02T10:l4:33.021Z",
"role": "account-owner",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe@centrapay.com"
}
]
Revoke Member
DELETE /
curl -X DELETE https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members/45dwes-rf4h55-tyf45s-6st4gd \
-H "X-Api-Key: $api_key"
Error Responses
Status | Code | Description |
---|---|---|
403 | LAST_ | The last remaining membership to an account cannot be revoked. |
List Account Memberships for authenticated subject
GET /
curl https://service.centrapay.com/api/account-memberships \
-H "X-Api-Key: $api_key"
Example response payload
[
{
"accountName": "Centrapay Tea Warehouse",
"accountId": "5uooxSens6ykJaim1Cu1Q5",
"accountType": "org",
"role": "account-owner"
}
]
List Account Memberships for specific user
GET /
curl https://service.centrapay.com/api/users/1234/account-memberships \
-H "X-Api-Key: $api_key"
Example response payload
[
{
"accountName": "Centrapay Cafe",
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"accountType": "org",
"role": "account-owner"
},
{
"accountName": "Centrapay Tea Warehouse",
"accountId": "5uooxSens6ykJaim1Cu1Q5",
"accountType": "org",
"role": "account-owner"
}
]