API reference
Messages
Upload media
post
Uploads a file to send by id on a WhatsApp media message.
multipart/form-data with the file in file. A JPEG or PNG image (≤ 5 MB), an MP4 or 3GP video, AAC/AMR/MP3/M4A/OGG audio, or a PDF, Word, Excel, PowerPoint or text document (≤ 16 MB), whose bytes must be what its type says. Kept 7 days (expiresAt); each send copies it, so what was sent outlives it. Not for SMS: no SMS vendor on this platform carries MMS.
Access: an organization key with the messages:write scope.
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Request bodymultipart/form-data
filestring (binary)RequiredfileNamestringat most 240 characters
Response 201PublicMediaUpload
Its fields are listed under Get media.
Errors
400VALIDATION_FAILED — a type WhatsApp does not deliver, or bytes that are not what the type says.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.409IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.413The file is larger than its type (or this deployment) allows.422IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).503MEDIA_NOT_ENABLED — this deployment keeps no media.
curl -X POST 'https://api.trovacast.com/v1/media' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"createdAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"fileName": "FILE_NAME",
"id": "ID",
"kind": "document",
"livemode": true,
"mimeType": "application/pdf",
"object": "media",
"sizeBytes": 48213
}Get media
get
Retrieves an upload (never its bytes).
Its kind, type, size, file name and expiresAt — the id stays sendable as media.id until then. An upload past expiresAt, or one made with the other mode’s keys, answers 404 MEDIA_NOT_FOUND.
Access: an organization key with the messages:write scope.
Path parameters
mediaIdstringRequired
Response 200PublicMediaUpload
Show the 9 fieldsHide the fields
createdAtstring (date-time)RequiredexpiresAtstring (date-time)RequiredSend it before this (7 days after the upload); it is deleted after. What you sent stays.
fileNamestring | nullRequiredAs uploaded, phone-shaped runs masked.
idstring (uuid)RequiredSend it with
media.idon a WhatsApptype: "media"message (POST /v1/messages).kindstringRequiredOne of
imagevideoaudiodocumentlivemodebooleanRequiredFalse for a test-mode (
tc_test_…) key’s upload: only that mode’s sends see it.mimeTypestringRequiredobjectstringRequiredOne of
mediasizeBytesintegerRequired
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404MEDIA_NOT_FOUND — no such upload, or it expired.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
curl 'https://api.trovacast.com/v1/media/MEDIA_ID' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"createdAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"fileName": "FILE_NAME",
"id": "ID",
"kind": "document",
"livemode": true,
"mimeType": "application/pdf",
"object": "media",
"sizeBytes": 48213
}Delete media
delete
Deletes an upload now (what was sent with it stays).
Deletes the stored file and the upload without waiting for expiresAt; each message sent with it kept its own copy. Audited against the key (media.deleted). An upload already expired, or made with the other mode’s keys, answers 404 MEDIA_NOT_FOUND.
Access: an organization key with the messages:write scope.
Path parameters
mediaIdstringRequired
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Response 200DeletedPublicMedia
deletedbooleanRequiredOne of
trueidstring (uuid)RequiredobjectstringRequiredOne of
media
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404MEDIA_NOT_FOUND — no such upload, or it expired.409IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).
curl -X DELETE 'https://api.trovacast.com/v1/media/MEDIA_ID' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"deleted": true,
"id": "ID",
"object": "media"
}List messages
get
Lists messages newest first, or — with updatedAfter — every change since, oldest first.
Filter by channel, contactId, conversationId, direction, status and up to 5 metadata key:value pairs. With updatedAfter it is the reconciliation read for missed webhooks: every message changed at or after that instant, oldest change first by (updatedAt, id), served once a change is two minutes old so a later commit is never stepped past — resume from the largest updatedAt you saw. A key lists the messages of its own mode only (a test key, its test messages).
Access: an organization key with the messages:read scope.
Query parameters
limitintegerHow many items to return.
cursorstringThe
nextCursorof the previous page. Omit for the first page.channelstringOne of
whatsappemailsmscontactIdstring (uuid)conversationIdstring (uuid)directionstringOne of
inboundoutboundstatusstringOne of
queuedsendingsentdeliveredreadfailedreceivedupdatedAfterstring (date-time)Reconciliation: messages whose
updatedAtis at or after this instant, OLDEST change first (byupdatedAt, thenid). Changes from the last 2 minutes are held back until no earlier-stamped change can still commit, so nothing before the last one served is ever skipped. Page withnextCursor; when it is null, resume later from the lastupdatedAtyou saw and dedupe byid+updatedAt(every change — a late pricing update included — movesupdatedAt).metadatastring[]Messages whose
metadataholds this key with exactly this value, writtenkey:value(the first:splits; values may contain more). Repeat the parameter for up to 5 pairs — every one must match. Combines with every other filter and withupdatedAfter. Indexed, so it is as cheap as the plain list.
Response 200PublicMessagePage
dataPublicMessage[]RequiredIts fields are listed under Get message
nextCursorstring | nullRequiredPass back as
cursorfor the next page; null on the last.
Errors
400VALIDATION_FAILED — a malformed filter, ametadatapair that is notkey:value(or more than 5), or a cursor of the other kind (a newest-first cursor withupdatedAfter, or the reverse).401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
curl 'https://api.trovacast.com/v1/messages?contactId=CONTACT_ID&limit=50' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"data": [
{
"button": {
"payload": "COD_CONFIRM:1001",
"text": "TEXT"
},
"channel": "whatsapp",
"charge": {
"amountMinor": 25,
"category": "utility",
"currency": "INR",
"ratePerUnitMinor": 25,
"ratedAt": "2026-11-05T10:00:00.000Z",
"status": "charged",
"units": 1
},
"contactId": "CONTACT_ID",
"contacts": [
{
"emails": [
{
"email": "riya@example.com",
"type": "WORK"
}
],
"name": "Riya Sharma",
"organization": "Acme Pvt Ltd",
"phones": [
{
"phone": "+91 98765 43210",
"type": "CELL"
}
]
}
],
"context": {
"messageId": "MESSAGE_ID",
"providerMessageId": "PROVIDER_MESSAGE_ID"
},
"conversationId": "CONVERSATION_ID",
"createdAt": "2026-11-05T10:00:00.000Z",
"deliveredAt": "2026-11-05T10:00:00.000Z",
"direction": "inbound",
"email": {
"attachments": [
{
"contentType": "application/pdf",
"filename": "invoice-1001.pdf",
"size": 1
}
],
"bcc": [
"BCC"
],
"cc": [
"a•••@acme-customer.com"
],
"from": "orders@mail.acme.com",
"subject": "Your order #1001 is confirmed",
"to": "a•••@example.com",
"tracking": {
"clicks": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
},
"opens": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
}
}
},
"failedAt": "2026-11-05T10:00:00.000Z",
"failure": {
"code": "META_131026",
"reason": "REASON"
},
"id": "ID",
"livemode": true,
"location": {
"address": "12 MG Road, Bengaluru",
"latitude": 12.9716,
"longitude": 77.5946,
"name": "Acme Store",
"url": "URL"
},
"media": {
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
},
"mediaItems": [
{
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
}
],
"metadata": {},
"object": "message",
"order": {
"catalogId": "CATALOG_ID",
"items": [
{
"currency": "INR",
"itemPrice": 499,
"productRetailerId": "SKU-1001",
"quantity": 2
}
],
"text": "TEXT"
},
"pricing": {
"billable": true,
"category": "utility",
"model": "MODEL",
"type": "TYPE"
},
"providerMessageId": "PROVIDER_MESSAGE_ID",
"reaction": {
"emoji": "👍"
},
"readAt": "2026-11-05T10:00:00.000Z",
"scheduledAt": "2026-11-05T10:00:00.000Z",
"sentAt": "2026-11-05T10:00:00.000Z",
"sms": {
"country": "IN",
"encoding": "gsm7",
"expiresAt": "2026-11-05T10:00:00.000Z",
"header": "ACMEIN",
"keyword": "stop",
"price": {
"amount": "0.002780",
"currency": "USD"
},
"segments": 1,
"sendAfter": "2026-11-05T10:00:00.000Z"
},
"status": "queued",
"template": {
"id": "ID",
"language": "en",
"name": "order_confirmation"
},
"text": "TEXT",
"type": "template",
"updatedAt": "2026-11-05T10:00:00.000Z",
"warnings": [
{
"code": "WHATSAPP_NOT_CONNECTED",
"message": "MESSAGE"
}
]
}
],
"nextCursor": "NEXT_CURSOR"
}Create message
post
Sends a message: a WhatsApp template, text, media file or interactive message (or an email or SMS).
Every send rule is checked first, then the message is answered 202 as queued (or waiting for its sendAt); what happens next arrives as message.sent, message.delivered, message.read or message.failed — as events, to a per-request statusCallback, or by GET /v1/messages/{messageId}. channel defaults to whatsapp; a send by to.phone or to.email finds or creates the contact and also needs contacts:write. Send an Idempotency-Key on any attempt you might retry: the retry answers the message the first attempt queued instead of sending another. The main refusals are consent (409 CONSENT_REQUIRED, CONSENT_OPTED_OUT), a channel not set up (409 CHANNEL_NOT_CONFIGURED) and the wallet (402 BILLING_INSUFFICIENT_CREDIT); a test key’s send goes to the sandbox and lists in warnings what a live send would have been refused for.
Access: an organization key with the messages:write scope.
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. This endpoint converges when run again, so a 5xx stores nothing either: a retry with the same key runs it again. 1–255 visible ASCII characters; kept for 24 hours.
Request body
channelstringThe channel to send on. Omitted means
whatsapp, so requests written before email and SMS existed keep their meaning.One of
whatsappemailsmsdefault "whatsapp"
contactIdstring (uuid)contactsPublicSendContact[]type: "contacts"(WhatsApp, inside the 24-hour window): 1–20 contact cards, a name each. Someone’s personal data: stored encrypted like message text. Echoed as the message’scontacts.at most 20 items
4 fields of
contactsemailsPublicSendContactEmail[]at most 10 items
2 fields of
emailsemailstringRequiredat most 320 characters
typestringat most 32 characters
namestringRequiredThe name the card shows (required).
at most 256 characters
organizationstringat most 256 characters
phonesPublicSendContactPhone[]at most 10 items
2 fields of
phonesphonestringRequiredat most 64 characters
typestringat most 32 characters
conversationIdstring (uuid)WhatsApp: send on this conversation — to its contact, from the number the conversation is on. The way to answer a customer who wrote to a number that is not the default. Instead of
contactId/to.emailPublicEmailContent9 fields of
emailattachmentsPublicEmailAttachment[]Files, base64 (at most 10, 7 MB in all). Stored encrypted only until the email is sent or fails, then deleted; never served back.
at most 10 items
3 fields of
attachmentscontentstring (byte)RequiredThe file, standard base64. All of a message’s attachments are at most 7 MB decoded.
contentTypestringThe MIME type; inferred from the extension when absent. One of application/pdf, image/png, image/jpeg, image/gif, image/webp, text/plain, text/csv, text/calendar and the OOXML Office types (.docx, .xlsx, .pptx). The content must really be that type.
at most 127 characters
filenamestringRequiredThe file name the recipient sees. Reduced to a plain name (no path, no control or quoting characters, ≤ 120 characters); its extension must belong to the type.
at most 255 characters
bccstring[]Blind copies (transactional only), under the same rules as
cc; never shown to the other recipients.at most 20 items
categorystringtransactional(a receipt, a shipping update — something the customer expects) ormarketing. Required fortype: "text"; a template’s defaults from its category (a MARKETING template is always marketing). Marketing needsmarketing: opted_inemail consent and always carries the unsubscribe footer; transactional is refused only by an opt-out or the suppression list, and carries the List-Unsubscribe headers.One of
transactionalmarketingccstring[]Visible copies (transactional only). Each must not be suppressed or belong to a contact who opted out of email (409 otherwise); with
bcc, at most 20 and none repeated or the recipient itself.at most 20 items
fromstringSend from this address instead of the account’s default. With Amazon SES it must be under one of the organization’s verified sending domains; with an SMTP account it must be the account’s own from address (
409 FROM_NOT_ALLOWEDotherwise). Not withsenderId.at most 320 characters
fromNamestringThe display name with
email.from. Defaults to the account’s.at most 120 characters
htmlstringAn HTML body for
type: "text". Sanitized before sending; a plain-text part is derived from it whentextis absent.at most 262144 characters
replyTostringWhere replies go. Defaults to the from address.
at most 320 characters
subjectstringRequired for
type: "text"; overrides the template’s subject fortype: "template". One line: no CR or LF.at most 998 characters
interactivePublicInteractive9 fields of
interactiveactionPublicInteractiveCtatype: "cta_url": the button and the link it opens.2 fields of
actiondisplayTextstringRequiredThe button’s label.
at most 20 characters
urlstringRequiredThe https link it opens (no credentials). Nothing comes back when the customer taps it.
at most 2000 characters
bodystringRequiredat most 1024 characters
buttonstringtype: "list": the label of the button that opens the list.at most 20 characters
buttonsPublicInteractiveButton[]type: "button": the reply buttons, 1–3.2 fields of
buttonsidstringRequiredEchoed back as
button.payloadon the inbound message when the customer taps it. Unique within the message.at most 256 characters
titlestringRequiredat most 20 characters
flowPublicInteractiveFlowtype: "flow": the Flow the button opens.7 fields of
flowactionstringnavigateopensscreenwithdata;data_exchangeasks the Flow’s own endpoint for its first screen.One of
navigatedata_exchangedefault "navigate"
ctastringRequiredThe button that opens it.
at most 20 characters
dataobjectnavigate: the first screen’s initial data (at most 4096 characters as JSON). Customer data goes nowhere but the Flow.idstringRequiredThe Flow’s id in your WhatsApp Business account (WhatsApp Manager → Flows).
modestringdraftsends an unpublished Flow, for testing.One of
draftpublisheddefault "published"
screenstringThe first screen’s id. Required for
navigate.at most 100 characters
tokenstringYour correlation token, echoed back with the customer’s answers (and to a data_exchange Flow’s endpoint).
at most 200 characters
footerstringat most 60 characters
headerstringA text header (one line).
at most 60 characters
sectionsPublicInteractiveSection[]type: "list": 1–10 sections, at most 10 rows in all.2 fields of
sectionsrowsPublicInteractiveRow[]Required3 fields of
rowsdescriptionstringat most 72 characters
idstringRequiredEchoed back as
button.payloadwhen the customer picks the row. Unique within the message.at most 200 characters
titlestringRequiredat most 24 characters
titlestringRequired when the list has more than one section.
at most 24 characters
typestringRequiredOne of
buttonlistcta_urlflow
locationPublicSendLocationtype: "location"(WhatsApp, inside the 24-hour window): a place on the map. Echoed as the message’slocation.4 fields of
locationaddressstringat most 512 characters
latitudenumberRequired-90–90
longitudenumberRequired-180–180
namestringat most 256 characters
mediaPublicMessageMedia4 fields of
mediacaptionstringShown under an image, video or document. Audio has none.
at most 1024 characters
fileNamestringA document’s name as the customer sees it. Defaults to the link’s last path segment.
at most 240 characters
idstring (uuid)A file you uploaded with
POST /v1/media(in the key’s mode, not expired). Orurl, not both. Its name is the document’s unlessfileNameoverrides it.urlstringAn https link to the file on a public host. Fetched once, when the message is accepted (no redirects followed, 20 s to answer), checked and stored; WhatsApp is sent our copy. A JPEG or PNG image (≤ 5 MB), an MP4 or 3GP video, AAC/AMR/MP3/M4A/OGG audio (≤ 16 MB) or a PDF, Word, Excel, PowerPoint or text document (≤ 16 MB here), served with its real Content-Type. Or
id, not both.at most 2048 characters
metadataRecord<string, string>Your identifiers, echoed on the message and its webhooks. At most 20 keys (1–40 of
A-Za-z0-9_.-), values ≤ 500 characters. Never put personal data here: it is stored unencrypted.quickRepliesPublicQuickReplyPayload[]2 fields of
quickRepliesindexintegerRequiredThe button’s position among the template’s buttons (0-based), as Meta numbers them.
0–9
payloadstringRequiredEchoed back on the inbound
message.received(button.payload) when the customer taps it.at most 256 characters
reactionPublicReactiontype: "reaction"(WhatsApp): the emoji and the message it goes on. The message reacted to is echoed ascontext.2 fields of
reactionemojistringRequiredExactly one emoji (skin tones, flags and ZWJ sequences count as one).
at most 64 characters
messageIdstring (uuid)RequiredOur id of the message to react to: one the customer sent, or one of ours already sent, in the same conversation, at most 30 days old, and not itself a reaction. Also names the conversation when the send gives no recipient.
replyToMessageIdstring (uuid)WhatsApp
text,mediaorinteractive: our id of a message in the same conversation that this one quotes (an inbound message, or one already sent). Echoed ascontexton the message.sendAtstring (date-time)Schedule it: at least a minute and at most 30 days ahead (an email with attachments at most 6 days, as long as its files are kept). It is created
queuedwithscheduledAt, every send rule is checked now — and consent, billing and (WhatsApp free-form) the 24-hour window again when it goes;message.sentfollows then. Cancel it withDELETE /v1/messages/{id}while it waits. Not withsms.validitySeconds.senderIdstring (uuid)Which of the organization’s WhatsApp numbers to send from: a
senderIdfromGET /v1/whatsapp/account(numbers[].senderId) or from a conversation. Defaults to the default number — or, withconversationId, to the conversation’s own number. Email: an email sender the organization registered in the console, held to the same rule asemail.from. SMS: a DLT header’sidfromGET /v1/sms/senders(it must be active and fit the template’s category); defaults to the default header when it fits, else the oldest active one that does.smsPublicCreateMessageSms3 fields of
smscategorystringFree text (
type: "text", outside India only) — required there, refused on a template (whose category is its own): what the text is, in the template categories’ words.promotionalneeds the contact’s SMS opt-in and gets the destination’s opt-out line when the text has no “STOP”;service_explicitneeds SMS consent;service_implicitandtransactional(one-time codes) are refused only by an opt-out — and atransactionaltext must carry its code (4 to 10 digits), else400. Also the price: promotional is priced as marketing, transactional as authentication, service as utility.One of
transactionalservice_implicitservice_explicitpromotionaldeferUntilWindowbooleanPromotional SMS only (a template of DLT category PROMOTIONAL): outside the permitted hours, hold the message until the window next opens (at most 24 hours ahead) instead of refusing it with SMS_OUTSIDE_SEND_WINDOW. It is created
queuedwithsms.sendAfter, andmessage.sentfollows when it goes out. Ignored on every other category, which is not window-bound.default false
validitySecondsintegerAuthentication SMS only (a template of DLT category TRANSACTIONAL — one-time codes): not sent once this many seconds have passed since the request; a message still queued then fails as EXPIRED_BEFORE_SEND, uncharged. 400 on any other category.
30–86400
statusCallbackPublicStatusCallbackAlso POST this message’s status events (
message.sent,.delivered,.read,.failed, or the ones you name) to this URL — signed with your status-callback secret, retried like every webhook, kept 7 days. In addition to your webhook endpoints, never instead. 409 STATUS_CALLBACK_SECRET_MISSING until the secret exists (POST /v1/status-callback-secret).2 fields of
statusCallbackeventsstring[]Which of the resource’s status events to send; all of them when left out. A message: message.sent, message.delivered, message.read, message.failed. A call: call.queued, call.ringing, call.answered, call.completed, call.failed, call.no_answer, call.busy.
One of
message.sentmessage.deliveredmessage.readmessage.failedcall.queuedcall.ringingcall.answeredcall.completedcall.failedcall.no_answercall.busyurlstringRequiredWhere this message’s or call’s status events are POSTed, signed like every webhook (
Trovacast-Signature) with your status-callback secret (POST /v1/status-callback-secret). https on a public host and an allowed port (443, 80, or 1024 up that is not a well-known non-HTTP service’s), checked now and again at every delivery. Retried on the webhook schedule; kept 7 days. In addition to — never instead of — your webhook endpoints.at most 2048 characters
templatePublicMessageTemplateSelector3 fields of
templateidstring (uuid)The template’s id. Or name it by
name+language.languagestringat most 16 characters
namestringat most 160 characters
textstringWhatsApp
type: "text": the message (at most 4,000 characters). Emailtype: "text": the plain-text body.at most 100000 characters
toPublicMessageRecipient2 fields of
toemailstringEmail: the address. The contact with this address is used, or created (needs
contacts:writeas well).at most 320 characters
phonestringWhatsApp and SMS: international format. The contact with this number is used, or created (needs
contacts:writeas well).
typestringRequiredWhatsApp:
templateany time, with consent;text,media,interactiveandreactionare free-form, only inside the 24-hour window the customer opened. Email and SMS taketemplateortext; SMS alsomms— a picture (media, one JPEG or PNG ≤ 5 MB) with optionaltext, to US and Canadian numbers only, from one of your registered numbers, priced per message.One of
templatetextmediainteractivereactionlocationcontactsmmsvariablesRecord<string, string>Template variables by name, exactly the template’s
variableslist (var1…or named parameters,header_*,button{i}_var1,button{i}_code).
Response 202PublicMessage
Its fields are listed under Get message.
Errors
400Any channel: VALIDATION_FAILED — a malformed request (messagelists each problem), a field of another channel or message type, or a template variable the channel would refuse (named: Meta’s parameter rules on WhatsApp, the DLT variable types on SMS, the subject and HTML rules on email). WhatsApp: VALIDATION_FAILED for an interactive message over Meta’s limits; MEDIA_URL_REFUSED —media.urlis not https on a public host (reason). SMS: SMS_TEMPLATE_REQUIRED —type: "text"(India’s DLT rules allow registered templates only).401API_KEY_INVALID — missing, unknown, revoked or expired key.402Any channel: BILLING_INSUFFICIENT_CREDIT, BILLING_SUBSCRIPTION_PAST_DUE, BILLING_SUBSCRIPTION_SUSPENDED or BILLING_SUBSCRIPTION_CANCELED — the prepaid wallet or the plan refuses the send (never in shadow mode).403ENTITLEMENT_MESSAGING_DISABLED — the organization does not have messaging; API_KEY_SCOPE_MISSING — the key lacksmessages:write, orcontacts:writefor a send byto.phone/to.email(requiredScope), or is not an organization key (API_KEY_KIND_MISMATCH).404Each names what it could not find: CONTACT_NOT_FOUND (contactId), TEMPLATE_NOT_FOUND (template, on this channel), CONVERSATION_NOT_FOUND (conversationId), SENDER_NOT_FOUND (senderId) or REPLY_TARGET_NOT_FOUND (replyToMessageId,reaction.messageId). Another organization’s id — or a conversation or message of the other mode: a test thread to a live key, a live customer’s to a test key — reads exactly like a missing one. Treat any 404 as “not found”; older clients that only know NOT_FOUND keep working by the status.409Consent (any channel): CONSENT_REQUIRED, CONSENT_MARKETING_REQUIRED, CONSENT_OPTED_OUT, CONTACT_OPTED_OUT, CONTACT_BLOCKED. Any channel: TEMPLATE_NOT_SENDABLE, MESSAGING_SENDER_RESTRICTED, NO_SENDER_AVAILABLE, CHANNEL_NOT_CONFIGURED (the channel is not set up — no WhatsApp account, no email sending domain or SMTP account, no SMS settings or header). WhatsApp: MESSAGING_WINDOW_CLOSED, REPLY_TARGET_UNAVAILABLE. Email: EMAIL_SUPPRESSED (withreason), FROM_NOT_ALLOWED, EMAIL_SENDING_SUSPENDED, EMAIL_DOMAIN_NOT_VERIFIED. SMS: SMS_HEADER_CATEGORY_MISMATCH, SMS_OUTSIDE_SEND_WINDOW (withopensAt). IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this key is still running. On WhatsApp, email and SMS every 4xx refusal after the recipient is known carriescontactId.413WhatsApp: MEDIA_TOO_LARGE — the linked file is over the cap.415WhatsApp: MEDIA_TYPE_UNSUPPORTED — the link serves a type WhatsApp does not deliver.422RECIPIENT_PHONE_REQUIRED — WhatsApp: an authentication template to a contact known by business-scoped user id alone; SMS: a contact with no phone number. Email: RECIPIENT_EMAIL_REQUIRED — the contact has no email address. WhatsApp media: MEDIA_FETCH_FAILED or MEDIA_CONTENT_MISMATCH (reason). IDEMPOTENCY_KEY_REUSED — the key was used for a different request.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).503BILLING_RATE_UNAVAILABLE — the plan prices no such message; MEDIA_NOT_ENABLED — this deployment keeps no media (WhatsApptype: "media").
curl -X POST 'https://api.trovacast.com/v1/messages' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H 'Idempotency-Key: order-1001-confirmation' \
-H 'Content-Type: application/json' \
-d '{
"type": "template",
"contactId": "CONTACT_ID",
"template": {
"name": "order_confirmation",
"language": "en"
},
"variables": {
"var1": "Aarav",
"var2": "#1001"
},
"metadata": {
"orderId": "1001"
}
}'{
"button": {
"payload": "COD_CONFIRM:1001",
"text": "TEXT"
},
"channel": "whatsapp",
"charge": {
"amountMinor": 25,
"category": "utility",
"currency": "INR",
"ratePerUnitMinor": 25,
"ratedAt": "2026-11-05T10:00:00.000Z",
"status": "charged",
"units": 1
},
"contactId": "CONTACT_ID",
"contacts": [
{
"emails": [
{
"email": "riya@example.com",
"type": "WORK"
}
],
"name": "Riya Sharma",
"organization": "Acme Pvt Ltd",
"phones": [
{
"phone": "+91 98765 43210",
"type": "CELL"
}
]
}
],
"context": {
"messageId": "MESSAGE_ID",
"providerMessageId": "PROVIDER_MESSAGE_ID"
},
"conversationId": "CONVERSATION_ID",
"createdAt": "2026-11-05T10:00:00.000Z",
"deliveredAt": "2026-11-05T10:00:00.000Z",
"direction": "inbound",
"email": {
"attachments": [
{
"contentType": "application/pdf",
"filename": "invoice-1001.pdf",
"size": 1
}
],
"bcc": [
"BCC"
],
"cc": [
"a•••@acme-customer.com"
],
"from": "orders@mail.acme.com",
"subject": "Your order #1001 is confirmed",
"to": "a•••@example.com",
"tracking": {
"clicks": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
},
"opens": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
}
}
},
"failedAt": "2026-11-05T10:00:00.000Z",
"failure": {
"code": "META_131026",
"reason": "REASON"
},
"id": "ID",
"livemode": true,
"location": {
"address": "12 MG Road, Bengaluru",
"latitude": 12.9716,
"longitude": 77.5946,
"name": "Acme Store",
"url": "URL"
},
"media": {
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
},
"mediaItems": [
{
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
}
],
"metadata": {},
"object": "message",
"order": {
"catalogId": "CATALOG_ID",
"items": [
{
"currency": "INR",
"itemPrice": 499,
"productRetailerId": "SKU-1001",
"quantity": 2
}
],
"text": "TEXT"
},
"pricing": {
"billable": true,
"category": "utility",
"model": "MODEL",
"type": "TYPE"
},
"providerMessageId": "PROVIDER_MESSAGE_ID",
"reaction": {
"emoji": "👍"
},
"readAt": "2026-11-05T10:00:00.000Z",
"scheduledAt": "2026-11-05T10:00:00.000Z",
"sentAt": "2026-11-05T10:00:00.000Z",
"sms": {
"country": "IN",
"encoding": "gsm7",
"expiresAt": "2026-11-05T10:00:00.000Z",
"header": "ACMEIN",
"keyword": "stop",
"price": {
"amount": "0.002780",
"currency": "USD"
},
"segments": 1,
"sendAfter": "2026-11-05T10:00:00.000Z"
},
"status": "queued",
"template": {
"id": "ID",
"language": "en",
"name": "order_confirmation"
},
"text": "TEXT",
"type": "template",
"updatedAt": "2026-11-05T10:00:00.000Z",
"warnings": [
{
"code": "WHATSAPP_NOT_CONNECTED",
"message": "MESSAGE"
}
]
}Get message
get
Retrieves a message.
The message with its current status, when it reached each step (sentAt, deliveredAt, readAt, failedAt) and, once failed, failure. It is the shape every message.* event embeds, so a poll and a webhook parse alike. A key reads the messages of its own mode only: another mode’s id answers 404.
Access: an organization key with the messages:read scope.
Path parameters
messageIdstringRequired
Response 200PublicMessage
Show the 34 fieldsHide the fields
buttonPublicMessageButton | nullRequired2 fields of
buttonpayloadstringRequiredThe payload you set on the button when you sent it.
textstring | nullRequiredThe button’s visible text (inbound taps).
channelstringRequiredOne of
whatsappemailsmschargePublicMessageCharge | nullWhat the message cost, once rated (shortly after the provider accepts it). Null before, and always for an inbound or test-mode message.
7 fields of
chargeamountMinorintegerRequiredMinor units of
currencydebited from the prepaid balance (0 when reversed or waived).categorystringRequiredWhat it was priced as (
marketing,utility,authentication,service; email and SMS their own categories).currencystringRequiredratePerUnitMinorintegerRequiredratedAtstring (date-time)RequiredstatusstringRequiredcharged;reversed— refunded because it failed after the provider accepted it;unrated— your plan has no price for its channel and category yet (re-rated once it does);waived.One of
chargedreversedunratedwaivedunitsintegerRequiredSMS segments, else 1.
contactIdstring (uuid)RequiredcontactsPublicSharedContact[] | nullRequiredtype: "contacts"only: the contact cards the customer shared — other people’s names, numbers and addresses. Stored encrypted like message text; handle them as personal data.4 fields of
contactsemailsPublicSharedContactEmail[]Required2 fields of
emailsemailstringRequiredtypestring | nullRequired
namestring | nullRequiredorganizationstring | nullRequiredphonesPublicSharedContactPhone[]Required2 fields of
phonesphonestringRequiredAs the customer’s phone wrote it; not normalized.
typestring | nullRequired
contextPublicMessageContext | nullRequiredThe message this one replied to: for an inbound message, the one the customer answered; for an outbound one, the message it quotes (
replyToMessageId).2 fields of
contextmessageIdstring (uuid) | nullRequiredOur id for the replied-to message, when it is one we sent.
providerMessageIdstringRequired
conversationIdstring (uuid)RequiredcreatedAtstring (date-time)RequireddeliveredAtstring (date-time) | nullRequireddirectionstringRequiredOne of
inboundoutboundemailPublicMessageEmail | nullRequiredEmail only; null on every other channel.
7 fields of
emailattachmentsPublicMessageEmailAttachment[]RequiredWhat the email carried. The files themselves are deleted once it is sent or fails.
3 fields of
attachmentscontentTypestringRequiredfilenamestringRequiredsizeintegerRequiredBytes, decoded.
bccstring[]RequiredBlind copies, masked like
to.ccstring[]RequiredVisible copies, masked like
to.fromstring | nullRequiredThe address it is sent from.
subjectstring | nullRequiredtostring | nullRequiredThe recipient, masked: the first character of the mailbox and the domain.
trackingPublicEmailTracking | nullOpen and click tracking, when the sending domain tracks (
PATCH /v1/email/domains/{domain}); null when the email went out untracked.email.openedandemail.clickedsay when they first happen.2 fields of
trackingclicksPublicEmailTrackingCountRequired3 fields of
clickscountintegerRequiredHits judged a person’s (machine hits — mail privacy proxies, security scanners, link checkers — are never counted).
enabledbooleanRequiredWhether the sending domain tracked this when the email went out.
firstAtstring (date-time) | nullRequired
opensPublicEmailTrackingCountRequired3 fields of
openscountintegerRequiredHits judged a person’s (machine hits — mail privacy proxies, security scanners, link checkers — are never counted).
enabledbooleanRequiredWhether the sending domain tracked this when the email went out.
firstAtstring (date-time) | nullRequired
failedAtstring (date-time) | nullRequiredfailurePublicMessageFailure | nullRequired2 fields of
failurecodestringRequiredStable machine value:
META_<code>for a Meta refusal, or one of ours.reasonstringRequiredA plain-language reason a merchant can read.
idstring (uuid)RequiredlivemodebooleanRequiredFalse when a test-mode (
tc_test_…) key created it: it went to a sandbox, never to a real provider, and was never billed.locationPublicMessageLocation | nullRequiredtype: "location"only: the location the customer shared.5 fields of
locationaddressstring | nullRequiredlatitudenumberRequired-90–90
longitudenumberRequired-180–180
namestring | nullRequiredurlstring | nullRequiredA link WhatsApp sent with it (usually a business’s); http(s) only.
mediaPublicMessageMediaInfo | nullRequiredA media message’s file (a customer’s photo, voice note or document, or one you sent): what it is and whether our copy is ready. Never a link: fetch one from
GET /v1/messages/:id/mediaoncestatusisready—message.media.readysays when. Null on every other message.7 fields of
mediafailureCodestring | nullRequiredfailed/rejectedonly: why, as a stable code.fileNamestring | nullRequiredA document’s name, phone-shaped runs masked.
indexintegerRequiredThe file’s place in its message, 0 first: what
GET /v1/messages/{messageId}/mediatakes asindex. Only an incoming MMS has more than one.0–9
kindstringRequiredimage, video, audio, document or sticker — or
unknownwhile an incoming MMS file whose type the SMS provider did not say is stillpending(its kind is known once it is stored).mimeTypestring | nullRequiredsizeBytesinteger | nullRequiredKnown once the file is stored.
statusstringRequiredpending: an inbound file is still being fetched (from WhatsApp, or an MMS file from the SMS provider).ready: stored —GET /v1/messages/:id/mediaissues a link.failed: the download failed for good.rejected: refused by policy (a type or size not kept, or no media storage on this deployment).One of
pendingreadyfailedrejected
mediaItemsPublicMessageMediaInfo[]RequiredEvery file the message carries, in order —
mediais the first. One for a media message, up to ten for an incoming MMS (type: "mms"), none otherwise. Fetch each withGET /v1/messages/:id/media?index=<index>once itsstatusisready;message.media.readysays when the last of them settled with one stored,message.media.failedwhen none could be kept.7 fields of
mediaItemsfailureCodestring | nullRequiredfailed/rejectedonly: why, as a stable code.fileNamestring | nullRequiredA document’s name, phone-shaped runs masked.
indexintegerRequiredThe file’s place in its message, 0 first: what
GET /v1/messages/{messageId}/mediatakes asindex. Only an incoming MMS has more than one.0–9
kindstringRequiredimage, video, audio, document or sticker — or
unknownwhile an incoming MMS file whose type the SMS provider did not say is stillpending(its kind is known once it is stored).mimeTypestring | nullRequiredsizeBytesinteger | nullRequiredKnown once the file is stored.
statusstringRequiredpending: an inbound file is still being fetched (from WhatsApp, or an MMS file from the SMS provider).ready: stored —GET /v1/messages/:id/mediaissues a link.failed: the download failed for good.rejected: refused by policy (a type or size not kept, or no media storage on this deployment).One of
pendingreadyfailedrejected
metadataRecord<string, string>RequiredThe
metadatayou sent, echoed verbatim.objectstringRequiredOne of
messageorderPublicMessageOrder | nullRequiredtype: "order"only: the catalog order the customer placed.3 fields of
ordercatalogIdstring | nullRequireditemsPublicMessageOrderItem[]Required4 fields of
itemscurrencystring | nullRequireditemPricenumber | nullRequiredThe unit price, in
currency.productRetailerIdstringRequiredquantityintegerRequiredat least 0
textstring | nullRequiredWhat the customer wrote with the order.
pricingPublicMessagePricing | nullRequired4 fields of
pricingbillableboolean | nullRequiredcategorystring | nullRequiredmodelstring | nullRequiredtypestring | nullRequired
providerMessageIdstring | nullRequiredThe provider’s id once sent or received: the WhatsApp
wamid…, or the email’s Message-ID (Amazon SES or the SMTP relay’s).reactionPublicMessageReaction | nullRequiredtype: "reaction"only: the emoji (null when the customer removed their reaction). The message reacted to iscontext.1 field of
reactionemojistring | nullRequiredThe emoji; null when the reaction was removed.
readAtstring (date-time) | nullRequiredscheduledAtstring (date-time) | nullA scheduled message (
sendAt): the instant it goes. It staysqueueduntil then (cancel it withDELETE /v1/messages/{id}). Null on every other message.sentAtstring (date-time) | nullRequiredsmsPublicMessageSms | nullRequiredSMS only; null on every other channel.
8 fields of
smscountrystring | nullRequiredThe destination country (ISO 3166 alpha-2), read from the number — what the SMS is priced by. On an inbound SMS: the sender’s country.
encodingstringRequiredOne of
gsm7ucs2expiresAtstring (date-time) | nullRequiredAn authentication SMS sent with
sms.validitySeconds: not sent after this instant (it fails asEXPIRED_BEFORE_SEND).headerstring | nullRequiredThe sender the SMS went out from, as text: a DLT header or alphanumeric sender ID (
ACMEIN), or one of your numbers (+14155550123); null when, outside India, the platform’s SMS vendor sent it from its own default sender (the destination’s rules allow that when you have no sender that fits). The request’ssenderIdnames a sender by UUID (GET /v1/sms/senders). On an inbound SMS: the thread it was recorded on — the number it was sent to when that number is one of your SMS senders, else the thread the contact last texted on.keywordstring | nullRequiredAn inbound SMS that is a keyword:
stop(STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, OPT OUT, REVOKE — the contact is opted out of SMS),start(START, UNSTOP, SUBSCRIBE, OPT IN — lifts the contact’s own opt-out for service messages, never promotional consent),help(HELP, INFO — nothing changes and no reply is sent; answering is yours). Null on outbound messages and on every other text.One of
stopstarthelppricePublicMessageSmsPrice | nullRequiredWhat Amazon SNS reported the SMS cost, once its delivery log arrived. Informational: you are billed your plan’s per-segment price, never this.
2 fields of
priceamountstringRequiredDecimal text, six places.
currencystringRequiredOne of
USD
segmentsintegerRequiredConcatenated segments the text takes (160/153 GSM-7 characters or 70/67 UCS-2 units each) — what the SMS is billed by.
sendAfterstring (date-time) | nullRequiredA promotional SMS held for its window (
sms.deferUntilWindow): the instant it may go. It staysqueueduntil then;message.sentfollows when it goes out.
statusstringRequiredOutbound messages move queued → sending → sent → delivered → read, or failed. Inbound messages are
received.One of
queuedsendingsentdeliveredreadfailedreceivedtemplatePublicMessageTemplateRef | nullRequired3 fields of
templateidstring (uuid)RequiredlanguagestringRequirednamestringRequired
textstring | nullRequiredThe text: inbound text, a free-form reply, or the rendered template body.
typestringRequiredOutbound:
template,text,mediaorinteractive(and, on SMS,mms— a picture message). Inbound: the WhatsApp message type (text,button,interactive,image, …).updatedAtstring (date-time)RequiredwarningsPublicMessageWarning[]RequiredTest mode only (always empty on a live message): what this send would have been refused for with a live key — the sandbox accepted it anyway, so you learn each live rule while you build. E.g.
SMS_DLT_TEMPLATE_ID_MISSING,WHATSAPP_NOT_CONNECTED,EMAIL_NOT_CONFIGURED,TEMPLATE_TEST_ONLY.2 fields of
warningscodestringRequiredStable: branch on it.
One of
WHATSAPP_NOT_CONNECTEDTEMPLATE_TEST_ONLYSMS_NOT_CONFIGUREDSMS_SENDER_MISSINGSMS_TEMPLATE_REQUIREDSMS_DLT_TEMPLATE_ID_MISSINGSMS_DLT_ENTITY_MISSINGSMS_HEADER_CATEGORY_MISMATCHSMS_OUTSIDE_SEND_WINDOWSMS_DESTINATION_NOT_ALLOWEDEMAIL_NOT_CONFIGUREDEMAIL_FROM_NOT_VERIFIEDmessagestringRequiredWhat a live send needs instead, in words.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such message.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
curl 'https://api.trovacast.com/v1/messages/MESSAGE_ID' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"button": {
"payload": "COD_CONFIRM:1001",
"text": "TEXT"
},
"channel": "whatsapp",
"charge": {
"amountMinor": 25,
"category": "utility",
"currency": "INR",
"ratePerUnitMinor": 25,
"ratedAt": "2026-11-05T10:00:00.000Z",
"status": "charged",
"units": 1
},
"contactId": "CONTACT_ID",
"contacts": [
{
"emails": [
{
"email": "riya@example.com",
"type": "WORK"
}
],
"name": "Riya Sharma",
"organization": "Acme Pvt Ltd",
"phones": [
{
"phone": "+91 98765 43210",
"type": "CELL"
}
]
}
],
"context": {
"messageId": "MESSAGE_ID",
"providerMessageId": "PROVIDER_MESSAGE_ID"
},
"conversationId": "CONVERSATION_ID",
"createdAt": "2026-11-05T10:00:00.000Z",
"deliveredAt": "2026-11-05T10:00:00.000Z",
"direction": "inbound",
"email": {
"attachments": [
{
"contentType": "application/pdf",
"filename": "invoice-1001.pdf",
"size": 1
}
],
"bcc": [
"BCC"
],
"cc": [
"a•••@acme-customer.com"
],
"from": "orders@mail.acme.com",
"subject": "Your order #1001 is confirmed",
"to": "a•••@example.com",
"tracking": {
"clicks": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
},
"opens": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
}
}
},
"failedAt": "2026-11-05T10:00:00.000Z",
"failure": {
"code": "META_131026",
"reason": "REASON"
},
"id": "ID",
"livemode": true,
"location": {
"address": "12 MG Road, Bengaluru",
"latitude": 12.9716,
"longitude": 77.5946,
"name": "Acme Store",
"url": "URL"
},
"media": {
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
},
"mediaItems": [
{
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
}
],
"metadata": {},
"object": "message",
"order": {
"catalogId": "CATALOG_ID",
"items": [
{
"currency": "INR",
"itemPrice": 499,
"productRetailerId": "SKU-1001",
"quantity": 2
}
],
"text": "TEXT"
},
"pricing": {
"billable": true,
"category": "utility",
"model": "MODEL",
"type": "TYPE"
},
"providerMessageId": "PROVIDER_MESSAGE_ID",
"reaction": {
"emoji": "👍"
},
"readAt": "2026-11-05T10:00:00.000Z",
"scheduledAt": "2026-11-05T10:00:00.000Z",
"sentAt": "2026-11-05T10:00:00.000Z",
"sms": {
"country": "IN",
"encoding": "gsm7",
"expiresAt": "2026-11-05T10:00:00.000Z",
"header": "ACMEIN",
"keyword": "stop",
"price": {
"amount": "0.002780",
"currency": "USD"
},
"segments": 1,
"sendAfter": "2026-11-05T10:00:00.000Z"
},
"status": "queued",
"template": {
"id": "ID",
"language": "en",
"name": "order_confirmation"
},
"text": "TEXT",
"type": "template",
"updatedAt": "2026-11-05T10:00:00.000Z",
"warnings": [
{
"code": "WHATSAPP_NOT_CONNECTED",
"message": "MESSAGE"
}
]
}Cancel message
delete
Cancels a scheduled message before it is sent.
A message scheduled with sendAt that still waits becomes failed with failure.code MESSAGE_CANCELED, and message.failed fires; nothing was sent, so nothing is charged. Audited against the key (message.canceled). Refused with 409 MESSAGE_NOT_CANCELABLE when the message was not scheduled, or its time came and it is being (or was) sent.
Access: an organization key with the messages:write scope.
Path parameters
messageIdstringRequired
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Response 200PublicMessage
Its fields are listed under Get message.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such message.409MESSAGE_NOT_CANCELABLE — the message was not scheduled, or its time came and it is being (or was) sent. IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).
curl -X DELETE 'https://api.trovacast.com/v1/messages/MESSAGE_ID' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"button": {
"payload": "COD_CONFIRM:1001",
"text": "TEXT"
},
"channel": "whatsapp",
"charge": {
"amountMinor": 25,
"category": "utility",
"currency": "INR",
"ratePerUnitMinor": 25,
"ratedAt": "2026-11-05T10:00:00.000Z",
"status": "charged",
"units": 1
},
"contactId": "CONTACT_ID",
"contacts": [
{
"emails": [
{
"email": "riya@example.com",
"type": "WORK"
}
],
"name": "Riya Sharma",
"organization": "Acme Pvt Ltd",
"phones": [
{
"phone": "+91 98765 43210",
"type": "CELL"
}
]
}
],
"context": {
"messageId": "MESSAGE_ID",
"providerMessageId": "PROVIDER_MESSAGE_ID"
},
"conversationId": "CONVERSATION_ID",
"createdAt": "2026-11-05T10:00:00.000Z",
"deliveredAt": "2026-11-05T10:00:00.000Z",
"direction": "inbound",
"email": {
"attachments": [
{
"contentType": "application/pdf",
"filename": "invoice-1001.pdf",
"size": 1
}
],
"bcc": [
"BCC"
],
"cc": [
"a•••@acme-customer.com"
],
"from": "orders@mail.acme.com",
"subject": "Your order #1001 is confirmed",
"to": "a•••@example.com",
"tracking": {
"clicks": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
},
"opens": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
}
}
},
"failedAt": "2026-11-05T10:00:00.000Z",
"failure": {
"code": "META_131026",
"reason": "REASON"
},
"id": "ID",
"livemode": true,
"location": {
"address": "12 MG Road, Bengaluru",
"latitude": 12.9716,
"longitude": 77.5946,
"name": "Acme Store",
"url": "URL"
},
"media": {
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
},
"mediaItems": [
{
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
}
],
"metadata": {},
"object": "message",
"order": {
"catalogId": "CATALOG_ID",
"items": [
{
"currency": "INR",
"itemPrice": 499,
"productRetailerId": "SKU-1001",
"quantity": 2
}
],
"text": "TEXT"
},
"pricing": {
"billable": true,
"category": "utility",
"model": "MODEL",
"type": "TYPE"
},
"providerMessageId": "PROVIDER_MESSAGE_ID",
"reaction": {
"emoji": "👍"
},
"readAt": "2026-11-05T10:00:00.000Z",
"scheduledAt": "2026-11-05T10:00:00.000Z",
"sentAt": "2026-11-05T10:00:00.000Z",
"sms": {
"country": "IN",
"encoding": "gsm7",
"expiresAt": "2026-11-05T10:00:00.000Z",
"header": "ACMEIN",
"keyword": "stop",
"price": {
"amount": "0.002780",
"currency": "USD"
},
"segments": 1,
"sendAfter": "2026-11-05T10:00:00.000Z"
},
"status": "queued",
"template": {
"id": "ID",
"language": "en",
"name": "order_confirmation"
},
"text": "TEXT",
"type": "template",
"updatedAt": "2026-11-05T10:00:00.000Z",
"warnings": [
{
"code": "WHATSAPP_NOT_CONNECTED",
"message": "MESSAGE"
}
]
}Get message media
get
Issues a short-lived download link for a message’s stored media.
A link to the photo, video, voice note, sticker or document a message carries (one the contact sent, or one you sent), valid until expiresAt, with its type, size and file name. An incoming MMS may carry several files: index picks one (mediaItems[].index; the first when unset). The link is a credential while it lives: each one issued is audited against the key (message.media_link) and the response is never cached. Refused with 409 MEDIA_NOT_AVAILABLE while the file is still being fetched (from WhatsApp, or from the SMS provider — mediaStatus: PENDING) or when it was refused or failed, and 404 MEDIA_NOT_FOUND when the message carries no file at that index; a key reaches its own mode’s messages only.
Access: an organization key with the messages:read scope.
Path parameters
messageIdstringRequired
Query parameters
indexintegerWhich of the message’s files (
mediaItems[].index); the first when unset. Only an incoming MMS has more than one.
Response 200PublicMessageMediaLink
expiresAtstring (date-time)RequiredfileNamestring | nullRequiredThe file’s name (documents), phone-shaped runs masked.
kindstringRequiredimage, video, audio, document or sticker.
messageIdstring (uuid)RequiredmimeTypestringRequiredobjectstringRequiredOne of
media_linksizeBytesinteger | nullRequiredurlstringRequiredA presigned download link. A credential while it lives: do not log or share it.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such message; MEDIA_NOT_FOUND — the message carries no media (at thatindex).409MEDIA_NOT_AVAILABLE — still being fetched (mediaStatus: PENDING), or refused or failed (mediaStatus,failureCode).429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).503SERVICE_UNAVAILABLE — this deployment keeps no media (no storage configured).
curl 'https://api.trovacast.com/v1/messages/MESSAGE_ID/media' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"expiresAt": "2026-11-05T10:00:00.000Z",
"fileName": "FILE_NAME",
"kind": "image",
"messageId": "MESSAGE_ID",
"mimeType": "image/jpeg",
"object": "media_link",
"sizeBytes": 1,
"url": "URL"
}Mark message read
post
Sends WhatsApp’s read receipt (blue ticks) for a message the contact sent.
Sent from the number the message arrived on; WhatsApp also marks every earlier message in the thread read. Only an inbound WhatsApp message received in the last 30 days qualifies: 409 MESSAGE_NOT_INBOUND, READ_RECEIPT_UNSUPPORTED (a channel without read receipts) or READ_RECEIPT_EXPIRED otherwise, and 409 WHATSAPP_NOT_CONNECTED while no account is connected. Marking a message read twice is the same as once, so a retry after a 5xx is safe. A test key is refused (422 TEST_MODE_UNSUPPORTED): the receipt would reach a real customer.
Access: an organization key with the messages:write scope.
Path parameters
messageIdstringRequired
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. This endpoint converges when run again, so a 5xx stores nothing either: a retry with the same key runs it again. 1–255 visible ASCII characters; kept for 24 hours.
Response 200PublicMessage
Its fields are listed under Get message.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such message.409MESSAGE_NOT_INBOUND, READ_RECEIPT_UNSUPPORTED, READ_RECEIPT_EXPIRED (older than 30 days) or WHATSAPP_NOT_CONNECTED. IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422TEST_MODE_UNSUPPORTED — a TEST key: a read receipt goes to Meta about a real customer’s message, and has no sandbox. IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429MESSAGING_RATE_LIMITED — Meta is throttling; retry later.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).502META_<code>— Meta refused the receipt (e.g. META_131009, an unknown message id).503MESSAGING_TRANSPORT — Meta could not be reached; retry.504MESSAGING_PROVIDER_UNCONFIRMED — Meta timed out or failed (5xx); a receipt is safe to retry.
curl -X POST 'https://api.trovacast.com/v1/messages/MESSAGE_ID/read' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"button": {
"payload": "COD_CONFIRM:1001",
"text": "TEXT"
},
"channel": "whatsapp",
"charge": {
"amountMinor": 25,
"category": "utility",
"currency": "INR",
"ratePerUnitMinor": 25,
"ratedAt": "2026-11-05T10:00:00.000Z",
"status": "charged",
"units": 1
},
"contactId": "CONTACT_ID",
"contacts": [
{
"emails": [
{
"email": "riya@example.com",
"type": "WORK"
}
],
"name": "Riya Sharma",
"organization": "Acme Pvt Ltd",
"phones": [
{
"phone": "+91 98765 43210",
"type": "CELL"
}
]
}
],
"context": {
"messageId": "MESSAGE_ID",
"providerMessageId": "PROVIDER_MESSAGE_ID"
},
"conversationId": "CONVERSATION_ID",
"createdAt": "2026-11-05T10:00:00.000Z",
"deliveredAt": "2026-11-05T10:00:00.000Z",
"direction": "inbound",
"email": {
"attachments": [
{
"contentType": "application/pdf",
"filename": "invoice-1001.pdf",
"size": 1
}
],
"bcc": [
"BCC"
],
"cc": [
"a•••@acme-customer.com"
],
"from": "orders@mail.acme.com",
"subject": "Your order #1001 is confirmed",
"to": "a•••@example.com",
"tracking": {
"clicks": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
},
"opens": {
"count": 2,
"enabled": true,
"firstAt": "2026-11-05T10:00:00.000Z"
}
}
},
"failedAt": "2026-11-05T10:00:00.000Z",
"failure": {
"code": "META_131026",
"reason": "REASON"
},
"id": "ID",
"livemode": true,
"location": {
"address": "12 MG Road, Bengaluru",
"latitude": 12.9716,
"longitude": 77.5946,
"name": "Acme Store",
"url": "URL"
},
"media": {
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
},
"mediaItems": [
{
"failureCode": "MEDIA_TOO_LARGE",
"fileName": "FILE_NAME",
"index": 0,
"kind": "image",
"mimeType": "image/jpeg",
"sizeBytes": 1,
"status": "pending"
}
],
"metadata": {},
"object": "message",
"order": {
"catalogId": "CATALOG_ID",
"items": [
{
"currency": "INR",
"itemPrice": 499,
"productRetailerId": "SKU-1001",
"quantity": 2
}
],
"text": "TEXT"
},
"pricing": {
"billable": true,
"category": "utility",
"model": "MODEL",
"type": "TYPE"
},
"providerMessageId": "PROVIDER_MESSAGE_ID",
"reaction": {
"emoji": "👍"
},
"readAt": "2026-11-05T10:00:00.000Z",
"scheduledAt": "2026-11-05T10:00:00.000Z",
"sentAt": "2026-11-05T10:00:00.000Z",
"sms": {
"country": "IN",
"encoding": "gsm7",
"expiresAt": "2026-11-05T10:00:00.000Z",
"header": "ACMEIN",
"keyword": "stop",
"price": {
"amount": "0.002780",
"currency": "USD"
},
"segments": 1,
"sendAfter": "2026-11-05T10:00:00.000Z"
},
"status": "queued",
"template": {
"id": "ID",
"language": "en",
"name": "order_confirmation"
},
"text": "TEXT",
"type": "template",
"updatedAt": "2026-11-05T10:00:00.000Z",
"warnings": [
{
"code": "WHATSAPP_NOT_CONNECTED",
"message": "MESSAGE"
}
]
}