API Reference

Channels

WhatsApp Protocol authorization

WhatsApp Protocol is a separate channel identified by provider=whatsapp-protocol. It currently supports only session import (auth_mode=session), using existing session credentials to authorize an account.

Getting started

  1. 1

    List provider regions

    Query regions for whatsapp-protocol and choose one with allocatable=true. If none is allocatable, an account cannot currently be created in those regions.

    curl -X GET "https://api.unifyport.ai/v1/providers/whatsapp-protocol/regions" \
      -H "X-Api-Key: <YOUR_API_KEY>"
    List provider regions
  2. 2

    Create account

    Create an account with provider=whatsapp-protocol and auth_mode=session. Save data.id as account_id. Submit protocol credentials only to /auth/session, never in provider_data.

    curl -X POST "https://api.unifyport.ai/v1/accounts" \
      -H "X-Api-Key: <YOUR_API_KEY>" \
      -H "Content-Type: application/json" \
      -d '{
      "name": "WhatsApp Protocol",
      "provider": "whatsapp-protocol",
      "region": "<REGION>",
      "auth_mode": "session"
    }'
    Create account
  3. 3

    Import authentication session

    Submit the whatsapp-protocol object below. phone and all four key fields are required for this flow. Keys are write-only and are not echoed. Omit deprecated fields and do not submit edge_routing.

    curl -X POST "https://api.unifyport.ai/v1/accounts/<ACCOUNT_ID>/auth/session" \
      -H "X-Api-Key: <YOUR_API_KEY>" \
      -H "Content-Type: application/json" \
      -d '{
      "whatsapp-protocol": {
        "phone": "8600000000000",
        "static_pub_key": "<STATIC_PUBLIC_KEY>",
        "static_pri_key": "<STATIC_PRIVATE_KEY>",
        "identity_pub_key": "<IDENTITY_PUBLIC_KEY>",
        "identity_pri_key": "<IDENTITY_PRIVATE_KEY>"
      }
    }'
    Import authentication session
  4. 4

    Confirm the account is ready

    After import, query authorization and runtime state using this account_id. An authorized response does not prove the connection is running. Refresh runtime state before attempting a send if the account remains offline.

    curl -X GET "https://api.unifyport.ai/v1/accounts/<ACCOUNT_ID>/auth" \
      -H "X-Api-Key: <YOUR_API_KEY>"
    
    curl -X POST "https://api.unifyport.ai/v1/accounts/<ACCOUNT_ID>/runtime/refresh" \
      -H "X-Api-Key: <YOUR_API_KEY>"
    Refresh runtime state

Notes

  • Supports text, image and contact details. Quoted replies, mentions, contact listing or writes, conversations and groups are not supported. Event mapping covers text/image message.received, account.started, account.status.updated and account.auth.failed; actual delivery depends on the upstream account.
  • Contact details require an existing LID (xxx@lid). Reuse data.sender.id or data.conversation.id only if it already ends in @lid. Protocol has no contact-list lookup and this endpoint cannot derive an LID from a phone number. Without an LID, you cannot use this lookup. A successful response may omit profile fields.