Sign in

WhatsApp

Read the conversations of your connected WhatsApp numbers, answer them with text, buttons, lists and files, open new ones with a template, manage templates with files and carousels, disconnect a number and send a file from your computer, all from your own code.

The WhatsApp endpoints do from code what the WhatsApp inbox does in the app: read the conversations of a number you connected, answer them and open new ones with a template message. The MCP server has the same calls as tools, so an assistant can run the same flows.

Two things to know before you send anything:

  • The API does not ask for consent. Everything that passes validation is sent, as the message of your business number. The consent field of the MCP tools exists so an assistant asks you first; your code decides for itself.
  • After 24 hours, only templates. A free reply is allowed until 24 hours after the person last wrote. Past that, WhatsApp takes a template message only, and a text answers 422.

What you can do

Method Path What it does
GET /api/v1/whatsapp/numbers Lists your connected numbers.
DELETE /api/v1/whatsapp/numbers/{id} Disconnects a number from the inbox.
GET /api/v1/whatsapp/numbers/{id}/conversations Lists the conversations of a number.
GET /api/v1/whatsapp/conversations/{id}/messages Lists the messages of a conversation.
POST /api/v1/whatsapp/conversations/{id}/read Marks a conversation as read.
POST /api/v1/whatsapp/conversations/{id}/messages Sends a text, buttons, a list or a file.
GET /api/v1/whatsapp/messages/{id}/media Downloads the file of a message.
GET /api/v1/whatsapp/numbers/{id}/templates Lists the templates of a number.
POST /api/v1/whatsapp/numbers/{id}/templates Creates a template and sends it to Meta for review.
PATCH /api/v1/whatsapp/numbers/{id}/templates/{template_id} Changes a template. Meta reviews it again.
DELETE /api/v1/whatsapp/numbers/{id}/templates/{template_id} Deletes one language of a template.
POST /api/v1/whatsapp/numbers/{id}/template-messages Sends a template message to a phone number.
POST /api/v1/uploads Gives a link to send a file from your computer. See Send a file from your computer.

List your numbers

GET /api/v1/whatsapp/numbers returns the numbers connected to your user. They also come in GET /api/v1/accounts, under whatsapp_numbers.

cURL
curl https://linkpost.app/api/v1/whatsapp/numbers \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{
  "data": [
    {
      "id": 3,
      "phone_number": "+34 600 00 00 00",
      "name": "Studio",
      "status": "connected",
      "disconnect_reason": null,
      "coexistence": true,
      "connected_at": "2026-11-02T10:00:00Z"
    }
  ]
}

status is connected or disconnected. When it is disconnected, disconnect_reason says why, such as token_expired, and the number cannot send until you connect it again in the app. With coexistence the number also keeps working in the WhatsApp Business app on the phone.

To connect a number, open in a browser the link that Connect or reconnect an account gives with network=whatsapp, and follow the steps under Connect a number.

List conversations

GET /api/v1/whatsapp/numbers/{id}/conversations returns the conversations of a number, the latest first.

Query What it is
unread 1 for conversations with unread messages only.
phone Only the conversation with this phone number.
limit From 1 to 200. The default is 50.
cURL
curl "https://linkpost.app/api/v1/whatsapp/numbers/3/conversations?unread=1" \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{
  "data": [
    {
      "id": 312,
      "number_id": 3,
      "phone": "+34611111111",
      "name": "Ana",
      "unread": 2,
      "last_message": "Tomorrow at 10",
      "last_message_at": "2026-11-20T09:30:12Z",
      "last_inbound_at": "2026-11-20T09:30:12Z",
      "can_reply": true,
      "window_ends_at": "2026-11-21T09:30:12Z"
    }
  ]
}

can_reply says whether a free reply is still allowed. It stays true until window_ends_at, 24 hours after the person last wrote.

List messages

GET /api/v1/whatsapp/conversations/{id}/messages returns the messages of a conversation, the latest first, with the conversation beside them.

