Create user
const url = 'https://api.torii.so/api/server/v1/users';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"email":"ada@example.com","password":"correct horse battery staple","firstName":"Ada","lastName":"Lovelace","publicMetadata":{"plan":"free"},"privateMetadata":{"stripeId":"cus_123"},"unsafeMetadata":{"onboardingStep":0}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.torii.so/api/server/v1/users \ --header 'Content-Type: application/json' \ --data '{ "email": "ada@example.com", "password": "correct horse battery staple", "firstName": "Ada", "lastName": "Lovelace", "publicMetadata": { "plan": "free" }, "privateMetadata": { "stripeId": "cus_123" }, "unsafeMetadata": { "onboardingStep": 0 } }'Creates an end-user in your environment. All body fields are optional; supply at minimum an email if you want the user to be able to sign in via email + password.
Request Body required
Section titled “Request Body required ”Request body for creating an end-user in your environment. All fields are optional; supply at minimum an email if you want the user to be able to sign in via email + password.
object
Primary email for the new user. If omitted, the user is created without a sign-in identity.
Example
ada@example.comInitial password. Subject to the environment’s password policy. Omit to create a passwordless user (e.g. social-only).
Example
correct horse battery stapleFirst (given) name to seed on the profile.
Example
AdaLast (family) name to seed on the profile.
Example
LovelaceInitial public metadata (SDK-readable, server-written). Max 512 bytes.
object
Example
{ "plan": "free"}Initial private metadata (server-only). Max 4096 bytes.
object
Example
{ "stripeId": "cus_123"}Initial unsafe metadata (end-user writable). Max 512 bytes.
object
Example
{ "onboardingStep": 0}Responses
Section titled “ Responses ”The created user.
An end-user, including server-only private metadata. Returned only on the secret-key backend API.
object
Unique identifier for this user.
Identifier of the environment this user belongs to.
Full name on the profile, if any.
First (given) name on the profile, if any.
Last (family) name on the profile, if any.
Preferred locale for emails and UI messages.
Lifecycle status of the user (e.g. active, banned).
When this user was created (ISO-8601 UTC).
When this user was last modified (ISO-8601 UTC).
Primary email on the profile, if any.
When this user’s primary email was verified, if it has been verified.
When this user was deleted, if soft-deleted. Null for active users.
Public metadata: readable by the SDK, writable only server-side.
object
Private metadata: server-only. Never exposed to the SDK or in a JWT.
object
Unsafe metadata: readable and writable by the end-user via the SDK.
object
Example
{ "id": "01931a73-8b00-7000-8000-000000000000", "environmentId": "01931a72-0000-7000-8000-000000000000", "name": "Ada Lovelace", "firstName": "Ada", "lastName": "Lovelace", "locale": "en", "status": "active", "createdAt": "2026-05-16T09:30:00Z", "updatedAt": "2026-05-16T10:00:00Z", "email": "ada@example.com", "emailVerifiedAt": "2026-05-16T09:35:00Z", "deletedAt": "2026-05-20T12:00:00Z", "publicMetadata": { "plan": "pro" }, "privateMetadata": { "stripeId": "cus_123" }, "unsafeMetadata": { "onboardingStep": 2 }}Invalid body (e.g. weak password, malformed email).
object
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}Missing or invalid secret key.
object
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}Another user with this email already exists in the environment.
object
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}