Invite user


Request description

Endpoint: /users/invite-to-organization
Method: POST

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Note: the <accessToken> is obtained as a result of the authentication

Payload

{
  "fullName": "mock-full-name",
  "email": "mock@mock.com",
  "groupId": "group-id",
  "userType": "REGULAR"
}

Payload structure

type InviteUserPayloadType = {
  fullName: string,
  email: string,
  groupId?: string,
  userType: UserType
}

type UserType = 'ORGANIZATION_OWNER' | 'ORGANIZATION_ADMIN' | 'REGULAR'

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

201

Response structure:

{
  // empty response
}

Wrong responses

Unauthorized request

Describe the characteristics of an unauthorized request

401

Response body

{
  // empty body
}

Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.

Bad request

Describe the characteristics of a bad request

400

Response body

type InviteUserResponseType = {
    errorType: INVITE_USER_ERROR_TYPE,
    errorMessage?: string
}

enum INVITE_USER_ERROR_TYPE {
  MISSING_FULLNAME = 'missingFullName',
  MISSING_EMAIL = 'missingEmail',
  INVALID_ORGANIZATION_ROLE= 'invalidOrganizationRole'
  EMAIL_ALREADY_EXISTS = 'emailAlreadyExists',
  INVITATION_ERROR = 'invitationError'
}