An Invitation can be used to allow users to claim ownership of a resource on the Centrapay platform.
Attributes
Attributes
role
stringaccountName
string
POST/api/invitations
This endpoint allows you to create an Invitation.
Attributes
type
stringrequiredresourceId
stringrequiredresourceType
stringrequiredrecipientAlias
stringrequiredparams
objectrequiredrole
stringrequired
Errors
INVALID_ACCOUNT_TYPE
403RECIPIENT_ALREADY_INVITED
403
Request
POST/api/invitations
curl -X POST \
https://service.centrapay.com/api/invitations \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"type": "account-membership",
"resourceId": "Hopo4g34sLVdjEMBs2p19F",
"resourceType": "account",
"recipientAlias": "user@org.com",
"params": {
"role": "cashier"
}
}
'
Response
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "Hopo4g34sLVdjEMBs2p19F",
"resourceType": "account",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdAt": "2021-08-25T00:02:49.488Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"updatedAt": "2021-08-25T00:02:49.488Z",
"updatedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"recipientAlias": "user@org.com",
"params": {
"role": "cashier",
"accountName": "Centrapay Cafe"
},
"status": "created"
}
GET/api/invitations/code/{code}
This endpoint allows you to retrieve an Invitation by code.
Request
GET/api/invitations/code/WIj211vFs9cNACwBb04vQw
curl -X GET \
https://service.centrapay.com/api/invitations/code/WIj211vFs9cNACwBb04vQw \
-H 'x-api-key: <TOKEN>'
Response
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "5ee0c486308f590260d9a07f",
"resourceType": "account",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdAt": "2021-08-25T00:02:49.488Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"updatedAt": "2021-08-25T00:02:49.488Z",
"updatedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey"
}
GET/api/accounts/{accountId}/invitations
This endpoint allows you list Invitations for an Account.
Request
GET/api/accounts/8usozbJzCJYjR8i7y92vMV/invitations
curl -X GET \
https://service.centrapay.com/api/accounts/8usozbJzCJYjR8i7y92vMV/invitations \
-H 'x-api-key: <TOKEN>'
Response
{
"items": [
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "Hopo4g34sLVdjEMBs2p19F",
"resourceType": "account",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdAt": "2021-08-25T00:02:49.488Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"updatedAt": "2021-08-25T00:02:49.488Z",
"updatedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"recipientAlias": "user@org.com",
"params": {
"role": "account-owner",
"accountName": "Centrapay Cafe"
},
"status": "created"
},
{
"id": "JKKDMU38hd01hfEqwF1oT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "Hopo4g34sLVdjEMBs2p19F",
"resourceType": "account",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdAt": "2021-08-25T00:02:49.488Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"updatedAt": "2021-08-25T00:02:49.488Z",
"updatedBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"recipientAlias": "john.doe@org.com",
"params": {
"role": "cashier",
"accountName": "Centrapay Tea Warehouse"
},
"status": "sent"
}
]
}
POST/api/invitations/{invitationId}/accept
This endpoint allows you to accept an Invitation.
Attributes
code
stringrequiredaccountId
stringrequired
Errors
INVITATION_EXPIRED
403INVITATION_ALREADY_ACCEPTED
403RECIPIENT_ALIAS_MISMATCH
403INVITATION_REVOKED
403
Request
POST/api/invitations/DKTs3U38hdhfEqwF1JKoT2/accept
curl -X POST \
https://service.centrapay.com/api/invitations/DKTs3U38hdhfEqwF1JKoT2/accept \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"code": "WIj211vFs9cNACwBb04vQw",
"accountId": "Jaim1Cu1Q55uooxSens6yk"
}
'
Response
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "5ee0c486308f590260d9a07f",
"resourceType": "account",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdAt": "2021-08-25T00:02:49.488Z",
"createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey",
"accepted": true,
"acceptedAt": "2021-08-25T10:12:22.122Z",
"acceptedBy": "crn::user:e2837e88-d408-11eb-8eac-3e22fb52e878",
"acceptedByAccountId": "Jaim1Cu1Q55uooxSens6yk",
"updatedAt": "2021-08-25T10:12:22.122Z",
"updatedBy": "crn::user:e2837e88-d408-11eb-8eac-3e22fb52e878"
}
POST/api/invitations/{invitationId}/revoke
This endpoint allows you to revoke an Invitation.
Errors
INVITATION_EXPIRED
403INVITATION_ACCEPTED
403
Request
POST/api/invitations/DKTs3U38hdhfEqwF1JKoT2/revoke
curl -X POST \
https://service.centrapay.com/api/invitations/DKTs3U38hdhfEqwF1JKoT2/revoke \
-H 'x-api-key: <TOKEN>'
Response
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"code": "WIj211vFs9cNACwBb04vQw",
"type": "account-membership",
"resourceId": "Hopo4g34sLVdjEMBs2p19F",
"resourceType": "account",
"recipientAlias": "user@org.com",
"params": {
"role": "cashier",
"accountName": "Centrapay Cafe"
},
"createdAt": "2021-08-25T00:02:49.488Z",
"expiresAt": "2021-08-26T00:02:49.488Z",
"createdBy": "crn::user:1234",
"updatedAt": "2021-08-25T00:00:00.000Z",
"updatedBy": "crn::user:1234",
"status": "revoked"
}