Query What it is
limit From 1 to 200. The default is 50.
before_id Only messages older than this id.
after_id Only messages newer than this id.
cURL
curl "https://linkpost.app/api/v1/whatsapp/conversations/312/messages?after_id=9040" \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{
  "data": [
    {
      "id": 9041,
      "conversation_id": 312,
      "direction": "in",
      "origin": "customer",
      "type": "interactive",
      "text": "Tomorrow at 10",
      "sent_at": "2026-11-20T09:30:12Z",
      "status": "received",
      "delivered": false,
      "error": null,
      "reply": { "id": "slot-10", "title": "Tomorrow at 10" },
      "options": null,
      "attachment": null,
      "unsupported": false
    }
  ],
  "conversation": { "id": 312, "can_reply": true, "window_ends_at": "2026-11-21T09:30:12Z" }
}

To wait for an answer, ask again with after_id set to the last id you saw, at most once a minute. Reading does not mark the conversation as read: do that with the next call.

Message fields

Field What it is
direction in for what the person sent, out for what your business sent.
origin Who wrote it: customer (the person), api (this API or the MCP server), linkpost (someone in the inbox of the app) or phone (the WhatsApp Business app on the phone).
type What the message is: text, image, video, audio, document, interactive (buttons or a list) or template, and for what a person sends, other kinds WhatsApp has, such as sticker or location.
status received for what the person sent. For what your business sent: pending, sent, delivered, read or failed.
delivered true once the message was delivered or read.
error Why WhatsApp refused a failed message.
reply The button or list option the person tapped: { "id", "title" }. The id is the one you sent with the option.
options What a message with buttons or a list offered: { "kind", "button", "items" }. kind is buttons or list, button is the text that opens a list (null for buttons), and items is a list of { "id", "title" }, with description for a list.
attachment A file: { "mime_type", "filename", "download_path" }. null when there is none.
unsupported true for a message WhatsApp announced but did not hand over, such as a poll or a view-once photo. Ask the person to send it another way.

Mark a conversation as read

POST /api/v1/whatsapp/conversations/{id}/read sets its unread count to zero in Linkpost. The person sees no read receipt. The answer is the conversation.

cURL
curl -X POST https://linkpost.app/api/v1/whatsapp/conversations/312/read \
  -H "Authorization: Bearer $LINKPOST_KEY"

Send a message

POST /api/v1/whatsapp/conversations/{id}/messages answers a conversation while can_reply is true. A message is one of these:

  • a text, up to 4096 characters;
  • a text with buttons: 1 to 3, with titles up to 20 characters;
  • a text with a list: up to 10 options, with titles up to 24 characters and descriptions up to 72;
  • a file, with the text as its caption.
Field What it is
text The message. Up to 1024 characters with buttons, a list or a file.
buttons 1 to 3 of { "id", "title" }.
list { "button": "Choose a time", "options": [{ "id", "title", "description" }] }.
footer A small line under buttons or a list, up to 60 characters.
file, upload_id or media_url The file, one of the three. See Send a file.

Buttons, a list and a file do not mix: one of them per message. Give each button and option an id of your own, up to 200 characters. It comes back in reply.id when the person taps it.

cURL
curl https://linkpost.app/api/v1/whatsapp/conversations/312/messages \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "When shall we come?",
    "buttons": [
      { "id": "slot-10", "title": "Tomorrow at 10" },
      { "id": "slot-16", "title": "Tomorrow at 16" }
    ]
  }'
JSON
{
  "data": {
    "id": 9042,
    "conversation_id": 312,
    "direction": "out",
    "origin": "api",
    "type": "interactive",
    "text": "When shall we come?",
    "sent_at": "2026-11-20T09:31:00Z",
    "status": "sent",
    "delivered": false,
    "error": null,
    "reply": null,
    "options": {
      "kind": "buttons",
      "button": null,
      "items": [
        { "id": "slot-10", "title": "Tomorrow at 10" },
        { "id": "slot-16", "title": "Tomorrow at 16" }
      ]
    },
    "attachment": null,
    "unsupported": false
  }
}

The answer is 201 Created. When WhatsApp refuses the message, the answer is 422 with its reason in message, and the message stays in the conversation as failed:

JSON
{
  "message": "WhatsApp did not accept the message: The person cannot receive this message.",
  "data": { "id": 9042, "status": "failed", "error": "The person cannot receive this message." }
}

Send a file

A file goes with one of three fields. Send only one of them.

  • file, as multipart/form-data, with the text as the text field:

    cURL
    curl https://linkpost.app/api/v1/whatsapp/conversations/312/messages \
      -H "Authorization: Bearer $LINKPOST_KEY" \
      -F text="Here is the budget" \
      -F file=@Budget.pdf
    
  • upload_id, the id of a file you sent to a link. See Send a file from your computer.

  • media_url, a public https link that Linkpost downloads.

