An Account Membership represents a user having access to a Centrapay Account API . An Account Membership has a role which grants the user access to some or all of the operations and resources within the account.
A Member contains extended information about a user’s access to an account.
Attributes
/api/accounts/{accountId}/members
This endpoint allows you to add or update the membership of a user to an account.
Attributes
userId
role
Request
curl -X POST \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"userId": "da75ad90-9a5b-4df0-8374-f48b3a8fbfcc",
"role": "account-owner"
}
'
Response
{
"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"
}
/api/accounts/{accountId}/members
This endpoint allows you to retrieve the list memberships to an account.
Request
curl -X GET \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members \
-H 'x-api-key: <TOKEN>'
Response
[
{
"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"
}
]
/api/accounts/{accountId}/members/{userId}
This endpoint allows you to revoke a users membership to an account.
Errors
LAST_OWNER_NOT_REVOKABLE
Request
curl -X DELETE \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members/45dwes-rf4h55-tyf45s-6st4gd \
-H 'x-api-key: <TOKEN>'
/api/account-memberships
This endpoint allows you to retrieve the accounts that the authenticated subject is a member of.
Request
curl -X GET \
https://service.centrapay.com/api/account-memberships \
-H 'x-api-key: <TOKEN>'
Response
[
{
"accountName": "Centrapay Tea Warehouse",
"accountId": "5uooxSens6ykJaim1Cu1Q5",
"accountType": "org",
"role": "account-owner"
}
]
/api/users/{userId}/account-memberships
This endpoint allows you to retrieve the accounts that a user is a member of.
Request
curl -X GET \
https://service.centrapay.com/api/users/da75ad90-9a5b-4df0-8374-f48b3a8fbfcc/account-memberships \
-H 'x-api-key: <TOKEN>'
Response
[
{
"accountName": "Centrapay Cafe",
"accountId": "Jaim1Cu1Q55uooxSens6yk",
"accountType": "org",
"role": "account-owner"
},
{
"accountName": "Centrapay Tea Warehouse",
"accountId": "5uooxSens6ykJaim1Cu1Q5",
"accountType": "org",
"role": "account-owner"
}
]