Official WhatsApp Business API Partner
wa.sendpk.com logo
API Documentation

Official WhatsApp Business API

Send WhatsApp-approved template messages — text, dynamic, media, and button-based — plus 24-hour free-form replies, through a single REST endpoint in whichever language your stack already uses.

Live Environment API Key Authentication REST / HTTP (GET & POST) Meta-Approved Templates PHP · Node.js · Python
Base URL https://wa.sendpk.com/api/

Introduction

The wa.sendpk.com API enables businesses to communicate with customers through the official WhatsApp Business Platform — automated messaging, template-based notifications, and integration with your own CRM or backend systems. It supports sending and receiving text, images, and media while ensuring data security and compliance with WhatsApp's guidelines, helping you automate customer interactions, notifications, and support at scale.

Authentication

Every request must include your api_key as a GET or POST parameter — there is no separate Authorization header. Get your credentials in two steps:

1. Create an accountRegister, then log in to the customer portal.
2. Get your api_keyCopy your api_key from the profile page in your dashboard.
Keep your api_key secret — anyone with it can send messages from your connected WhatsApp number.

Base URL

This platform is multi-tenant: your Base URL is always your own account domain, shown below. Every example on this page uses it automatically.

Your Base URL https://wa.sendpk.com/api/

WhatsApp Message Template Guidelines

Before sending a WhatsApp template message, approval from WhatsApp (Meta) is required. Templates can be created via our portal or API. The number of templates you can create is limited by your package plan, and templates are approved or disapproved directly by WhatsApp — please follow their guidelines for template approval.

Template Structure

Templates consist of the following components:

ComponentRequiredLimits
HeaderNoText, image, or media. Max 60 characters and 1 dynamic variable if text.
BodyYesUp to 1024 characters, can accommodate over 50 dynamic variables.
FooterNoText limited to 60 characters, no dynamic variables.
ButtonsNoUp to 13 buttons: 2 website buttons, 1 call button, 10 quick reply buttons.

Please ensure your templates comply with WhatsApp's guidelines to avoid disapproval.

POST GET

Simple Template API (Fixed Content)

To send a template message, you first need an approved template from WhatsApp. This example uses a fixed-content template with no variables:

“Thank you for your order! We have received your order and are currently processing it. You will receive updates as your order moves forward. If you have any questions, feel free to contact us”
This message has no variables — the content is fixed. If your template has variables like {{1}}, see Dynamic Template API below.

Example Request

curl --location --request POST 'https://wa.sendpk.com/api/send.php' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'api_key=YOUR-SECRET-API-KEY' \
--data-urlencode 'template_id=TEMPLATE_ID' \
--data-urlencode 'template_data=[{"mobile":"923XXXXXXXXX"}]'
<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://wa.sendpk.com/api/send.php',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => 'api_key=YOUR-SECRET-API-KEY&template_id=TEMPLATE_ID&template_data=[{"mobile":"923XXXXXXXXX"}]',
  CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'),
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
  'api_key': 'YOUR-SECRET-API-KEY',
  'template_id': 'TEMPLATE_ID',
  'template_data': JSON.stringify([{ mobile: '923XXXXXXXXX' }])
});

axios({
  method: 'post',
  url: 'https://wa.sendpk.com/api/send.php',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  data: data
}).then(function (response) {
  console.log(response.data);
});
import http.client, json

conn = http.client.HTTPSConnection("wa.sendpk.com")
payload = 'api_key=YOUR-SECRET-API-KEY&template_id=TEMPLATE_ID&template_data=' + json.dumps([{"mobile": "923XXXXXXXXX"}])
headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
conn.request("POST", "/api/send.php", payload, headers)
res = conn.getresponse()
print(res.read().decode("utf-8"))

Example Response

{
  "success": "true",
  "method": "API",
  "message_type": "TEMPLATE",
  "total_price": "1",
  "total_gsm": "1",
  "remaining_credit": "912",
  "results": [
    { "status": "OK", "id": "5da97116-6d63-496c-a5d4-38a54b089248", "mobile": "923XXXXXXXXX" }
  ]
}

Sending to Multiple Recipients

Add more objects to the template_data JSON array to message more than one recipient in a single request:

[
  { "mobile": "92313XXXXXXX" },
  { "mobile": "92300XXXXXXX" },
  { "mobile": "92340XXXXXXX" }
]
Open in PostmanSimple Template API collection entry
POST GET

Dynamic Template API

Dynamically fill in the message header and body content — text, images, or media — to personalize each message for its recipient. For example, an approved template might read:

“Hi {{1}}, your order has been successfully placed! The total amount is {{2}}. Thank you for choosing us!”
Placeholders such as {{1}} and {{2}} represent dynamic variables in the message body — {{1}} is the first variable, {{2}} the second, and so on. Replace them with per-recipient values using the body array in template_data.

