/
Contact usSee pricingStart building
Node
​

    About Stytch

    Introduction
    Integration Approaches
      Full-stack overview
      Frontend (pre-built UI)
      Frontend (headless)
      Backend
    Migrations
      Migration overview
      Migrating users statically
      Migrating users dynamically
      Additional migration considerations
      Zero-downtime deployment
      Defining external IDs for users
      Exporting from Stytch
    Custom Domains
      Overview

    Authentication

    DFP Protected Auth
      Overview
      Setting up DFP Protected Auth
      Handling challenges
    Magic Links
    • Email Magic Links

      • Getting started with the API
        Getting started with the SDK
        Replacing your password reset flow
        Building an invite user flow
        Add magic links to an existing auth flow
        Adding PKCE to a Magic Link flow
        Magic Link redirect routing
    • Embeddable Magic Links

      • Getting started with the API
    MFA
      Overview
      Backend integration
      Frontend integration
    Mobile Biometrics
      Overview
    M2M Authentication
      Authenticate an M2M Client
      Rotate client secrets
      Import M2M Clients from Auth0
    OAuth
    • Identity providers

      • Overview
        Provider setup
      Getting started with the API (Google)
      Add Google One Tap via the SDK
      Email address behavior
      Adding PKCE to an OAuth flow
    Connected AppsBeta
      Setting up Connected Apps
      About Remote MCP Servers
    • Resources

      • Integrate with AI agents
        Integrate with MCP servers
        Integrate with CLI Apps
    Passcodes
      Getting started with the API
      Getting started with the SDK
    • Toll fraud

      • What is SMS toll fraud?
        How you can prevent toll fraud
      Unsupported countries
    Passkeys & WebAuthn
    • Passkeys

      • Passkeys overview
        Set up Passkeys with the frontend SDK
    • WebAuthn

      • Getting started with the API
        Getting started with the SDK
    Passwords
      Getting started with the API
      Getting started with the SDK
      Password strength policy
    • Email verification

      • Overview
        Email verification before password creation
        Email verification after password creation
    Sessions
      How to use sessions
      Backend integrations
      Frontend integrations
      Custom claims
      Custom claim templates
      Session tokens vs JWTs
      How to use Stytch JWTs
    TOTP
      Getting started with the API
      Getting started with the SDK
    Web3
      Getting started with the API
      Getting started with the SDK

    Authorization

    Implement RBAC with metadata

    3rd Party Integrations

    Planetscale
    Supabase
    Feathery
    Unit

    Testing

    E2E testing
    Sandbox values
Get support on SlackVisit our developer forum

Contact us

Consumer Authentication

/

Guides

/

About Stytch

/

Migrations

/

Defining external IDs for users

External IDs for users

When a user is created in Stytch, they will be assigned a unique identifier that looks like a UUID. For your convenience, you may choose to additionally assign an "external ID" to a user which can then be used in any place where the Stytch user_id is expected.

Assigning an external ID at creation

When calling the Create User endpoint, you may pass in an optional external_id parameter. The external_id is a string consisting of alphanumeric, ., _, or - characters with a maximum length of 128 characters. External IDs must be unique across users in your project.

You may also set an external ID during a call to the Migrate Password endpoint, but only if the user does not yet exist and is created. If the user already exists, you must use the Update User endpoint to assign or reassign the external_id.

Assigning an external ID later

If a user has already been created, you may assign it an external_id later with the Update User endpoint. Similar to creation, pass in an external_id parameter and it will then be assigned to that user. Again, remember that external IDs must be unique within your project.

Updating a user's external ID

If you wish to change a user's external ID, you may use the same Update User endpoint listed above. After this point, you will no longer be able to refer to that user by its old external_id.

Using external IDs

In any endpoint that expects a user_id, you may instead choose to pass in your custom-defined external_id. For clarity, all responses from Stytch will continue to use the Stytch-defined user_id, though external_id will exist as a subfield within the User object.

Assigning an external ID at creation

Assigning an external ID later

Updating a user's external ID

Using external IDs