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

# Generate authorization token for local user

> Generates an authorization token using which you can access fabric APIs. Ensure that you provide valid credentials to get an authorization token.



## OpenAPI

````yaml offers_v1 post /api-identity/auth/local/login
openapi: 3.0.0
info:
  description: >-
    fabric e-commerce Offers APIs allow you to to set up and manage stock
    keeping unit (SKU) prices. Its wide range of coupon and promotion features
    let you design deals ranging from single-use, customer-specific coupons to
    site-wide promotions.
  version: 1.0.0
  title: Offers v1
  contact:
    email: support@fabric.inc
  license:
    name: fabric API license
    url: https://fabric.inc/api-license
servers:
  - url: https://prod01-apigw.{customer_name}.fabric.zone
    description: Production
    variables:
      customer_name:
        default: yourcompany
        description: Customer name, provided by support team
security: []
tags:
  - name: Pricing
    description: Pricing APIs enable you to add price details for one or many items.
  - name: Promotions
    description: >-
      Promotion APIs enable you to apply and verify promotions and discount
      coupons.
  - name: Login API
    description: >-
      Login endpoint generates an authorization token for local users that they
      can use to log into fabric copilot application. <br /><br /> **Note:** A
      local user is someone who has an active account with fabric Inc
externalDocs:
  description: Learn more about Offers
  url: https://fabric.inc/knowledgebase/offers
paths:
  /api-identity/auth/local/login:
    post:
      tags:
        - Login API
      summary: Generate authorization token for local user
      description: >-
        Generates an authorization token using which you can access fabric APIs.
        Ensure that you provide valid credentials to get an authorization token.
      parameters:
        - in: header
          name: x-site-context
          description: >-
            The x-site-context is a JSON object that must contain date, and
            channel attributes. eg -
            {"date":"2020-12-12T08:00:00.000Z","channel":12}
          required: true
          schema:
            type: object
            required:
              - channel
              - date
            properties:
              channel:
                type: number
                description: Sales channel
                example: 12
              date:
                description: UTC date and time
                type: string
                format: date-time
                example: '2022-03-24T23:16:00.000Z'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/loginV1Request'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/loginV1Response'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error400'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
components:
  schemas:
    loginV1Request:
      type: object
      properties:
        accountId:
          type: number
          description: Merchant's 10 character copilot account ID
          example: 4781348886
        username:
          type: string
          description: Username or email address of the user who will log in
          example: john@fabric.inc
        password:
          type: string
          description: Password using which you log into fabric copilot UI
          example: joHn@123456789!
    loginV1Response:
      type: object
      properties:
        _id:
          type: string
          description: fabric internal ID
          example: 60c3a2c476f9c21239d836ca
        account:
          type: object
          description: Copilot account information
          properties:
            accountId:
              type: string
              description: Merchant's 10 character copilot account ID
              example: 8739392294
        roles:
          type: array
          description: List of available roles for the user
          items:
            type: string
            description: Role description, such as administrator, manager, and so on
            example: Admin
        permissions:
          type: array
          description: List of available permissions for the user
          items:
            type: string
            description: Permission description
            example: read:user
        refreshToken:
          type: object
          description: Refresh token
          example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....
        accessToken:
          type: object
          description: Access Token. This is the token to consume the copilot APIs.
          example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....
    error400:
      type: object
      properties:
        code:
          description: Error code.
          type: string
          example: BAD_REQUEST
        message:
          description: Error description
          type: string
          example: Bad Request
    error500:
      type: object
      properties:
        code:
          description: Error code.
          type: string
          example: INTERNAL_SERVER_ERROR
        message:
          description: Error description
          type: string
          example: Internal server error.

````