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

# User login

> Authenticate user and receive access and refresh tokens



## OpenAPI

````yaml POST /auth/login
openapi: 3.0.3
info:
  title: NativeMessage API
  version: 1.0.0
  description: Complete API documentation for NativeMessage platform
  contact:
    name: NativeMessage Support
    email: support@nativemessage.com
servers:
  - url: https://api-message.nativehub.live/api/v1
    description: Production server
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /auth/login:
    post:
      tags:
        - Auth
      summary: User login
      description: Authenticate user and receive access and refresh tokens
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security: []
components:
  schemas:
    LoginRequest:
      type: object
      required:
        - username
        - password
      properties:
        username:
          type: string
        password:
          type: string
        tenant_id:
          type: string
      example:
        username: john.doe
        password: SecureP@ssw0rd
        tenant_id: c3d4e5f6-a7b8-9012-cdef-123456789012
    LoginResponse:
      type: object
      properties:
        access_token:
          type: string
        refresh_token:
          type: string
        user:
          $ref: '#/components/schemas/UserInfo'
      example:
        access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
        refresh_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
        user:
          id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
          account_id: b2c3d4e5-f6a7-8901-bcde-f12345678901
          tenant_id: c3d4e5f6-a7b8-9012-cdef-123456789012
          username: john.doe
          email: john.doe@example.com
          role: admin
          permissions:
            - messages.send
            - campaigns.manage
          status: active
          created_at: '2026-01-15T10:30:00Z'
          updated_at: '2026-02-10T14:22:00Z'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      example:
        error: Invalid request parameters
    UserInfo:
      type: object
      properties:
        id:
          type: string
          format: uuid
        account_id:
          type: string
          format: uuid
        tenant_id:
          type: string
          format: uuid
        username:
          type: string
        email:
          type: string
          format: email
        role:
          type: string
        permissions:
          type: array
          items:
            type: string
        status:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      example:
        id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        account_id: b2c3d4e5-f6a7-8901-bcde-f12345678901
        tenant_id: c3d4e5f6-a7b8-9012-cdef-123456789012
        username: john.doe
        email: john.doe@example.com
        role: admin
        permissions:
          - messages.send
          - campaigns.manage
          - contacts.manage
        status: active
        created_at: '2026-01-15T10:30:00Z'
        updated_at: '2026-02-10T14:22:00Z'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````