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)
| 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 |
POST when sending a message.
Part 2 — Headers
Authorization— proves who you are. Uses your system-user token or temporary token.Content-Type— tells Meta the body is JSON.
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)
| 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:messages[0].id is the WhatsApp message ID (wamid) — save it if you need to track delivery
status via status webhooks later.
API versioning
Thev21.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.
Frequently asked
What does v21.0 mean in the WhatsApp API URL?
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?
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?
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?
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 glossary.
What happens when a Meta API version is deprecated?
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?
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.