WhatsApp takes these files:

Kind Types Up to
Image JPEG, PNG 5 MB
Video MP4 16 MB
Audio MP3, M4A, AAC, OGG, AMR 16 MB
Document PDF, Word, Excel, PowerPoint, plain text 100 MB

A file of another type, or over its limit, answers 422 with the reason in errors.file.

Send a file from your computer

For a file on your computer, ask for a link, send the bytes to it, and name its id in the message, or in a template's header_file or cards. The same flow serves posts and the MCP server's create_upload.

POST /api/v1/uploads takes optional fields. Set for to whatsapp so the link checks the file against the limits above.

Field What it is
for whatsapp, to check the file against WhatsApp's types and sizes.
filename The name the file keeps. A document shows it to the person, such as Budget.pdf.
content_type and size What you are about to send, in bytes. They are checked now, so a wrong file fails before you send it.
cURL
curl https://linkpost.app/api/v1/uploads \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "for": "whatsapp", "filename": "Budget.pdf", "content_type": "application/pdf", "size": 182344 }'
JSON
{
  "data": {
    "id": "01m7q4c9w2e8r5t6y3u1i0o9pa",
    "upload_url": "https://linkpost.app/api/v1/uploads/01m7q4c9w2e8r5t6y3u1i0o9pa?expires=1795000000&signature=5f0c…",
    "method": "PUT",
    "headers": { "Content-Type": "application/pdf" },
    "link_expires_at": "2026-11-20T10:30:00Z",
    "expires_at": "2026-11-21T09:30:00Z",
    "max_size_mb": 512
  }
}

The id is a string of 26 letters and digits.

2. Send the bytes

PUT the file to upload_url. The link is its own credential: send no key. Quote the URL, because it has an &. You can also POST a form with the file in a field named file.

cURL
curl -T Budget.pdf -H "Content-Type: application/pdf" "https://linkpost.app/api/v1/uploads/01m7q4c9w2e8r5t6y3u1i0o9pa?expires=1795000000&signature=5f0c…"
JSON
{
  "upload_id": "01m7q4c9w2e8r5t6y3u1i0o9pa",
  "name": "Budget.pdf",
  "mime": "application/pdf",
  "size": 182344,
  "expires_at": "2026-11-21T09:30:00Z"
}

With for set to whatsapp, the link checks the file itself when it arrives and refuses what WhatsApp would not take, with 422 and the reason in message. A refused file leaves the link open for a right one.

3. Send the message

cURL
curl https://linkpost.app/api/v1/whatsapp/conversations/312/messages \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Here is the budget", "upload_id": "01m7q4c9w2e8r5t6y3u1i0o9pa" }'
  • The link works for 60 minutes. The upload stays for 24 hours and can go in several messages.
  • You can have up to 50 uploads at a time, and 5 GB in all. A link that would go over answers 429 when you ask for it.
  • An upload_id that does not exist, expired, or has no file yet answers 422 with the field upload_id.

The link answers with these statuses:

Status What it means
201 The file arrived.
403 The link was changed, or its 60 minutes are over. Ask for a new one.
409 Each link takes one file.
410 The upload is over 24 hours old.
413 The file is larger than the link takes (512 MB), or with it your uploads would go over 5 GB.
415 The file is not one Linkpost takes.
422 The file is not one WhatsApp takes, or is over its limit, or the POST had no file.

Download a file

GET /api/v1/whatsapp/messages/{id}/media returns the file of a message with an attachment: a photo, a document or a voice note. The answer is the file itself, with its Content-Type. WhatsApp keeps received files for a limited time, and the answer is 404 once it is gone.

cURL
curl -o voice.ogg https://linkpost.app/api/v1/whatsapp/messages/9044/media \
  -H "Authorization: Bearer $LINKPOST_KEY"

List templates

GET /api/v1/whatsapp/numbers/{id}/templates returns the message templates of the number's WhatsApp account, as Meta has them now.

cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/templates \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{
  "data": [
    {
      "id": "555",
      "name": "order_ready",
      "language": "es",
      "category": "UTILITY",
      "status": "APPROVED",
      "rejected_reason": null,
      "text": "Hola {{1}}, tu pedido {{2}} ya está listo.",
      "parts": ["2 buttons"],
      "parameters": { "header": ["1"], "body": ["1", "2"] },
      "sendable": true
    }
  ]
}

