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

# Get a session's pairing code

> Returns the pairing code data of a session configured to use code pairing.



## OpenAPI

````yaml /api-reference/openapi.en.json get /api/v1/sessions/{sessionId}/pair-code
openapi: 3.1.0
info:
  title: D-API - Complete WhatsApp Infrastructure
  description: >-
    A scalable, robust solution for automation managers, SaaS products and end
    users who need a reliable WhatsApp integration. It offers multiple
    simultaneous instances, real-time webhooks, an intuitive dashboard and a
    documented REST API with 99.9% uptime and latency under 30ms.
  version: 1.2.1
  contact:
    name: Suporte D-API
    email: suporte@d-api.cloud
    url: https://d-api.cloud
servers:
  - url: https://api.d-api.cloud
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Home
    description: Base endpoints
  - name: Sessions
    description: Endpoints for managing sessions
  - name: Messages
    description: Endpoints for sending messages
  - name: Cloud API
    description: >-
      WhatsApp Official API (Meta Cloud API): manual connection, template
      management (list/create/delete) and template sending.
  - name: IVR Calls
    description: 'Voice call dispatch (IVR): single or bulk, with audio or an IVR flow.'
  - name: SMS
    description: 'SMS sending: single or bulk.'
  - name: Commands
    description: >-
      Look up asynchronous commands (async: true) by the commandId returned when
      enqueued.
paths:
  /api/v1/sessions/{sessionId}/pair-code:
    get:
      tags:
        - Sessions
      summary: Get a session's pairing code
      description: >-
        Returns the pairing code data of a session configured to use code
        pairing.
      operationId: getApiV1SessionsBySessionIdPair-code
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
          description: Session identifier
      responses:
        '200':
          description: Pair code data
          content:
            application/json:
              schema:
                type: object
                properties:
                  sessionId:
                    type: string
                  status:
                    type: string
                  pairCode:
                    type: string
                    description: 8-character pairing code
                  pairPhone:
                    type: string
                    description: Phone number for pairing
                  pairCodeUpdatedAt:
                    type: string
                    format: date-time
                    description: Timestamp when pair code was last updated
                  connectionMode:
                    type: string
                    enum:
                      - qr
                      - pair
                required:
                  - sessionId
                  - status
              example:
                sessionId: session123
                status: connecting
                pairCode: ABCD-1234
                pairPhone: '5511999999999'
                pairCodeUpdatedAt: '2024-01-15T10:30:00.000Z'
                connectionMode: pair
        '404':
          description: Session not found or pair code not available
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  sessionId:
                    type: string
                  code:
                    type: number
              example:
                error: Pair code not available
                sessionId: session123
                code: 404
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  sessionId:
                    type: string
                  code:
                    type: number
              example:
                error: Failed to get pair code
                sessionId: session123
                code: 500
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API Key for authentication. Format: <API_KEY>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.