Skip to content
Nigora Zap API

    Sign in Create account

    Connect your number to WhatsApp with a pairing code

    By the end, the phone number will be connected to your instance, with no QR code to scan. This helps when you cannot point a camera at the screen, for example when you set everything up from the phone itself.

    • An instance created in the dashboard, with its ID and token (Getting started).
    • The phone with WhatsApp installed and the number to be connected.
    • curl in the terminal.

    In the examples, replace INSTANCIA_ID with the instance ID and TOKEN with its token.

    The pairing code only exists after the connection starts:

    Terminal window
    curl -X POST https://api.zap.nigora.com.br/v1/instances/INSTANCIA_ID/connect \
    -H "Authorization: Bearer TOKEN"

    The response is 202 with the connectionStatus. It only confirms that the connection started. If the instance is suspended or has a pending payment, the response is 402 with instance_suspended.

    Send the phone of the number to be connected, with country and area codes:

    Terminal window
    curl -X POST https://api.zap.nigora.com.br/v1/instances/INSTANCIA_ID/pairing-code \
    -H "Authorization: Bearer TOKEN" \
    -H "Content-Type: application/json" \
    -d '{ "phone": "5511999999999" }'

    Expected result:

    { "code": "ABCD-1234" }

    Your code will be different, with 8 characters. If the API takes a few seconds, that is normal: it waits for the connection to be ready before generating the code.

    On the phone:

    1. Open WhatsApp.
    2. Go to Linked devices.
    3. Tap Link with phone number.
    4. Enter the code from the previous step.

    If WhatsApp rejects the code, repeat step 2 to request another one.

    Terminal window
    curl https://api.zap.nigora.com.br/v1/instances/INSTANCIA_ID \
    -H "Authorization: Bearer TOKEN"

    Expected result, with connectionStatus set to connected and the number in phone:

    { "connectionStatus": "connected", "phone": "5511999999999" }

    The real response has other instance fields. While the state is not connected, check again in a few seconds. To be notified without polling, set up the instance.connected webhook.

    Status Code What to do
    400 invalid_phone The phone must have 12 or 13 digits, or 10 to 11 without the 55
    409 instance_not_connected No connection is in progress: repeat step 1 and request the code right after
    401 invalid_token Check the token and the instance ID