status is APPROVED (can be sent), PENDING (in review) or REJECTED (with the reason in rejected_reason). sendable says whether the API can send it now: an approved template that Linkpost can fill in, with a file in the header and carousels included.

parameters lists what a template message has to fill in, for every template Linkpost can fill in. Lists that would be empty are left out.

Key What it is
header, body The variables of the header and of the text, in order or by name.
buttons The buttons that take a value, with their index, type and label.
code true for a one-time code template.
header_file IMAGE, VIDEO or DOCUMENT when the header carries a file.
cards For a carousel: each card, in order, with its file (IMAGE or VIDEO), its body variables and its buttons.

A carousel of two cards, for example:

JSON
{ "body": ["1"], "cards": [ { "file": "IMAGE", "body": ["1"], "buttons": [] }, { "file": "IMAGE", "body": ["1"], "buttons": [] } ] }

Create a template

POST /api/v1/whatsapp/numbers/{id}/templates sends a new template to Meta for review, which usually takes minutes. The answer is 201, with status PENDING.

Field What it is
name Lowercase letters, numbers and underscores.
language es, en_US, pt_BR…
category UTILITY, MARKETING or AUTHENTICATION.
body and samples The text, with {{1}}, {{2}} where values change, and an example for each variable, in order.
header and header_sample Optional. A text header up to 60 characters, with at most one variable, and its example.
footer Optional. Up to 60 characters.
buttons Optional. { "type": "QUICK_REPLY", "text" }, { "type": "URL", "text", "value", "sample" }, { "type": "PHONE_NUMBER", "text", "value" } or { "type": "COPY_CODE", "sample" }.
cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/templates \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_ready",
    "language": "es",
    "category": "UTILITY",
    "body": "Hola {{1}}, tu pedido {{2}} ya está listo.",
    "samples": ["Ana", "A-102"],
    "buttons": [{ "type": "QUICK_REPLY", "text": "Gracias" }]
  }'
JSON
{ "data": { "id": "555", "name": "order_ready", "language": "es", "category": "UTILITY", "status": "PENDING" } }

With AUTHENTICATION, Meta writes the text of a one-time code template: send security, expires and code_button instead of body.

A header with a file

Send header_type (IMAGE, VIDEO or DOCUMENT) and, in header_file, an example file for Meta's review: { "media_url": "https://…" } for a public link, or { "upload_id": "…" } for a file you sent first (see Send a file from your computer). Linkpost sends the example to Meta before the template.

cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/templates \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "photo_offer",
    "language": "es",
    "category": "MARKETING",
    "header_type": "IMAGE",
    "header_file": { "media_url": "https://cdn.example.com/offer.jpg" },
    "body": "Hola {{1}}, mira lo que acaba de llegar.",
    "samples": ["Ana"]
  }'

Send "format": "carousel", a body above the cards, and:

Field What it is
card_media IMAGE or VIDEO: what every card carries.
card_buttons The types of the buttons, 1 or 2, the same on every card: QUICK_REPLY, URL or PHONE_NUMBER.
cards 2 to 10 cards, in order. Each has its file (media_url or upload_id), an optional body of up to 160 characters with its samples, and buttons: { "text", "value", "sample" } in the order of card_buttons.
cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/templates \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "spring_offers",
    "language": "es",
    "category": "MARKETING",
    "format": "carousel",
    "body": "Novedades para {{1}}",
    "samples": ["Ana"],
    "card_media": "IMAGE",
    "card_buttons": ["QUICK_REPLY"],
    "cards": [
      { "media_url": "https://cdn.example.com/mesa.jpg", "body": "Mesa por {{1}}", "samples": ["29 €"], "buttons": [{ "text": "La quiero" }] },
      { "media_url": "https://cdn.example.com/silla.jpg", "body": "Silla por {{1}}", "samples": ["12 €"], "buttons": [{ "text": "La quiero" }] }
    ]
  }'

A carousel card without its file answers 422.

Send a template message

POST /api/v1/whatsapp/numbers/{id}/template-messages sends an approved template to a phone number. It is the way to write first, and the only way once the 24 hours of a conversation are over. It opens the conversation when there is none, and answers with the message and the conversation. WhatsApp charges the business for each template message.

