Developer Documentation

Riffre API Reference

Everything you need to send WhatsApp text, template, media and interactive messages from your own systems.

Create a Template

Submit a new WhatsApp message template for Meta approval - header, body, footer and buttons, the same as the dashboard template builder.

Last updated 14 Aug 2026

Endpoint

POST /templates-create.php

Requires the Authorization: Bearer header described in Authentication, and the account maintenance fee for this number to be paid (the same requirement as the dashboard template builder).

Request body

FieldTypeRequiredDescription
numberstringyesYour own connected WhatsApp number, digits only.
namestringyesLowercase letters, numbers and underscores only.
categorystringyesMARKETING, UTILITY, or AUTHENTICATION.
languagestringyesMeta template language/locale code, e.g. en_US.
header_typestringnoNONE (default), TEXT, IMAGE, VIDEO, or DOCUMENT.
header_textstringif header_type is TEXTUp to 60 characters, may contain one {{1}} variable.
header_examplestringif header_text has {{1}}Sample value for the header variable.
header_linkstringif header_type is IMAGE/VIDEO/DOCUMENTPublic HTTPS URL of a JPG, PNG, MP4 or PDF sample, up to 16 MB. Riffre downloads it and forwards it to Meta - there is no separate upload step.
bodystringyesUp to 1024 characters, may contain sequential variables {{1}}, {{2}}, ...
body_examplesarray of stringsif body has variablesOne sample value per variable, in order.
footerstringnoUp to 60 characters.
buttonsarraynoUp to 10 buttons - see below.

Buttons

Each button is {"type": "QUICK_REPLY" | "URL" | "PHONE_NUMBER", "text": "..."}, plus url for URL buttons or phone_number for PHONE_NUMBER buttons.

Button text must be plain text, 25 characters or fewer - no variables, line breaks or emoji are allowed in button text, even though the header or body may use them freely. Meta rejects the whole template otherwise (subcode 2388060).

Example request

curl -X POST "https://your-riffre-domain.com/api/v1/templates-create.php" \
  -H "Authorization: Bearer rf_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "911234567890",
    "name": "order_update",
    "category": "UTILITY",
    "language": "en_US",
    "body": "Hi {{1}}, your order {{2}} is ready.",
    "body_examples": ["Asha", "#4471"],
    "buttons": [{"type": "QUICK_REPLY", "text": "Track order"}]
  }'

Success response

200 OK:

{
  "id": "1234567890123456",
  "name": "order_update",
  "language": "en_US",
  "category": "UTILITY",
  "status": "PENDING"
}

Approval is not immediate - poll Get Template Status (status changes arrive by webhook on Riffre's side, so this reflects Meta's decision as soon as it happens).

Errors specific to this endpoint

error slugHTTP statusCause
a_json_request_body_is_required422The request body is missing or not valid JSON.
header_link_must_be_a_valid_https_url_when_header_type_is_image,_video_or_document422header_type is a media type but header_link is missing or not a valid HTTPS URL.

Every other validation rule (name format, body length, button text rules, and so on) also returns 422 with a specific message. See Errors for the full error response shape, and 402 Payment Required if the account maintenance fee for this number is unpaid.