Skip to main content
Version: 2.0.0

createUser

Create a new user with specified user information.

Parameters

user - An object that contains the information about the user. The payload is defined below.

Payload

key - A unique id by which Permit will identify the user for permission checks.

You will later pass this ID to the permit.check() API. You can use anything for this ID; the user email - a UUID or anything else as long as it's unique on your end. The user key must be url-friendly (slugified).

email - optional - The email of the user. If synced, will be unique inside the environment.
first_name - optional - First name of the user.
last_name - optional - Last name of the user.
attributes - optional - Arbitraty user attributes that will be used to enforce attribute-based access control policies.

{
key: "key",
email: "email@example.com",
first_name: "John",
last_name: "Smith",
attributes: {}
}

Implementation

const response = await permit.api.createUser(user);