Request Anatomy & API Versioning
The four parts of every WhatsApp Cloud API HTTP request — endpoint, headers, body, and response — and how Meta's API versioning (v21.0, v24.0, etc.) works.
On this page
Every WhatsApp Cloud API call is an HTTP POST request with four parts: an endpoint URL,
authorization headers, a JSON body, and a JSON response. Understanding these four parts is
the foundation for reading any API example or debugging any failure.
Part 1 — Endpoint (the URL)#
POST https://graph.facebook.com/v21.0/1158939770629471/messages| Segment | Example | Meaning |
|---|---|---|
| Base URL | graph.facebook.com | Meta's Graph API server — all Meta APIs live here |
| Version | v21.0 | The API version in use |
| Phone Number ID | 1158939770629471 | Which WhatsApp number sends the message |
| Action | messages | What to do — post a new message |
The HTTP method is always POST when sending a message.
Part 2 — Headers#
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/jsonAuthorization— proves who you are. Uses your system-user token or temporary token.Content-Type— tells Meta the body is JSON.
Both are required on every request. Missing Authorization returns a 401 error. Think of
headers like showing your ID card at a building entrance before the guard lets you in.
Part 3 — Body (JSON)#
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "919876543210",
"type": "text",
"text": {
"body": "Hello!"
}
}| Field | Required | Meaning |
|---|---|---|
messaging_product | yes | Always "whatsapp" |
recipient_type | no | Almost always "individual" |
to | yes | Recipient phone number, digits only, with country code, no + |
type | yes | Message type: text, image, template, etc. |
| type-specific fields | yes | e.g. text.body for text, template.name for templates |
Part 4 — Response#
On success, Meta returns HTTP 200 with:
{
"messaging_product": "whatsapp",
"contacts": [{ "input": "919876543210", "wa_id": "919876543210" }],
"messages": [{ "id": "wamid.HBgM..." }]
}messages[0].id is the WhatsApp message ID (wamid) — save it if you need to track delivery
status via status webhooks later.
API versioning#
The v21.0 in the URL is the API version. Meta releases new versions several times a year.
- Each version is supported for approximately 2 years after release.
- When a version is deprecated, API calls using it stop working and return an error.
- Upgrading is one line of code: change
v21.0to the new version in your base URL. - Check the current versions at
developers.facebook.com/docs/graph-api/changelog.
Think of it like Android versions — new releases bring new features, and old ones eventually stop receiving support.
Frequently asked#
What does v21.0 mean in the WhatsApp API URL?
It is the API version. Meta releases new versions regularly and deprecates old ones after about 2 years. If you use a deprecated version your calls will stop working — keep your code on a supported version.
What headers do I need to call the WhatsApp API?
Two headers are required: Authorization: Bearer YOUR_TOKEN (your access token) and
Content-Type: application/json (tells Meta the body is JSON).
What is the messaging_product field in the request body?
Always "whatsapp". Meta's Graph API serves multiple products, so this field tells it
which product the request belongs to.
What is the Phone Number ID in the URL?
A unique ID Meta assigns to each registered WhatsApp number. It goes in the URL to say which number should send the message. Find it in the Meta developer dashboard → API Setup. See the WhatsApp API glossary.
What happens when a Meta API version is deprecated?
Your API calls fail with an error. Update the version number in your URL (one line change) to a currently supported version.
Do I put a + before the phone number in the to field?
No. The to field must be digits only with the country code, no + or spaces. For
example: 919959623255 not +91 99596 23255.
Gotchas & common mistakes#
Was this page helpful?
Still stuck? Open a support ticket and our team will help.