Add a User to Stytch. A user_id is returned in the response that can then be used to perform other operations within Stytch. An email or a phone_number is required.
Create User
POST
https://test.stytch.com/v1/usersBody parameters
email string
phone_number string
name object
trusted_metadata object
untrusted_metadata object
create_user_as_pending boolean
external_id string
Response fields
status_code int
request_id string
user_id string
user object
email_id string
phone_id string
status string
const stytch = require('stytch');
const client = new stytch.Client({
project_id: 'PROJECT_ID',
secret: 'SECRET',
});
const params = {
email: "sandbox@stytch.com",
external_id: "my-external-id",
};
client.users.create(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });
RESPONSE
201
{
"status_code": 201,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
"user": {...},
"email_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953",
"phone_id": "phone-number-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
"status": "active"
}