Link Search Menu Expand Document

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 Membership

Required Fields

Field Type Description
accountId String The id of the Account the Membership is scoped to.
userId String The id of the user the Account Membership belongs to.
role String The role governing Account Membership permissions.
createdAt Timestamp When the Account Membership was created.

Operations

Add Account Member EXPERIMENTAL

POST /api/accounts/{accountId}/members

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",
  "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",
  "version": "1"
}

List Account Members

GET /api/accounts/{accountId}/members

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

Example response payload

[
  {
    "accountId": "Jaim1Cu1Q55uooxSens6yk",
    "userId": "b657195e-dc2f-11ea-8566-e7710d592c99",
    "createdAt": "2020-06-01T21:57:25.888Z",
    "role": "account-owner"
  },
  {
    "accountId": "Jaim1Cu1Q55uooxSens6yk",
    "userId": "9f4b3bae-dc30-11ea-ab70-2743d9be3dd5",
    "createdAt": "2020-06-01T22:34:31.308Z",
    "role": "account-owner"
  }
]

List Account Memberships for authenticated subject

GET /api/account-memberships

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

Example response payload

[
  {
    "accountId": "5uooxSens6ykJaim1Cu1Q5",
    "accountType": "org",
    "role": "account-owner"
  }
]

List Account Memberships for specific user

GET /api/users/{userId}/account-memberships

curl https://service.centrapay.com/api/users/1234/account-memberships \
  -H "X-Api-Key: $api_key"

Example response payload

[
  {
    "accountId": "Jaim1Cu1Q55uooxSens6yk",
    "accountType": "org",
    "role": "account-owner"
  },
  {
    "accountId": "5uooxSens6ykJaim1Cu1Q5",
    "accountType": "org",
    "role": "account-owner"
  }
]