The VERA api allows to add an existing user to an organization. This can be done via the API directly. There are two apis which are providing the needed functionalitiy.

Create an invitation id

To create an invitation you need to call the VERA endpoint {host}/organization-memberships/invitations?organizationId={ORG_ID} and provide a valid auth token for your current ORG_ID and the following payload:

{
	"email": "string",
	"role": "MEMBER"
}

The email will be associated with the invitation but is currently unused. The role property defines the future “role” of the assigned user in the organization. At the moment the only allowed role is MEMBER .

When the call was successful the response body of the API will contain the following structure:

{
    "meta": {},
    "data": {
        "id": "7e6725ff-b0d3-4cb8-9260-bc61d06e6a5d",
        "createdAt": "2024-02-05T13:00:27.450Z",
        "updatedAt": "2024-02-05T13:00:27.450Z",
        "expiresAt": "2024-02-06T13:00:27.444Z",
        "email": "[email protected]",
        "role": "MEMBER",
        "claimed": false,
        "discarded": false,
        "organizationId": "da6f549a-5134-4e8b-9674-de95d548f794",
        "membershipId": null
    }
}

In the data response you will see additional fields which are relevant for the invitation:

  • id - This ID is required to “claim” the invitation by another user
  • expiresAt - At this date the expiration will expire - defaults to one day
  • claimed - Indicates if the invitation was already claimed
  • discarded - Indicates if the invitation was discarded in favor of a new one

Claim an invitation

When an invitation was generated for a given organization, this invitation can be claimed by “anyone” who has signed up for the VERA api. To claim an invitation you need to call the endpoint {host}/organization-memberships/invitations/{id}/claim with a POST request without any body. Also you don’t need to add the organizationId GET parameter, because it will fetch the organization from the invitationId provided.

You need to “use” the authorization token from the registered user who should be added to the defined organization.

When the call was successful, the users id will be added to organization with the defined role in the invitation.

Was this page helpful?