DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsAuthenticationRegister
Introduction
Getting Started
Authentication
RegisterLogin / LogoutPassword ResetProfile Management
Products
Categories
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Register

Create a new customer account.

Updated March 29, 2026

On this page
  • Overview
  • Registration via OTP
  • Verify the Code
  • Setting a Password (Optional)
  • REST API Equivalent
  • Request Body — Request OTP
  • Request Body — Verify OTP
  • Response — Verify OTP
  • Cart Migration
  • Next Steps

Overview

DashForDevs uses a passwordless-first approach. Customers register by verifying their email with a one-time code (OTP). No separate signup form is needed — requesting an OTP for a new email automatically creates the customer account.

Registration via OTP

Request an OTP code to be sent to the customer's email:

typescript
import dash from "@/lib/dash"

// Step 1: Request OTP — this creates the customer if they don't exist
const result = await dash.auth.requestOTP("newcustomer@example.com", {
  accepts_marketing: true,  // optional: opt into marketing emails
  captcha_token: "...",      // optional: Turnstile/reCAPTCHA token
})

// result = { message: "OTP sent", email: "newcustomer@example.com" }

Verify the Code

After the customer enters the code from their email:

typescript
// Step 2: Verify OTP
const { customer, access_token, refresh_token } = await dash.auth.verifyOTP({
  email: "newcustomer@example.com",
  code: "482901",
})

// Customer is now authenticated
console.log(customer)
// {
//   id: "cust_abc123",
//   email: "newcustomer@example.com",
//   first_name: "",
//   last_name: "",
//   loyalty_points: 0,
//   ...
// }

The SDK automatically stores the tokens internally. All subsequent requests that require authentication will include them.

Setting a Password (Optional)

After OTP registration, customers can set a password for future logins:

typescript
// Must be authenticated first
await dash.auth.setPassword("securePassword123!")
// Now the customer can use either OTP or password to log in

See Login / Logout for password-based authentication.

REST API Equivalent

StepMethodEndpoint
Request OTPPOST/storefront/auth/request-otp
Verify OTPPOST/storefront/auth/verify-otp
Set PasswordPOST/storefront/auth/set-password

Request Body — Request OTP

json
{
  "email": "newcustomer@example.com",
  "accepts_marketing": true,
  "captcha_token": "optional_turnstile_token"
}

Request Body — Verify OTP

json
{
  "email": "newcustomer@example.com",
  "code": "482901"
}

Response — Verify OTP

json
{
  "access_token": "eyJ...",
  "refresh_token": "eyJ...",
  "token_type": "Bearer",
  "expires_in": 86400,
  "customer": {
    "id": "cust_abc123",
    "email": "newcustomer@example.com",
    "first_name": "",
    "last_name": "",
    "has_password": false,
    "loyalty_points": 0
  }
}

Cart Migration

If the customer had a guest cart before registering, merge it into their account immediately after authentication:

typescript
// After verifyOTP succeeds
await dash.cart.migrateToUser()
// Guest cart items are now in the customer's persistent cart

See Get Cart for more on cart migration.

Next Steps

  • Login / Logout — Password-based login and session management
  • Profile Management — Updating customer details after registration
  • Customer Data — How customer data is stored and protected
PreviousCommon PatternsNextLogin / Logout

On this page

  • Overview
  • Registration via OTP
  • Verify the Code
  • Setting a Password (Optional)
  • REST API Equivalent
  • Request Body — Request OTP
  • Request Body — Verify OTP
  • Response — Verify OTP
  • Cart Migration
  • Next Steps