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

# Admin email login via Firebase

> Exchange a Firebase ID token (email/password provider) for MechZie JWT tokens.
Only users with `admin` or `super_admin` role may use this endpoint.
The Firebase email must be verified. On first login the account's `firebase_uid`
is synced if it differs from the stored value (invite flow accounts).




## OpenAPI

````yaml /openapi.yaml post /auth/admin-login
openapi: 3.1.0
info:
  title: MechZie API
  version: 1.0.0-rc1
  description: On-demand roadside mechanic dispatch service API (MechZie)
  contact:
    name: MechZie Support
    email: support@mechzie.in
  license:
    name: MIT
    identifier: MIT
servers:
  - url: http://localhost:3000
    description: Local development
  - url: https://mechzie-api-399967621389.asia-south1.run.app/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: auth
    description: Authentication and token management
  - name: users
    description: User profile operations
  - name: vehicles
    description: Customer vehicle management
  - name: mechanics
    description: Mechanic profile and availability
  - name: jobs
    description: Job lifecycle and line items
  - name: tracking
    description: Real-time location tracking
  - name: payments
    description: Razorpay payment integration
  - name: wallet
    description: Mechanic wallet, UPI accounts, disputes, refunds, and settlements
  - name: ratings
    description: Customer and mechanic ratings
  - name: service-categories
    description: Service category management
  - name: notifications
    description: Push notifications and FCM tokens
  - name: uploads
    description: S3 presigned URL generation
  - name: admin
    description: Admin dashboard and management
  - name: super-admin
    description: Super-admin only operations (invite management, role assignment)
  - name: comms
    description: In-job audio calls (100ms) and persistent chat (Socket.IO + REST)
  - name: call
    description: >-
      Call signaling layer — initiate, accept, decline, cancel, end (ringing via
      FCM + Redis over 100ms rooms)
  - name: health
    description: Health check endpoints
paths:
  /auth/admin-login:
    post:
      tags:
        - auth
      summary: Admin email login via Firebase
      description: >
        Exchange a Firebase ID token (email/password provider) for MechZie JWT
        tokens.

        Only users with `admin` or `super_admin` role may use this endpoint.

        The Firebase email must be verified. On first login the account's
        `firebase_uid`

        is synced if it differs from the stored value (invite flow accounts).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - firebaseIdToken
              properties:
                firebaseIdToken:
                  type: string
                  description: Firebase ID token obtained from email/password sign-in
      responses:
        '200':
          description: JWT token pair issued
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      accessToken:
                        type: string
                      refreshToken:
                        type: string
                      userId:
                        type: string
                        format: uuid
                      role:
                        type: string
                        enum:
                          - admin
                          - super_admin
                      expiresIn:
                        type: integer
                        description: Access token TTL in seconds
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security: []
components:
  responses:
    ValidationError:
      description: Request validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid authentication token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      description: Standard error envelope returned by all error responses
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code (e.g. NOT_FOUND, UNAUTHORIZED)
              example: NOT_FOUND
            message:
              type: string
              description: Human-readable description of the error
              example: Resource not found
            errors:
              type: object
              description: Field-level validation errors (only present on 422)
              additionalProperties:
                type: array
                items:
                  type: string
          required:
            - code
            - message
      required:
        - success
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token from /auth/verify-otp

````