Consumer Authentication

/

API reference

/

Magic links

/

Embeddable

/

Create

Create embeddable Magic Link

POSThttps://test.stytch.com/v1/magic_links

Create an Embeddable Magic Link token for a User. Access to this endpoint is restricted. To enable it, please send us a note at support@stytch.com.

Next steps

Send the returned token value to the end user in a link which directs to your application. When the end user follows your link, collect the token, and call Authenticate Magic Link to complete authentication.

Note: Authenticating an Embeddable Magic Link token will not result in any of the Stytch User's factors (email address or phone number) being marked as verified, as Stytch cannot confirm where the user received the token.


Body parameters


user_id*string

expiration_minutesint

attributesobject

Response fields


status_codeint

request_idstring

user_idstring

tokenstring
curl --request POST \
  --url https://test.stytch.com/v1/magic_links \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6"
  }'

RESPONSE

200
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "token": "SeiGwdj5lKkrEVgcEY3QNJXt6srxS3IK2Nwkar6mXD4="
}

Common Error Types