---
title: "Create an invited user"
method: POST
path: "/api/v2/users"
tags: ["Users"]
---

# Create an invited user

`POST /api/v2/users`

> 🔑
>
> Required OAuth scope: `users:write`.

Creates a new user account with the invited status. If a user with the same 'mail' or 'username' was previously deleted, this operation will restore their account to an invited status. 

 If 'mail' is provided, the user receives an invitation email upon creation to activate their account, along with other emails. The account can also be activated via the 'Activate a user' endpoint. If 'sendInvitationEmail' is set to false, the user will not receive the invitation email, but may still receive other emails.

## Query parameters

- `sendInvitationEmail` 'true' | 'false'

## Headers

- `360-api-version` 'v2.0', required

## Request body

- InputUserDTO
  - `mail` string — The email address of the user. If not given, username must be given.
  - `username` string — The username that can be used to log in if the company allows it. If not given, mail must be given.
  - `membership` MembershipDTO, required
    - `groupId` string, ObjectId, required — The unique ID of the group the user is a member of.
    - `role` 'admin' | 'analyst' | 'editor' | 'coach' | 'contributor' | 'learner' | 'userAdmin', required — The role of the user in the group.
  - `primaryGroupId` string, ObjectId — The unique ID of the primary group of the user.
  - `custom` string — The value of the **Additional information** field in the user’s profile. This is not the value of the custom fields associated with the user.
  - `firstName` string — The first name of the user.
  - `lastName` string — The last name of the user.
  - `job` string — The role title of the user.
  - `lang` 'bg' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'ht_HT' | 'hu' | 'id' | 'it' | 'ja' | 'kar_MM' | 'ko' | 'lt' | 'mh_MH' | 'nl' | 'nl_BE' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'rw_RW' | 'sk' | 'sl' | 'so_SO' | 'sv' | 'sw_KE' | 'th' | 'ti_ET' | 'tr' | 'uk' | 'zh' | 'vi' — The default language of the user, in a bigram format (en, fr, de, etc.). Default: `en`.
  - `organization` string — The organization that the user belongs to.
  - `phone` string — The phone number of the user.
  - `toBeDeactivatedAt` string, date-time — The date and time when the user will be deactivated, in the `YYYY-MM-DDThh:mm:ss.sssZ` format (ISO 8601 in Coordinated Universal Time (UTC)).

## Response `200`

Returns the previously deleted user, who has been successfully restored to an invited status.

- UserDTO
  - `_id` string, ObjectId, required — The unique ID of the user.
  - `mail` string — The email address of the user.
  - `username` string — The username that can be used to log in if the company allows it.
  - `status` 'active' | 'invited' | 'deleted', required — The status of the user.
  - `lang` 'bg' | 'cs' | 'da' | 'de' | 'el' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'ht_HT' | 'hu' | 'id' | 'it' | 'ja' | 'kar_MM' | 'ko' | 'lt' | 'mh_MH' | 'nl' | 'nl_BE' | 'no' | 'pl' | 'pt' | 'ro' | 'ru' | 'rw_RW' | 'sk' | 'sl' | 'so_SO' | 'sv' | 'sw_KE' | 'th' | 'ti_ET' | 'tr' | 'uk' | 'zh' | 'vi', required — The default language of the user, in a bigram format (en, fr, de, etc.).
  - `firstName` string — The first name of the user.
  - `lastName` string — The last name of the user.
  - `job` string — The role title of the user.
  - `organization` string — The organization that the user belongs to.
  - `phone` string — The phone number of the user.
  - `custom` string — The value of the **Additional information** field in the user’s profile. This is not the value of the custom fields associated with the user.
  - `deletedAt` string[] — The list of dates and times when the user’s profile was soft deleted, in the `YYYY-MM-DDThh:mm:ss.sssZ` format (ISO 8601 in Coordinated Universal Time (UTC)).
  - `primaryGroupId` string, ObjectId — The unique ID of the primary group of the user.
  - `reactivatedAt` string[] — The list of dates and times when the user’s profile was reactivated, in the `YYYY-MM-DDThh:mm:ss.sssZ` format (ISO 8601 in Coordinated Universal Time (UTC)).
  - `lastLoginDate` string, date-time — The date and time when the user last logged in, in the `YYYY-MM-DDThh:mm:ss.sssZ` format (ISO 8601 in Coordinated Universal Time (UTC)).
  - `toBeDeactivatedAt` string, date-time — The date and time when the user will be deactivated, in the `YYYY-MM-DDThh:mm:ss.sssZ` format (ISO 8601 in Coordinated Universal Time (UTC)).
  - `profileImageId` string, ObjectId — The unique ID of the profile image of the user.

## Other responses

- `201` — Returns newly created invited user.
- `400` — The server cannot or will not process the request due to something that is perceived to be a client error.
- `401` — The given access token is either missing, invalid, has expired, or has been revoked.
- `403` — The given access token does not have the required OAuth scope to execute the request.
- `404` — The given `groupId` does not correspond to any existing group.
- `429` — The client has sent too many requests in a short amount of time.

---

[API](https://skmtc.net/360learning/apis/core-api.md) · [All operations](https://skmtc.net/360learning/apis/core-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/360learning/core-api/revisions/94b691b0b72c/schema)