Field What it is
to The phone number, with its country code.
name Optional. The person's name, for the conversation in Linkpost.
template and language As List templates gives them.
parameters What the template leaves open: { "header": [], "body": [], "buttons": [], "code": "" }. A list follows the order of the variables; an object goes by variable name.
parameters.header_file For a header with a file: { "media_url" } or { "upload_id" }. A JPEG or PNG image up to 5 MB, an MP4 video up to 16 MB or a PDF or other document up to 100 MB, as the template asks.
parameters.cards For a carousel: one entry per card, in order, each with its file (media_url or upload_id) and its own body and buttons values.
cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/template-messages \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+34611111111",
    "name": "Ana",
    "template": "order_ready",
    "language": "es",
    "parameters": { "header": ["A-102"], "body": ["Ana", "A-102"] }
  }'
JSON
{
  "data": { "id": 9043, "direction": "out", "origin": "api", "type": "template", "status": "sent" },
  "conversation": { "id": 312, "phone": "+34611111111", "can_reply": false }
}

A carousel takes one entry in cards per card of the template, in order, each with its file:

cURL
curl https://linkpost.app/api/v1/whatsapp/numbers/3/template-messages \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+34622222222",
    "template": "spring_offers",
    "language": "es",
    "parameters": {
      "body": ["Ana"],
      "cards": [
        { "upload_id": "01m7q4c9w2e8r5t6y3u1i0o9pa", "body": ["29 €"] },
        { "media_url": "https://cdn.example.com/silla.jpg", "body": ["12 €"] }
      ]
    }
  }'

Linkpost sends each file to WhatsApp before the message. A carousel with a different number of cards answers 422 under parameters.cards, such as This carousel has 2 cards: send one entry in cards for each, in order, with its file., and a card without its file answers 422 too.

Change a template

PATCH /api/v1/whatsapp/numbers/{id}/templates/{template_id} changes a template, with the id that List templates gives. Only the fields you send change. The rest stays as Meta has it, files included. Meta reviews the changes before they are used.

  • body and samples, footer and buttons take the shape of Create a template. buttons replaces the buttons whole.
  • A header sent replaces the header with text, and an empty one removes it. header_type with header_file puts in a new file.
  • For a carousel, cards replaces the cards in order. A card without media_url or upload_id keeps its file.
  • category changes only while Meta has not approved the template, and never to or from AUTHENTICATION.
  • A template in review cannot be changed.
cURL
curl -X PATCH https://linkpost.app/api/v1/whatsapp/numbers/3/templates/555 \
  -H "Authorization: Bearer $LINKPOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "body": "Hola {{1}}, ya puedes recoger el pedido {{2}}.", "samples": ["Ana", "A-7"] }'

The answer is the template as Meta has it now, usually with "status": "PENDING". When Meta refuses the change, the answer is 422 with its reason under template.

Delete a template

DELETE /api/v1/whatsapp/numbers/{id}/templates/{template_id} deletes one language of a template at Meta. Messages already sent stay. It cannot be undone.

cURL
curl -X DELETE https://linkpost.app/api/v1/whatsapp/numbers/3/templates/555 \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{ "data": { "id": "555", "name": "order_ready", "language": "es", "deleted": true } }

You can change or delete up to 20 templates a minute.

Disconnect a number

DELETE /api/v1/whatsapp/numbers/{id} disconnects a number from the inbox, as the inbox does in the app. Linkpost stops receiving its messages and deletes its conversations. The number keeps working in WhatsApp and in the WhatsApp Business app.

cURL
curl -X DELETE https://linkpost.app/api/v1/whatsapp/numbers/3 \
  -H "Authorization: Bearer $LINKPOST_KEY"
JSON
{ "data": { "id": 3, "phone": "+34 600 00 00 00", "disconnected": true } }

It cannot be undone: the conversations are gone from Linkpost. To connect the number again, see List your numbers. You can disconnect up to 10 numbers a minute.

Errors

Errors come as on the rest of the API. See Errors.

Status When
404 The account has no WhatsApp inbox, or the number, conversation or message is not yours.
422 A field is wrong, the conversation is past its 24 hours, the number is disconnected, or WhatsApp refused the message.
503 Something failed on the Linkpost side. The reference in the answer identifies it for support.