+20 111 011 4811 support@dht.com.eg 24/7 Expert Support
EN AR
WHATSAPP BUSINESS API

API Documentation

Integrate WhatsApp messaging into your applications with one REST API: send messages, verify users with OTP and check device status.

Introduction

Welcome to the DHT WhatsApp API. This documentation will help you integrate WhatsApp messaging into your applications using our RESTful API.

Quick start

  1. Open the client portal and make sure your WhatsApp service is active.
  2. Copy your API key from the WhatsApp service page.
  3. Connect a WhatsApp device by scanning its QR code.
  4. Start sending messages through the API.

Authentication

Authenticated endpoints require your API key, sent as Authorization: Bearer YOUR_API_KEY, the X-API-Key header, or the api_key field. Your key starts with wa_. The webhook endpoint does not require a key.

Authorization header

Authorization: Bearer wa_your_api_key
🔐Keep your key secret. Regenerating it invalidates the old key immediately.

Base URL

All endpoints are relative to:

https://dht.com.eg/wa-api/api/v1
â„šī¸All examples use the base URL https://dht.com.eg/wa-api/api/v1.

Rate limits

Requests are limited per endpoint and per minute.

Endpoint Limit Window
Send message30requests / minute
Send OTP10requests / minute
Check status60requests / minute
Verify OTP30requests / minute

POST /message/send

Send a text message to a WhatsApp number.

Request body

Parameter Type Required Description
instance_id string No Connected WhatsApp instance ID. If omitted, the first connected device is used.
phone string Yes Recipient phone number with country code (alias: number).
message string Yes Message text content.
type string No Reserved; only text messages are currently supported.

Example request

POST https://dht.com.eg/wa-api/api/v1/message/send
Authorization: Bearer wa_your_api_key
Content-Type: application/json

{
    "instance_id": "YOUR_INSTANCE_ID",
    "phone": "+201012345678",
    "message": "Hello! This is a test message.",
    "type": "text"
}

Response

{
    "status": "success",
    "message": "Message sent successfully",
    "credits_remaining": 19950
}

POST /otp/send

Send a one-time password to a WhatsApp number for verification.

Request body

Parameter Type Required Description
instance_id string No Connected WhatsApp instance ID (optional).
phone string Yes Recipient phone number (alias: number).
code string No Custom OTP code; generated automatically if omitted.
expires_in integer No Expiration time in seconds (default 300, min 60, max 3600).

Example request

POST https://dht.com.eg/wa-api/api/v1/otp/send
Authorization: Bearer wa_your_api_key
Content-Type: application/json

{
    "instance_id": "YOUR_INSTANCE_ID",
    "phone": "+201012345678",
    "expires_in": 300
}

Response

{
    "status": "success",
    "message": "OTP sent successfully",
    "expires_in": 300
}

POST /otp/verify

Verify a one-time password that was sent to the user.

Request body

Parameter Type Required Description
otp string Yes The OTP code received by the user.
phone string Yes The phone number the OTP was sent to (alias: number).

Example request

POST https://dht.com.eg/wa-api/api/v1/otp/verify
Authorization: Bearer wa_your_api_key
Content-Type: application/json

{
    "phone": "+201012345678",
    "otp": "123456"
}

Response

{
    "status": "success",
    "message": "OTP verified successfully"
}

GET /status/{instance_id}

Check the connection status of one of your WhatsApp instances.

Response

{
    "connected": true
}
â„šī¸If the device is disconnected, the response includes a base64 QR code: {"connected": false, "qr": "..."} .

Code examples

Replace the API key and instance ID with your own values.

cURL

curl -X POST "https://dht.com.eg/wa-api/api/v1/message/send" \
  -H "Authorization: Bearer wa_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"instance_id":"YOUR_INSTANCE_ID","phone":"+201012345678","message":"Hello!","type":"text"}'

Node.js

const axios = require('axios');

const response = await axios.post('https://dht.com.eg/wa-api/api/v1/message/send', {
  instance_id: 'YOUR_INSTANCE_ID',
  phone: '+201012345678',
  message: 'Hello!',
  type: 'text',
}, {
  headers: { Authorization: 'Bearer wa_your_api_key' },
});

console.log(response.data);

Python

import requests

response = requests.post(
    'https://dht.com.eg/wa-api/api/v1/message/send',
    json={
        'instance_id': 'YOUR_INSTANCE_ID',
        'phone': '+201012345678',
        'message': 'Hello!',
        'type': 'text',
    },
    headers={'Authorization': 'Bearer wa_your_api_key'},
)

print(response.json())

PHP

<?php
$ch = curl_init('https://dht.com.eg/wa-api/api/v1/message/send');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer wa_your_api_key',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'instance_id' => 'YOUR_INSTANCE_ID',
        'phone' => '+201012345678',
        'message' => 'Hello!',
        'type' => 'text',
    ]),
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;