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

# Pair with code

> One of the **two ways to pair** (link) the instance to WhatsApp — here you generate a code to **type** on the phone (WhatsApp › Linked devices › Link with phone number). The other way is `GET /instance/pair-qr` (a scanned QR). Use one **or** the other; both connect the same instance.



## OpenAPI

````yaml /en/api-reference/openapi.json post /instance/pair-code
openapi: 3.1.0
info:
  title: Zapfy API
  description: >-
    Multi-tenant WhatsApp API. Send messages and manage webhooks through a
    single surface.
  version: 1.0.0
servers:
  - url: https://api.zapfy.io/v1
security:
  - accountToken: []
paths:
  /instance/pair-code:
    post:
      tags:
        - Instance
      summary: Pair with code
      description: >-
        One of the **two ways to pair** (link) the instance to WhatsApp — here
        you generate a code to **type** on the phone (WhatsApp › Linked devices
        › Link with phone number). The other way is `GET /instance/pair-qr` (a
        scanned QR). Use one **or** the other; both connect the same instance.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PairCodeBody'
      responses:
        '200':
          $ref: '#/components/responses/PairingCode'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '502':
          $ref: '#/components/responses/Error'
      security:
        - instanceToken: []
components:
  schemas:
    PairCodeBody:
      type: object
      required:
        - phone
      properties:
        phone:
          type: string
          description: >-
            Phone number in E.164 that will receive the pairing code (with or
            without `+`, spaces or mask, e.g. `5511999998888`).
          example: '5511999998888'
    PairingCodeResult:
      type: object
      properties:
        code:
          type: string
          description: >-
            Pairing code to enter in WhatsApp (Linked devices › Link with phone
            number).
          example: WZXC-1234
  responses:
    PairingCode:
      description: Pairing code.
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/PairingCodeResult'
    Error:
      description: Error.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Instance not found
  securitySchemes:
    accountToken:
      type: http
      scheme: bearer
      description: Account token (`zpfy_acct_...`) — manages instances and webhooks.
    instanceToken:
      type: http
      scheme: bearer
      description: Instance token (`zpfy_inst_...`) — sends messages.

````