QHR Developers

Give a person access to QHR as a user

POST/users
Needs a read & write tokenCreate portal users user/createRequires feature userNot available in Claudeusers.create

Invites a person to sign in to this company's QHR with a role, without creating an employee record — a "system user", such as an outside accountant or an auditor. The user starts as pending and can sign in once they accept the invitation.

When to use: to give QHR access to someone who does not work for the company as an employee. To give an employee access, use employee_invitations.invite instead, so the login is linked to their HR record.

Prerequisites: the role's id (tenant_role_id) from roles.list. The email must not be a member of the company already (users.list) nor an employee's email (employees.list).

Side effects: a QHR account is created for the email if it has none (an existing account, from another company, is reused), Qoyod Identity is asked to invite the email, and an invitation email is sent; it must be accepted within 7 days. The user takes one of the plan's user seats at once, while pending too. Recorded in the audit log.

Not offered to Claude: it grants access to the company's HR data, with any role up to Admin.

Irreversible operation

This operation cannot be undone and can affect the whole company. Double-check the ids before you call it. For safety it is never offered through Claude.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
userRequiredobjectThe person to give access to.
user.emailRequiredstring (email)Login email. The invitation is sent here.
user.first_nameRequiredstringFirst name.
user.last_nameRequiredstringLast name.
user.tenant_role_idintegerRole to give, from roles.list; must be active. The company's default employee role when omitted.

Response

201 The new user, pending until they accept.

FieldTypeDescription
userRequiredobjectA user, as listed.
user.idRequiredintegerThe user's id in this company. Use it in the other user operations.
user.user_idRequiredintegerThe person's QHR account id, the same in every company they belong to (user.id in me.show).
user.emailRequiredstringLogin email.
user.is_activeRequiredbooleanfalse once deactivated with users.deactivate: the user can no longer sign in here.
user.is_ownerRequiredbooleanWhether the user owns the company account.
user.roleRequiredobjectThe user's role; it decides what they may see and do. Roles come from roles.list.
user.role.idintegerRole id.
user.role.namestringRole name in the requested language.
user.full_nameRequiredstringFirst and last name.
messageRequiredstringConfirmation that the invitation was sent.

Errors

HTTPCodeMeaningHow to fix
400bad_requestA parameter is missing or malformed.Check the parameters against this operation's documentation.
401token_missingNo Authorization: Bearer … header, or it is malformed.Send Authorization: Bearer qhr_… with the full token.
401token_invalidThe token is unknown or wrong, or its owner's account is locked.Check the token was copied in full, or create a new one in QHR › Settings › API & Integrations.
401token_expiredThe token is past its expiry date.Create a new token.
401token_revokedThe token was revoked by its owner or an admin, or the owner was removed from the company (which revokes all their tokens).Create a new token, or ask your admin. If the owner was removed, they must be re-invited to the company first.
401tenant_inactiveThe company account is suspended.Contact QHR support.
403token_read_onlyThis token can only read; the operation makes changes.Use a token created with "Allow changes".
403forbiddenThe token owner's role lacks the permission this operation needs.Ask an admin to grant the permission shown on this operation (x-permission).
403employee_inactiveThe token owner's employee record is not active.HR must reactivate the employee record.
403tenant_access_revokedThe token's owner is no longer an active member of this company. Rare: removing a member normally revokes their tokens, which answers 401 token_revoked instead.The owner must be re-invited to the company, then create a new token. If the owner is still a member, contact QHR support.
422validation_failedOne of: the plan's user seats are all taken; the role does not exist or is switched off; the email is already a member of the company, or belongs to an employee; the email or a name is missing or not valid; Qoyod Identity refused the invitation.Read error. Free a seat with users.deactivate or add seats to the plan; pick an active role from roles.list; for an employee, invite them from their employee record.
This endpoint can also return the errors that can happen on any endpoint →402 / 412 / 425 entitlement_blocked · 429 rate_limited · 500 internal_error

See the full error catalogue →