Skip to main content
POST
Create or start a WhatsApp session
A session is a WhatsApp number managed by D-API. Use type: "unofficial" for unofficial WhatsApp (via QR code) or type: "cloud_api" for the Official API. You can set the webhookUrl at creation time to receive events in real time (messages, status, connection). See the webhooks documentation.
Choose a stable, unique sessionId per number — it is used in virtually every other endpoint.

Authorizations

Authorization
string
header
required

API Key for authentication. Format: <API_KEY>

Body

application/json
sessionId
string
required

Connection identifier you choose. Use the same value in the other routes.

Minimum string length: 1
connectionMode
enum<string>
default:qr

How to pair the number: qr (QR code) or pair (pairing code).

Available options:
qr,
pair
pairPhone
string

Number to pair, with country code, digits only. Required when connectionMode is pair.

webhookUrl
string

URL that receives the connection's events (messages, statuses, calls).

webhookConfig
object

Which events the webhook receives and at which URL. A missing event or one with enabled: false is not sent.

ignoreGroups
boolean
default:true

Doesn't send events for group messages.

ignoreStatus
boolean
default:true

Doesn't send status (stories) events.

historySync
boolean
default:false

Syncs the device's chat history on connect.

receiveCalls
boolean
default:false

Receives calls made to the number (call.offer events) to answer or reject through the API.

Response

200

Successful response