Give a person access to QHR as a user
/usersuser/createRequires feature userNot available in Claudeusers.createInvites 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.
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
| Name | In | Type | Description | Example |
|---|---|---|---|---|
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Request body
application/json
| Field | Type | Description |
|---|---|---|
userRequired | object | The person to give access to. |
user.emailRequired | string (email) | Login email. The invitation is sent here. |
user.first_nameRequired | string | First name. |
user.last_nameRequired | string | Last name. |
user.tenant_role_id | integer | Role 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.
| Field | Type | Description |
|---|---|---|
userRequired | object | A user, as listed. |
user.idRequired | integer | The user's id in this company. Use it in the other user operations. |
user.user_idRequired | integer | The person's QHR account id, the same in every company they belong to (user.id in me.show). |
user.emailRequired | string | Login email. |
user.is_activeRequired | boolean | false once deactivated with users.deactivate: the user can no longer sign in here. |
user.is_ownerRequired | boolean | Whether the user owns the company account. |
user.roleRequired | object | The user's role; it decides what they may see and do. Roles come from roles.list. |
user.role.id | integer | Role id. |
user.role.name | string | Role name in the requested language. |
user.full_nameRequired | string | First and last name. |
messageRequired | string | Confirmation that the invitation was sent. |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 400 | bad_request | A parameter is missing or malformed. | Check the parameters against this operation's documentation. |
| 401 | token_missing | No Authorization: Bearer … header, or it is malformed. | Send Authorization: Bearer qhr_… with the full token. |
| 401 | token_invalid | The 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. |
| 401 | token_expired | The token is past its expiry date. | Create a new token. |
| 401 | token_revoked | The 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. |
| 401 | tenant_inactive | The company account is suspended. | Contact QHR support. |
| 403 | token_read_only | This token can only read; the operation makes changes. | Use a token created with "Allow changes". |
| 403 | forbidden | The token owner's role lacks the permission this operation needs. | Ask an admin to grant the permission shown on this operation (x-permission). |
| 403 | employee_inactive | The token owner's employee record is not active. | HR must reactivate the employee record. |
| 403 | tenant_access_revoked | The 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. |
| 422 | validation_failed | One 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error