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

# Get QR Code

> Get QR Code for WhatsApp session authentication

## Description

This endpoint returns the QR Code needed to authenticate a new session of WhatsApp. The QR Code must be scanned by the WhatsApp app on the user's phone to establish the connection.

## URL Parameters

<ParamField path="session" type="string" required>
  Unique ID of the session to be authenticated
</ParamField>

## Response

<ResponseField name="value" type="string" required>
  Encoded string of the QR Code for authentication. This value must be converted to an image QR Code for display to the user.
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
      "value": "2@At0KZLwyMrvGXeKc5AWN6..."
  }
  ```
</ResponseExample>

## Status Codes

* `200` - QR Code generated successfully
* `400` - Invalid parameters
* `401` - Unauthorized

## Usage Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.wappfy.com.br/api/my-session/auth/qr
  ```

  ```javascript JavaScript theme={null}
  const session = 'my-session';
  const response = await fetch(`https://api.wappfy.com.br/api/${session}/auth/qr`);
  const data = await response.json();
  console.log(data.value);
  ```

  ```python Python theme={null}
  import requests

  session = 'my-session'
  response = requests.get(f'https://api.wappfy.com.br/api/{session}/auth/qr')
  data = response.json()
  print(data['value'])
  ```
</CodeGroup>


## OpenAPI

````yaml viewer-en.json get /api/{session}/auth/qr?server_id=1
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Customizable Server
    variables:
      host:
        default: api.wappfy.com.br
        description: Server URL (e.g., api.wappfy.com.br or your-server.com)
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: Control WhatsApp sessions (accounts)
  - name: 🔑 Auth
    description: Authentication
  - name: 🆔 Profile
    description: Your profile information
  - name: 🖼️ Screenshot
    description: Get WhatsApp screenshot and display QR code
  - name: 📤 Chatting
    description: Conversation methods
  - name: 📢 Channels
    description: Channels (newsletters) methods
  - name: 🟢 Status
    description: Status (aka stories) methods
  - name: 💬 Chats
    description: Conversations methods
  - name: 👤 Contacts
    description: |-
      Contacts methods.<br>
                      Use phone number (without +) or phone number and `@c.us` at the end as `contactId`.<br>
                      E.g: `12312312310` OR `12312312310@c.us`<br>
  - name: 👥 Groups
    description: Groups methods.<br>
  - name: ✅ Presence
    description: Presence information
  - name: 📅 Events
    description: Event Message
  - name: 🏷️ Labels
    description: Labels - available only for WhatsApp Business accounts
  - name: 🔍 Observability
    description: Other methods
  - name: 🗄️ Storage
    description: Storage methods
externalDocs:
  description: Wappfy - WhatsApp API
  url: https://docs.wappfy.com.br/
paths:
  /api/{session}/auth/qr?server_id=1:
    get:
      tags:
        - 🔑 Auth
      summary: Get QR code for WhatsApp API pairing.
      description: The {session} parameter must be the session's instanceName.
      operationId: AuthController_getQR
      parameters:
        - name: session
          required: true
          in: path
          description: The session name (instanceName) you want to authenticate
          example: my-session
          schema:
            type: string
      responses:
        '200':
          content:
            image/png:
              schema:
                type: string
                format: binary
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Base64File'
                  - $ref: '#/components/schemas/QRCodeValue'
              example:
                value: >-
                  2@nKiWT5F8Q9R7K3L4M5N6O7P8Q9R0S1T2U3V4W5X6Y7Z8A9B0C1D2E3F4G5H6I7J8K9L0M...
          description: ''
      security:
        - api_key: []
components:
  schemas:
    Base64File:
      type: object
      properties:
        mimetype:
          type: string
        data:
          type: string
      required:
        - mimetype
        - data
    QRCodeValue:
      type: object
      properties:
        value:
          type: string
          example: >-
            2@nKiWT5F8Q9R7K3L4M5N6O7P8Q9R0S1T2U3V4W5X6Y7Z8A9B0C1D2E3F4G5H6I7J8K9L0M...
      required:
        - value
      example:
        value: >-
          2@nKiWT5F8Q9R7K3L4M5N6O7P8Q9R0S1T2U3V4W5X6Y7Z8A9B0C1D2E3F4G5H6I7J8K9L0M...
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Your Wappfy API key (get it at dash.wappfy.com.br)

````