> ## Documentation Index
> Fetch the complete documentation index at: https://www.commercengine.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Login with WhatsApp

> Sends an OTP to the user's WhatsApp number. Returns an `otp_token` to pass to the verify-otp endpoint. Set `register_if_not_exists` to `true` to auto-register new users on OTP verification.



## OpenAPI

````yaml post /auth/login/whatsapp
openapi: 3.1.0
info:
  version: '1.0'
  title: CE Storefront APIs
  summary: Customer-facing e-commerce API for building exceptional shopping experiences
  description: >-
    Public-facing API for Commerce Engine storefronts, enabling seamless
    shopping experiences with product browsing, cart management, checkout
    processing, user accounts, and order tracking. Perfect for building web,
    mobile, and headless commerce applications.
  contact:
    name: Support
    email: support@commercengine.io
    url: https://www.commercengine.io/contact-us
  license:
    url: https://www.commercengine.io/contact-us
    name: All Rights Reserved
servers:
  - url: https://staging.api.commercengine.io/api/v1/{store_id}/storefront
    description: Staging Server
    variables:
      store_id:
        description: Store ID
        default: store_id
    x-speakeasy-server-id: staging
  - url: https://prod.api.commercengine.io/api/v1/{store_id}/storefront
    description: Prod Server
    variables:
      store_id:
        description: Store ID
        default: store_id
    x-speakeasy-server-id: prod
security: []
tags:
  - name: Analytics
    description: Analytics
  - name: Auth
    description: auth
  - name: Campaigns
    description: Campaigns
  - name: Carts
    description: Carts
  - name: Catalog
    description: Catalog
  - name: Common
    description: Common
  - name: Coupons & promotions
    description: Coupons & promotions
  - name: Customers
    description: Customers
  - name: Juspay
    description: Juspay Payments
  - name: KYC
    description: KYC
  - name: Marketplace
    description: Marketplace
  - name: Orders
    description: Orders
  - name: Others
    description: Others
  - name: Payments
    description: Payments
  - name: PayU
    description: PayU Payments
  - name: POS
    description: POS
  - name: Shipping
    description: Shipping
  - name: Store
    description: Store
  - name: Subscriptions
    description: Subscriptions
externalDocs:
  url: https://llm-docs.commercengine.io
  description: Commerce Engine API Reference Documentation
paths:
  /auth/login/whatsapp:
    post:
      tags:
        - Auth
      summary: Login with WhatsApp
      description: >-
        Sends an OTP to the user's WhatsApp number. Returns an `otp_token` to
        pass to the verify-otp endpoint. Set `register_if_not_exists` to `true`
        to auto-register new users on OTP verification.
      operationId: login-with-whatsapp
      parameters:
        - $ref: '#/components/parameters/DebugMode'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - phone
              properties:
                country_code:
                  description: >-
                    Two-letter code begin with a plus sign prefix that
                    identifies different countries. By default it will be +91 if
                    not provided.
                  const: '+91'
                phone:
                  description: >-
                    10 digit phone number without country code, linked with
                    WhatsApp.
                  type: string
                  maxLength: 10
                  minLength: 10
                  pattern: ^[0-9]{10}$
                register_if_not_exists:
                  description: >-
                    When `true`, auto-registers the user if the phone number is
                    not found. Defaults to `false` (OTP sent only to registered
                    users).
                  type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - success
                  - content
                properties:
                  message:
                    description: >-
                      A descriptive message confirming the success or failure of
                      the Login process.
                    type: string
                  success:
                    description: >-
                      Indicates whether the request was successful or failure
                      (true for success, false for failure).
                    type: boolean
                  content:
                    $ref: '#/components/schemas/OtpContent'
          links:
            VerifyWhatsappOtp:
              operationId: verify-otp
              requestBody:
                otp_action: $response.body#/content/otp_action
                otp_token: $response.body#/content/otp_token
              description: Verify the OTP sent via WhatsApp.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - Authorization: []
      externalDocs:
        url: >-
          https://llm-docs.commercengine.io/storefront/operations/login-with-whatsapp
        description: API reference for the login-with-whatsapp operation
components:
  parameters:
    DebugMode:
      name: x-debug-mode
      in: header
      required: false
      schema:
        type: boolean
      description: >-
        This param is used to enable debug mode. If debug mode is enabled, the
        API will return OTP as well. This is only for development and testing
        purposes.
  schemas:
    OtpContent:
      title: OtpContent
      type: object
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/schemas/OtpContent
        description: API reference for the OtpContent schema
      required:
        - otp_token
        - otp_action
      properties:
        otp_token:
          description: Token to pass to the verify-otp endpoint along with the OTP.
          type: string
        otp_action:
          description: Action type to pass to the verify-otp endpoint.
          type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            required:
              - message
              - success
              - code
            properties:
              message:
                type: string
                x-speakeasy-error-message: true
              success:
                type: boolean
              code:
                type: string
              error:
                type: object
    Unauthorized:
      description: Not authorized for given operation on the Resource
      content:
        application/json:
          schema:
            type: object
            required:
              - message
              - success
              - code
            properties:
              message:
                type: string
                examples:
                  - Not authorized for given operation on the Resource.
                x-speakeasy-error-message: true
              success:
                type: boolean
                default: false
              code:
                type: string
                examples:
                  - unauthorized
  securitySchemes:
    Authorization:
      type: http
      description: Access token
      scheme: bearer

````