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

# Logout user

> Invalidates the current session and logs the user out.



## OpenAPI

````yaml post /auth/logout
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/logout:
    post:
      tags:
        - Auth
      summary: Logout user
      description: Invalidates the current session and logs the user out.
      operationId: logout
      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 operation.
                    type: string
                  success:
                    description: >-
                      Indicates whether the request was successful or failure
                      (true for success, false for failure).
                    type: boolean
                  content:
                    description: An object containing the response content.
                    properties:
                      access_token:
                        description: >-
                          It is a string-based token utilized for authentication
                          and authorization.
                        type: string
                      refresh_token:
                        description: >-
                          It is a string-based token designed for refreshing the
                          user's access token.
                        type: string
                      user:
                        $ref: '#/components/schemas/User'
                        description: An object representing user details.
                    required:
                      - access_token
                      - refresh_token
                      - user
                    type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - Authorization: []
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/operations/logout
        description: API reference for the logout operation
components:
  schemas:
    User:
      title: User
      type: object
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/schemas/User
        description: API reference for the User schema
      required:
        - id
        - first_name
        - last_name
        - email
        - is_email_verified
        - phone
        - country_code
        - is_phone_verified
        - profile_image_url
        - is_anonymous
        - is_logged_in
        - login_methods
        - notification_preferences
        - customer_group
        - customer_id
        - business
      properties:
        id:
          description: The unique ID of the user.
          type: string
          readOnly: true
        first_name:
          description: User’s first name.
          type:
            - string
            - 'null'
        last_name:
          description: User’s last name.
          type:
            - string
            - 'null'
        email:
          description: User’s email I’d.
          type:
            - string
            - 'null'
          format: email
        is_email_verified:
          description: Boolean indicating whether the email is verified.
          type: boolean
          readOnly: true
        phone:
          description: 10 digit phone number without country code.
          type:
            - string
            - 'null'
        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.

            Use this key along with phone. Not necessary for email.
          type:
            - string
            - 'null'
        is_phone_verified:
          description: Boolean indicating whether the phone is verified.
          type: boolean
          readOnly: true
        profile_image_url:
          description: URL to the user's profile image.
          type:
            - string
            - 'null'
          readOnly: true
        is_anonymous:
          description: Indicates whether the user is anonymous.
          type: boolean
          readOnly: true
        is_logged_in:
          description: Indicates whether the user is currently logged in.
          type: boolean
          readOnly: true
        login_methods:
          type: array
          items:
            type: string
            enum:
              - email
              - phone
              - whatsapp
              - password
        notification_preferences:
          $ref: '#/components/schemas/NotificationPreferences'
          description: >-
            User's notification preferences are categorized by transactional,
            promotional, and newsletter types.
        customer_group_id:
          description: User's customer group ID.
          type:
            - string
            - 'null'
          writeOnly: true
        customer_id:
          description: >-
            The unique ID of the customer. Can be used to identify the customer
            in the system. It can be different from the user ID if there are
            multiple users created for the same customer.
          type: string
          readOnly: true
        customer_group:
          description: User's customer group.
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CustomerGroup'
          readOnly: true
        business:
          description: User's business information.
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Business'
        created_at:
          description: Timestamps indicate when the user's account was created.
          type: string
          format: datetime
          readOnly: true
        modified_at:
          description: Timestamps indicating when the user account was last modified.
          type: string
          format: datetime
          readOnly: true
    NotificationPreferences:
      title: NotificationPreferences
      description: 'Set channel preferences for each type of '
      type: object
      externalDocs:
        url: >-
          https://llm-docs.commercengine.io/storefront/schemas/NotificationPreferences
        description: API reference for the NotificationPreferences schema
      required:
        - transactional
        - promotional
        - newsletter
      properties:
        transactional:
          $ref: '#/components/schemas/NotificationChannelPreferences'
          description: >-
            These notifications are typically critical for user engagement,
            providing updates, confirmations, or alerts related to their account
            activities.
        promotional:
          $ref: '#/components/schemas/NotificationChannelPreferences'
          description: >-
            These notifications aim to engage users with promotional content and
            enhance their overall experience with the platform.
        newsletter:
          $ref: '#/components/schemas/NotificationChannelPreferences'
          description: >
            These notifications are often sent periodically as part of a
            subscription service.
    CustomerGroup:
      title: CustomerGroup
      type: object
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/schemas/CustomerGroup
        description: API reference for the CustomerGroup schema
      required:
        - id
        - name
        - slug
        - description
        - is_default
        - active
      properties:
        id:
          type: string
          readOnly: true
        name:
          type: string
        slug:
          type: string
        description:
          type:
            - string
            - 'null'
        is_default:
          description: first record will be treated as default if not changed.
          type: boolean
        active:
          type: boolean
          default: true
    Business:
      title: Business
      type: object
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/schemas/Business
        description: API reference for the Business schema
      required:
        - type
        - name
      properties:
        type:
          type: string
        name:
          type: string
        metadata:
          description: Additional metadata about the business.
          type: object
          additionalProperties:
            type: string
        registered_address:
          $ref: '#/components/schemas/CustomerAddress'
          description: The registered address of the business.
    NotificationChannelPreferences:
      title: NotificationChannelPreferences
      description: Set specific channel preferences
      type: object
      externalDocs:
        url: >-
          https://llm-docs.commercengine.io/storefront/schemas/NotificationChannelPreferences
        description: API reference for the NotificationChannelPreferences schema
      required:
        - email
        - sms
        - whatsapp
      properties:
        email:
          description: >-
            Indicates whether the user has opted to receive notifications via
            email.
          type: boolean
        sms:
          description: >-
            Indicates whether the user has opted to receive notifications via
            SMS.
          type: boolean
        whatsapp:
          description: >-
            Indicates whether the user has opted to receive notifications via
            WhatsApp.
          type: boolean
    CustomerAddress:
      title: CustomerAddress
      type:
        - object
        - 'null'
      externalDocs:
        url: https://llm-docs.commercengine.io/storefront/schemas/CustomerAddress
        description: API reference for the CustomerAddress schema
      required:
        - first_name
        - last_name
        - country_code
        - phone
        - email
        - address_line1
        - address_line2
        - landmark
        - pincode
        - city
        - state
        - country
        - tax_identification_number
        - business_name
        - is_phone_verified
        - is_email_verified
      properties:
        id:
          type:
            - string
            - 'null'
          pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$
          readOnly: true
        first_name:
          type: string
        last_name:
          type:
            - string
            - 'null'
        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.\r\n"
          type: string
        phone:
          description: 10 digit phone number without country code.
          type: string
        email:
          type: string
        address_line1:
          type: string
        address_line2:
          type:
            - string
            - 'null'
        landmark:
          type:
            - string
            - 'null'
        pincode:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
          const: India
        tax_identification_number:
          description: Tax Identification Number specific to the country of operation.
          type:
            - string
            - 'null'
          examples: []
        business_name:
          description: Use in billing & shipping details only.
          type:
            - string
            - 'null'
        is_default_billing:
          description: >-
            Indicates if the address is the default billing address for the
            customer.
          type: boolean
        is_default_shipping:
          description: >-
            Indicates if the address is the default shipping address for the
            customer.
          type: boolean
        is_phone_verified:
          type: boolean
          readOnly: true
        is_email_verified:
          type: boolean
          readOnly: true
        nickname:
          description: Nickname for the address.
          type:
            - string
            - 'null'
          default: null
      examples: []
  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
    NotFound:
      description: Requested resource not found
      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
  securitySchemes:
    Authorization:
      type: http
      description: Access token
      scheme: bearer

````