> ## 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.

# Log in

> Signs the diner in with the code from [Request login code](/connect/accounts-api/sign-in/request-login-code) or [Sign up](/connect/accounts-api/sign-in/sign-up).

**Use the new session ID.** On success, the response header `X-Session-Id` holds a new session ID. Send it on every call from now on. The old one stops working, and the diner's cart moves to the new session.




## OpenAPI

````yaml specs/accounts-v1.yaml POST /login
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:
  /login:
    post:
      tags:
        - Sign in
      summary: Log in
      description: >
        Signs the diner in with the code from [Request login
        code](/connect/accounts-api/sign-in/request-login-code) or [Sign
        up](/connect/accounts-api/sign-in/sign-up).


        **Use the new session ID.** On success, the response header
        `X-Session-Id` holds a new session ID. Send it on every call from now
        on. The old one stops working, and the diner's cart moves to the new
        session.
      operationId: logIn
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - otp
              properties:
                mobile_number:
                  type: string
                  description: >-
                    Send this or `email`, the same as when you requested the
                    code.
                email:
                  type: string
                  format: email
                otp:
                  type: string
                  description: The 6-digit code the diner received.
            example:
              mobile_number: '+6581000001'
              otp: '043317'
      responses:
        '200':
          description: >-
            Signed in. Read the new session ID from the `X-Session-Id` response
            header.
          headers:
            X-Session-Id:
              description: >-
                The new session ID. Use it from now on; the one you sent stops
                working.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/Profile'
              example:
                user:
                  name: Richard Hendricks
                  title: null
                  date_of_birth: null
                  email: richard.hendricks@demo.kitchen
                  mobile_number: '+6581000001'
                  is_mobile_verified: true
                  referral_code: AT4101
                  marketing_consent: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: The code is wrong or has expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                type: Invalid Parameter
                message: >-
                  Validation failed for one or more fields. Please check your
                  request and try again.
                details:
                  - field: otp
                    message: is incorrect
        '429':
          description: 5 wrong codes were tried. Request a new code
          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 wrong codes. Request a new code.
components:
  schemas:
    Profile:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
        title:
          type:
            - string
            - 'null'
        date_of_birth:
          type:
            - string
            - 'null'
          format: date
        email:
          type:
            - string
            - 'null'
        mobile_number:
          type:
            - string
            - 'null'
        is_mobile_verified:
          type: boolean
        referral_code:
          type:
            - string
            - 'null'
          description: >-
            Code the diner shares to refer friends, when the merchant runs a
            referral program
        marketing_consent:
          type:
            - boolean
            - 'null'
    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.