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.

Account Membership Model

A Member contains extended information about a user's access to an account.

Attributes

  • 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.

  • 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.

  • email

    string

    Email of the user the membership belongs to.


Add Member experimental

This endpoint allows you to add or update the membership of a user to an account.

Attributes

  • userId

    string required

    The id of the user the Membership belongs to.

  • role

    string required

    The role governing Membership permissions.

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"
}

List 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"
}
]

Revoke Member

This endpoint allows you to revoke a users membership to an account.

Errors

  • LAST_OWNER_NOT_REVOKABLE

    403

    The last remaining membership to an account cannot be revoked.

Request
curl -X DELETE \
https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/members/45dwes-rf4h55-tyf45s-6st4gd \
-H 'x-api-key: <TOKEN>'

List Account Memberships for Authenticated Subject

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"
}
]

List Account Memberships for a User

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"
}
]