Log in or create User by email

POSThttps://test.stytch.com/v1/otps/email/login_or_create

Send a one-time passcode (OTP) to a User using their email. If the email is not associated with a User already, a User will be created.

Next steps

Collect the OTP which was delivered to the User. Call Authenticate OTP using the OTP code along with the phone_id found in the response as the method_id.


Body parameters


email*string

expiration_minutesint

login_template_idstring

signup_template_idstring

localestring

create_user_as_pendingboolean

attributesobject

Response fields


status_codeint

request_idstring

user_idstring

email_idstring

user_createdboolean
curl --request POST \
  --url https://test.stytch.com/v1/otps/email/login_or_create \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "sandbox@stytch.com"
  }'

RESPONSE

200
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "email_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953",
  "user_created": true
}