Example Request

GET https://wa.sendpk.com/api/send.php?api_key=YOUR-SECRET-API-KEY&template_id=TEMPLATE_ID
    &template_data=[{"mobile":"923XXXXXXXXX","body":[{"type":"text","text":"Abdul Basit"},{"type":"text","text":"1500"}]}]

Example Response

{
  "success": "true",
  "method": "API",
  "message_type": "TEMPLATE",
  "total_price": "1",
  "total_gsm": "1",
  "remaining_credit": "906",
  "results": [
    { "status": "OK", "id": "8ed138a8-d9dd-41c8-833d-d314c269493e", "mobile": "923XXXXXXXXX" }
  ]
}
Open in PostmanDynamic Template API collection entry
POST GET

Media Template API

Send templates whose header contains a media attachment — image, document, video, or text. For example, an approved template with an image header:

“Hi {{1}}, this is to confirm your order of the {{2}} watch. The total price is {{3}}. Thank you for your purchase”

Set the header object's type to image, document, video, or text, with a url pointing to your own media file:

[
  {
    "mobile": "923XXXXXXXXX",
    "header": {
      "type": "image",
      "url": "https://wa.sendpk.com/assets-front-end/images/api_docs/watch.jpg"
    },
    "body": [
      { "type": "text", "text": "Abdul Hadi" },
      { "type": "text", "text": "Apple Watch Ultra 2" },
      { "type": "text", "text": "$ 800" }
    ]
  }
]
If you skip the header object, the default media chosen at WhatsApp's template approval time is used instead. Providing your own media URL lets you personalize the header per recipient.

Document File Name

For a document header, add file_name next to url. This is the name the recipient sees on the file card in WhatsApp. If you leave it out, WhatsApp shows Untitled.

[
  {
    "mobile": "923XXXXXXXXX",
    "header": {
      "type": "document",
      "url": "https://example.com/docs/receipt.pdf",
      "file_name": "Fee Receipt 048693.pdf"
    },
    "body": [
      { "type": "text", "text": "048693" },
      { "type": "text", "text": "Abdul Hadi" }
    ]
  }
]
Keep the file extension at the end of file_name (for example .pdf) so the correct file icon is shown. file_name is set per recipient, so you can include a name or receipt number in it. In a GET URL, write spaces as +"file_name":"Fee+Receipt+048693.pdf".
Open in PostmanMedia Template API collection entry
POST GET

Free Form Messages

Free-form messages let you send WhatsApp messages within 24 hours after a user replies to your template message. They do not require template approval, and support four content types via the free_form JSON array.

ParameterRequiredDescription
api_keyYesYour API key
free_formYesJSON array of message payload(s). Each object must include mobile and type.

Text Message

GET https://wa.sendpk.com/api/send.php?api_key=YOUR-SECRET-API-KEY&free_form=[
  {"mobile":"923XXXXXXXXX","type":"text","text":{"body":"Hello, this is a free form text message."}}
]

Image, Document & Media Messages

Same shape, with type set to image, document, or media and a matching object providing url and caption:

[
  {
    "mobile": "923XXXXXXXXX",
    "type": "image",
    "image": { "url": "https://example.com/image.jpg", "caption": "Image caption text" }
  }
]
type must be one of text, image, document, or media. mobile is mandatory for every type, each type requires its own mandatory fields, and invalid or missing parameters return an error response.

Full Parameter Reference

Complete list of parameters accepted by /api/send.php.

ParameterRequiredDescription
api_key*YesYour API key
whatsapp_idNoSend the message from a specific connected WhatsApp number/ID
template_id*Required for template messagesYour Meta-approved template ID
template_data*Required for template messagesJSON array of recipients — see Simple, Dynamic, Media, and Button templates above
free_formRequired for free-form messagesJSON array for post-reply messages — see Free Form Messages

Response Format

Every request returns a JSON object with a success flag and a results array.

{
  "success": "true",           // "true" or "false"
  "method": "API",
  "message_type": "TEMPLATE",  // TEMPLATE or FREE_FORM
  "total_price": "1",          // messages billed
  "total_gsm": "1",            // recipients processed
  "remaining_credit": "906",   // credit remaining after this request
  "results": [ ... ]
}

Postman Collection

Import our ready-made collection to explore every request without writing code.

Open Postman Collectionhttps://documenter.getpostman.com/view/9576087/2sAXjDdv62

Support

Need help integrating? We're here.

Chat with us on WhatsAppSales & support: 923001654321
OTP TutorialIntegration walkthrough for sending WhatsApp OTPs