> ## Documentation Index
> Fetch the complete documentation index at: https://help.atlas.kitchen/llms.txt
> Use this file to discover all available pages before exploring further.

# Request login code

> Sends a one-time login code to a diner who already has an account. It goes by WhatsApp unless you ask for email. `last_otp_delivery_mode` in the response says how it was sent, so you can tell the diner where to look.

To send the code again, wait 30 seconds. Earlier requests get `422`.

A diner with an Atlas account at any merchant gets a code here. If the number has no Atlas account yet, you get `404`; call [Sign up](/connect/accounts-api/sign-in/sign-up) instead.




## OpenAPI

````yaml specs/accounts-v1.yaml POST /request_otp
openapi: 3.1.0
info:
  title: Atlas Accounts API
  version: 1.0.0
  description: ''
servers:
  - url: https://api.atlas.kitchen/accounts/v1
    description: Accounts API
security:
  - channelId: []
    sessionId: []
tags:
  - name: Introduction
    description: >
      The Accounts API lets a diner sign in on your storefront, then read and
      manage their own account with the merchant: profile, saved addresses, past
      orders, points and wallet promotions.


      It uses the same `X-Channel-Id` and `X-Session-Id` headers as the
      [Storefront API](/connect/storefront-api/authentication). Signing in
      attaches the diner to the session, so the Storefront API cart can use and
      earn their points.


      Everything here belongs to one merchant. The channel decides the merchant,
      and the merchant's point program for the channel's brand decides the
      points. The same diner can have different balances with different
      merchants.
  - name: Sign in
    description: Request a one-time code and sign the diner in.
  - name: Profile
    description: The signed-in diner's details.
  - name: Addresses
    description: Delivery addresses the signed-in diner has saved.
  - name: Orders
    description: The signed-in diner's past orders with this merchant.
  - name: Loyalty
    description: The signed-in diner's points and wallet promotions.
paths:
  /request_otp:
    post:
      tags:
        - Sign in
      summary: Request login code
      description: >
        Sends a one-time login code to a diner who already has an account. It
        goes by WhatsApp unless you ask for email. `last_otp_delivery_mode` in
        the response says how it was sent, so you can tell the diner where to
        look.


        To send the code again, wait 30 seconds. Earlier requests get `422`.


        A diner with an Atlas account at any merchant gets a code here. If the
        number has no Atlas account yet, you get `404`; call [Sign
        up](/connect/accounts-api/sign-in/sign-up) instead.
      operationId: requestLoginCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                mobile_number:
                  type: string
                  description: >-
                    The diner's mobile number in international format. Send this
                    or `email`.
                  example: '+6581000001'
                email:
                  type: string
                  format: email
                  description: The diner's email. Send this or `mobile_number`.
                delivery_mode:
                  type: string
                  enum:
                    - whatsapp
                    - email
                  description: |
                    How to send the code. Leave it out to send it by WhatsApp.
                is_resend:
                  type: boolean
                  description: Set to `true` when the diner asks for the code again.
            example:
              mobile_number: '+6581000001'
              delivery_mode: whatsapp
      responses:
        '200':
          description: Code sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OtpRecipient'
              example:
                is_mobile_verified: true
                last_otp_delivery_mode: whatsapp
                masked_email: r****************@d***********
                masked_mobile_number: '*******0001'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            No diner with this mobile number or email. Sign the diner up
            instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Asked again within 30 seconds, or neither `mobile_number` nor
            `email` was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                type: Unprocessable Entity
                message: >-
                  The request cannot be processed because it does not meet the
                  needed conditions. Please try again once the conditions are
                  met.
                details:
                  - field: otp
                    message: >-
                      rate limit exceeded. Please wait 24 seconds to resend
                      again
        '429':
          description: This number or email has had 5 codes in 10 minutes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                type: Too Many Requests
                message: Too many requests. Wait a moment and try again.
                details:
                  - field: otp
                    message: Too many codes requested. Try again in 10 minutes.
components:
  schemas:
    OtpRecipient:
      type: object
      description: Who the code went to, with the email and number masked.
      properties:
        is_mobile_verified:
          type: boolean
        last_otp_delivery_mode:
          type: string
          enum:
            - whatsapp
            - email
          description: How the code was sent. Tell the diner where to look.
        masked_email:
          type: string
        masked_mobile_number:
          type: string
    Error:
      type: object
      properties:
        type:
          type: string
          example: Invalid Parameter
        message:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
  responses:
    Unauthorized:
      description: Missing or invalid `X-Channel-Id` or `X-Session-Id`
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            type: Unauthorized
            message: >-
              You did not provide valid credentials for this request. Please
              check your request and try again.
            details:
              - field: session_id
                message: >-
                  Check if the session ID is set correctly in the X-Session-Id
                  header.
  securitySchemes:
    channelId:
      type: apiKey
      in: header
      name: X-Channel-Id
      description: Merchant storefront identifier. Provided during onboarding.
    sessionId:
      type: apiKey
      in: header
      name: X-Session-Id
      description: >-
        Diner session identifier from the Storefront API's `GET /channel`. Log
        in returns a new one.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.