/
Contact usSee pricingStart building

    About B2B SaaS Authentication

    Introduction
    Stytch B2B Basics
    Integration Approaches
      Full-stack overview
      Frontend (pre-built UI)
      Frontend (headless)
      Backend
    Next.js
      Routing
      Authentication
      Sessions
    Migrations
      Overview
      Reconciling data models
      Migrating user data
      Additional migration considerations
      Zero-downtime deployment
      Defining external IDs
      Migrating from Stytch Consumer to B2B
      Exporting from Stytch
    Branding
      Custom domains
      Custom email templates

    Authentication

    Single Sign On
    • Resources

      • Overview
        External SSO Connections
        Standalone SSO
    • Integration Guides

      • Start here
        Provider setup
        Backend integration guide
        Headless integration guide
        Pre-built UI integration guide
    OAuth
    • Resources

      • Overview
        Authentication flows
        Identity providers
        Google One Tap
        Provider setup
    • Integration Guides

      • Start here
        Backend integration
        Headless frontend integration
        Pre-built UI frontend integration
    Connected Apps
      Overview
      Getting started with the SDK
      Getting started with the API
      Client types
      OAuth scopes
    • Integration Guides

      • Integrate with an Existing Auth System
        MCP Authorization Overview
        Integrate with a remote MCP server
        Integrate with AI agents
    • Resources

      • Consent Management
        Custom Domains
        Testing Integrations
    Sessions
    • Resources

      • Overview
        JWTs vs Session Tokens
        How to use Stytch JWTs
        Custom Claims
        Custom Claim Templates
    • Integration Guides

      • Start here
        Backend integration
        Frontend integration
    Email OTP
      Overview
    Magic Links
    • Resources

      • Overview
        Email Security Scanner Protections
    • Integration Guides

      • Start here
        Backend integration
        Headless frontend integration
        Pre-built UI frontend integration
    Multi-Factor Authentication
    • Resources

      • Overview
    • Integration Guides

      • Start here
        Backend integration
        Headless frontend integration
        Pre-built UI frontend integration
    Passwords
    • Resources

      • Overview
        Strength policy
    • Integration Guides

      • Pre-built UI frontend integration
    UI components
      Overview
      Implement the Discovery flow
      Implement the Organization flow
    DFP Protected Auth
      Overview
      Setting up DFP Protected Auth
      Handling challenges
    M2M Authentication
      Authenticate an M2M Client
      Rotate client secrets
      Import M2M Clients from Auth0
    Trusted Auth Tokens
      Overview
      Getting Started with External IDPs
      Getting Started with Custom Auth Factors
    Device History
      New device notifications

    Authorization & Provisioning

    RBAC
    • Resources

      • Overview
        Stytch Resources & Roles
        Role assignment
    • Integration Guides

      • Start here
        Backend integration
        Headless frontend integration
    SCIM
    • Resources

      • Overview
        Supported actions
    • Integration Guides

      • Using Okta
        Using Microsoft Entra
    Organizations
      Managing org settings
      JIT Provisioning

    Testing

    E2E testing
    Sandbox values
Get support on SlackVisit our developer forum

Contact us

B2B SaaS Authentication

/

Guides

/

About B2B SaaS Authentication

/

Branding

/

Custom email templates

Custom email templates

As part of Stytch's Full email customization and Stytch brand removal add-on, you can set up your own email templates for any authentication flows that involve sending an email to the user. You can fully customize the subject line, email body HTML, and sender details of the templates.

Setting up custom email templates

Complete the following steps to set up and use a custom email template in your Stytch requests.

1
Enable the Full email customization and Stytch brand removal add-on

Our Full email customization and Stytch brand removal add-on is required in order to use custom email templates. You can enable this add-on in the Optional Add-Ons section of the Billing page in the Stytch Dashboard.

Enable the Stytch branding add-on

2
Set up a custom email domain

Next, you'll need to set up a custom email domain that you can use to send your Stytch emails from. You can set up a custom email domain by following the setup steps in the Custom email domains section of the Custom Domains tab in the Stytch Dashboard.

Make sure that you set up a Custom email domain, rather than a Custom auth domain, which serves a different purpose.

Note that in order to protect our domain reputation, it is not possible to send custom email templates from the default Stytch sender domains. Check out this section of our Custom domains guide for additional information.

3
Create a new custom email template

Now that your custom email domain is set up, you can create a custom email template by navigating to the Branding tab in the Stytch Dashboard and clicking Create new template.

In the Template type dropdown, select Custom HTML template.

Create a new custom HTML email template

You can now use the email template editor to edit the email subject line, the email body HTML, and the sender information such as the sender address, sender display name, and the reply-to address.

You can also insert variables such as the magic_link_url, otp_code, user_email, etc. into your template. Note that the available variables depend on the email template type and specific authentication flow, and not all variables are available in all contexts.

Alternatively, you can use our Programmatic Workspace Actions endpoints or our Terraform provider to create and manage your custom email templates.

4
Use your custom email template in Stytch requests

Once you've finished creating your custom email template, you can instruct Stytch to use it by specifying its template_id in your authentication requests. Stytch endpoints that trigger an email include parameters like login_template_id, signup_template_id, and reset_password_template_id where you can specify the template_id of your custom email template.

Here's an example Send Discovery Email OTP cURL request that specifies a custom email template via the login_template_id parameter:

curl --request POST \
  --url https://test.stytch.com/v1/b2b/otps/email/discovery/send \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "email_address": "email@example.com",
    "login_template_id": "yourCustomEmailTemplateId"
  }'

and the equivalent request made with our frontend JavaScript SDK:

stytchClient.otps.email.discovery.send({
  email_address: 'email@example.com',
  login_template_id: 'yourCustomEmailTemplateId'
});

You can also set a custom email template as the default template for its specific template type. When an email template is set as the default, we'll send that template to the user if you don't specify a template_id in your request.

Setting up custom email templates

1.

Enable the Full email customization and Stytch brand removal add-on

2.

Set up a custom email domain

3.

Create a new custom email template

4.

Use your custom email template in Stytch requests