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

# Get Telegram QR code

> Get the QR code to connect Telegram on the phone.



## OpenAPI

````yaml /en/telegram-api/api-reference/openapi-telegram.json get /v1/telegram/instances/{instanceId}/qr
openapi: 3.0.3
info:
  title: Notifique API — Telegram
  description: >-
    Send Telegram messages and manage connections. Authenticate with
    `Authorization: Bearer sk_live_...` or `x-api-key`.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Production
security:
  - ntfTgBearerAuth: []
  - ntfTgApiKeyHeader: []
tags:
  - name: Messages
    description: Send and manage messages
  - name: Instances
    description: Create and connect bots or USER accounts
  - name: Chats
    description: List chats
paths:
  /v1/telegram/instances/{instanceId}/qr:
    get:
      tags:
        - Instâncias
      summary: Get Telegram QR code
      description: Get the QR code to connect Telegram on the phone.
      operationId: ntfTg_getV1TelegramInstanceQr
      parameters:
        - name: instanceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            `data` descreve o passo atual: `status`, `loginUrl`, `base64`,
            `expiresSeconds`; em falha podem vir `errorCode` e `errorMessage`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_QrEnvelope'
              examples:
                connecting:
                  summary: Preparando
                  value:
                    success: true
                    data:
                      status: CONNECTING
                      loginUrl: null
                      expiresSeconds: 0
                      base64: null
                ready:
                  summary: QR disponível
                  value:
                    success: true
                    data:
                      status: WAITING_SCAN
                      loginUrl: tg://login?token=...
                      expiresSeconds: 120
                      base64: data:image/png;base64,iVBORw0KGgo...
                wrongMode:
                  summary: Instance é bot
                  value:
                    success: true
                    data:
                      status: WRONG_MODE
                      loginUrl: null
                      expiresSeconds: 0
                      base64: null
                      message: >-
                        QR login applies to USER mode only. BOT instances use
                        botToken on create.
                alreadyActive:
                  summary: Já conectada
                  value:
                    success: true
                    data:
                      status: ACTIVE
                      loginUrl: null
                      expiresSeconds: 0
                      base64: null
        '400':
          description: >-
            Instance USER sem sessão mas não está em `PENDING` (estado
            inconsistente).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Bad Request
                message: >-
                  Instance has no session but is not PENDING; reset or delete
                  and recreate.
                code: TELEGRAM_USER_INVALID_STATE
        '401':
          description: Chave ausente ou inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Unauthorized
                message: Invalid or missing API Key
                code: UNAUTHORIZED
        '402':
          description: Workspace suspenso ou plano expirado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Payment Required
                message: Plan expired or suspended
                code: WORKSPACE_BLOCKED
        '403':
          description: Sem escopo, instance não permitida ou não é modo USER.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Forbidden
                message: Access to this instance is not allowed by this API Key
                code: FORBIDDEN
        '404':
          description: Instance USER não encontrada ou inaplicável.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Not Found
                message: USER Telegram instance not found
                code: NOT_FOUND
        '409':
          description: Já existe fluxo de QR ativo (outra aba, painel ou cliente).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfTg_ErrorResponse'
              example:
                success: false
                error: Conflict
                message: >-
                  QR login is already in progress for this instance (e.g.
                  dashboard stream or another client). Try again when it
                  finishes.
                code: TELEGRAM_QR_LOGIN_IN_PROGRESS
components:
  schemas:
    NtfTg_QrEnvelope:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
        data:
          $ref: '#/components/schemas/NtfTg_QrData'
    NtfTg_ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: 'Rótulo HTTP do erro (ex.: Unauthorized, Bad Request, Not Found).'
        message:
          type: string
          description: >-
            Message legível para exibir ao usuário (localizada via
            Accept-Language / x-locale quando aplicável).
        code:
          type: string
          description: >-
            Código estável da API v1 (enum). Sempre presente em erros. Use com o
            status HTTP para decidir retry ou correção. Ver [Responses de
            erro](/guides/conceitos/resposta-de-erros).
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
      required:
        - success
        - error
        - message
        - code
    NtfTg_QrData:
      type: object
      properties:
        status:
          type: string
          description: 'Ex.: CONNECTING, WAITING_SCAN, ACTIVE, ERROR, WRONG_MODE'
        loginUrl:
          type: string
          nullable: true
        expiresSeconds:
          type: integer
        base64:
          type: string
          nullable: true
          description: Image PNG em data URL ou base64 conforme retorno atual
        message:
          type: string
          description: 'Presente em alguns estados (ex.: WRONG_MODE)'
        errorCode:
          type: string
        errorMessage:
          type: string
  securitySchemes:
    ntfTgBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Authorization: Bearer sk_live_xxxxx'
    ntfTgApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````