Jump to

  • Quickstarts
  • API reference
  • Webhook events
  • Error codes
  • SDKs

API reference

Messages

Upload media

post/v1/media

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-Keystring

    Makes 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)Required

  • fileNamestring

    at most 240 characters

Response 201PublicMediaUpload

Its fields are listed under Get media.

Errors

Request
curl -X POST 'https://api.trovacast.com/v1/media' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 201 (json)
{
  "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/v1/media/{mediaId}

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 fields
  • createdAtstring (date-time)Required

  • expiresAtstring (date-time)Required

    Send it before this (7 days after the upload); it is deleted after. What you sent stays.

  • fileNamestring | nullRequired

    As uploaded, phone-shaped runs masked.

  • idstring (uuid)Required

    Send it with media.id on a WhatsApp type: "media" message (POST /v1/messages).

  • kindstringRequired

    One ofimagevideoaudiodocument

  • livemodebooleanRequired

    False for a test-mode (tc_test_…) key’s upload: only that mode’s sends see it.

  • mimeTypestringRequired

  • objectstringRequired

    One ofmedia

  • sizeBytesintegerRequired

Errors

Request
curl 'https://api.trovacast.com/v1/media/MEDIA_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "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/v1/media/{mediaId}

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-Keystring

    Makes 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

  • deletedbooleanRequired

    One oftrue

  • idstring (uuid)Required

  • objectstringRequired

    One ofmedia

Errors

Request
curl -X DELETE 'https://api.trovacast.com/v1/media/MEDIA_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200 (json)
{
  "deleted": true,
  "id": "ID",
  "object": "media"
}

List messages

get/v1/messages

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

  • limitinteger

    How many items to return.

  • cursorstring

    The nextCursor of the previous page. Omit for the first page.

  • channelstring

    One ofwhatsappemailsms

  • contactIdstring (uuid)

  • conversationIdstring (uuid)

  • directionstring

    One ofinboundoutbound

  • statusstring

    One ofqueuedsendingsentdeliveredreadfailedreceived

  • updatedAfterstring (date-time)

    Reconciliation: messages whose updatedAt is at or after this instant, OLDEST change first (by updatedAt, then id). 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 with nextCursor; when it is null, resume later from the last updatedAt you saw and dedupe by id + updatedAt (every change — a late pricing update included — moves updatedAt).

  • metadatastring[]

    Messages whose metadata holds this key with exactly this value, written key: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 with updatedAfter. Indexed, so it is as cheap as the plain list.

Response 200PublicMessagePage

  • dataPublicMessage[]Required

    Its fields are listed under Get message

  • nextCursorstring | nullRequired

    Pass back as cursor for the next page; null on the last.

Errors

Request
curl 'https://api.trovacast.com/v1/messages?contactId=CONTACT_ID&limit=50' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "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/v1/messages

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-Keystring

    Makes 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

  • channelstring

    The channel to send on. Omitted means whatsapp, so requests written before email and SMS existed keep their meaning.

    One ofwhatsappemailsms

    default "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’s contacts.

    at most 20 items

    4 fields of contacts
    • emailsPublicSendContactEmail[]

      at most 10 items

      2 fields of emails
      • emailstringRequired

        at most 320 characters

      • typestring

        at most 32 characters

    • namestringRequired

      The name the card shows (required).

      at most 256 characters

    • organizationstring

      at most 256 characters

    • phonesPublicSendContactPhone[]

      at most 10 items

      2 fields of phones
      • phonestringRequired

        at most 64 characters

      • typestring

        at 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.

  • emailPublicEmailContent

    9 fields of email
    • attachmentsPublicEmailAttachment[]

      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 attachments
      • contentstring (byte)Required

        The file, standard base64. All of a message’s attachments are at most 7 MB decoded.

      • contentTypestring

        The 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

      • filenamestringRequired

        The 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

    • categorystring

      transactional (a receipt, a shipping update — something the customer expects) or marketing. Required for type: "text"; a template’s defaults from its category (a MARKETING template is always marketing). Marketing needs marketing: opted_in email 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 oftransactionalmarketing

    • ccstring[]

      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

    • fromstring

      Send 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_ALLOWED otherwise). Not with senderId.

      at most 320 characters

    • fromNamestring

      The display name with email.from. Defaults to the account’s.

      at most 120 characters

    • htmlstring

      An HTML body for type: "text". Sanitized before sending; a plain-text part is derived from it when text is absent.

      at most 262144 characters

    • replyTostring

      Where replies go. Defaults to the from address.

      at most 320 characters

    • subjectstring

      Required for type: "text"; overrides the template’s subject for type: "template". One line: no CR or LF.

      at most 998 characters

  • interactivePublicInteractive

    9 fields of interactive
    • actionPublicInteractiveCta

      type: "cta_url": the button and the link it opens.

      2 fields of action
      • displayTextstringRequired

        The button’s label.

        at most 20 characters

      • urlstringRequired

        The https link it opens (no credentials). Nothing comes back when the customer taps it.

        at most 2000 characters

    • bodystringRequired

      at most 1024 characters

    • buttonstring

      type: "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 buttons
      • idstringRequired

        Echoed back as button.payload on the inbound message when the customer taps it. Unique within the message.

        at most 256 characters

      • titlestringRequired

        at most 20 characters

    • flowPublicInteractiveFlow

      type: "flow": the Flow the button opens.

      7 fields of flow
      • actionstring

        navigate opens screen with data; data_exchange asks the Flow’s own endpoint for its first screen.

        One ofnavigatedata_exchange

        default "navigate"

      • ctastringRequired

        The button that opens it.

        at most 20 characters

      • dataobject

        navigate: the first screen’s initial data (at most 4096 characters as JSON). Customer data goes nowhere but the Flow.

      • idstringRequired

        The Flow’s id in your WhatsApp Business account (WhatsApp Manager → Flows).

      • modestring

        draft sends an unpublished Flow, for testing.

        One ofdraftpublished

        default "published"

      • screenstring

        The first screen’s id. Required for navigate.

        at most 100 characters

      • tokenstring

        Your correlation token, echoed back with the customer’s answers (and to a data_exchange Flow’s endpoint).

        at most 200 characters

    • footerstring

      at most 60 characters

    • headerstring

      A text header (one line).

      at most 60 characters

    • sectionsPublicInteractiveSection[]

      type: "list": 1–10 sections, at most 10 rows in all.

      2 fields of sections
      • rowsPublicInteractiveRow[]Required

        3 fields of rows
        • descriptionstring

          at most 72 characters

        • idstringRequired

          Echoed back as button.payload when the customer picks the row. Unique within the message.

          at most 200 characters

        • titlestringRequired

          at most 24 characters

      • titlestring

        Required when the list has more than one section.

        at most 24 characters

    • typestringRequired

      One ofbuttonlistcta_urlflow

  • locationPublicSendLocation

    type: "location" (WhatsApp, inside the 24-hour window): a place on the map. Echoed as the message’s location.

    4 fields of location
    • addressstring

      at most 512 characters

    • latitudenumberRequired

      -90–90

    • longitudenumberRequired

      -180–180

    • namestring

      at most 256 characters

  • mediaPublicMessageMedia

    4 fields of media
    • captionstring

      Shown under an image, video or document. Audio has none.

      at most 1024 characters

    • fileNamestring

      A 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). Or url, not both. Its name is the document’s unless fileName overrides it.

    • urlstring

      An 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 quickReplies
    • indexintegerRequired

      The button’s position among the template’s buttons (0-based), as Meta numbers them.

      0–9

    • payloadstringRequired

      Echoed back on the inbound message.received (button.payload) when the customer taps it.

      at most 256 characters

  • reactionPublicReaction

    type: "reaction" (WhatsApp): the emoji and the message it goes on. The message reacted to is echoed as context.

    2 fields of reaction
    • emojistringRequired

      Exactly one emoji (skin tones, flags and ZWJ sequences count as one).

      at most 64 characters

    • messageIdstring (uuid)Required

      Our 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, media or interactive: our id of a message in the same conversation that this one quotes (an inbound message, or one already sent). Echoed as context on 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 queued with scheduledAt, every send rule is checked now — and consent, billing and (WhatsApp free-form) the 24-hour window again when it goes; message.sent follows then. Cancel it with DELETE /v1/messages/{id} while it waits. Not with sms.validitySeconds.

  • senderIdstring (uuid)

    Which of the organization’s WhatsApp numbers to send from: a senderId from GET /v1/whatsapp/account (numbers[].senderId) or from a conversation. Defaults to the default number — or, with conversationId, to the conversation’s own number. Email: an email sender the organization registered in the console, held to the same rule as email.from. SMS: a DLT header’s id from GET /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.

  • smsPublicCreateMessageSms

    3 fields of sms
    • categorystring

      Free 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. promotional needs the contact’s SMS opt-in and gets the destination’s opt-out line when the text has no “STOP”; service_explicit needs SMS consent; service_implicit and transactional (one-time codes) are refused only by an opt-out — and a transactional text must carry its code (4 to 10 digits), else 400. Also the price: promotional is priced as marketing, transactional as authentication, service as utility.

      One oftransactionalservice_implicitservice_explicitpromotional

    • deferUntilWindowboolean

      Promotional 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 queued with sms.sendAfter, and message.sent follows when it goes out. Ignored on every other category, which is not window-bound.

      default false

    • validitySecondsinteger

      Authentication 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

  • statusCallbackPublicStatusCallback

    Also 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 statusCallback
    • eventsstring[]

      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 ofmessage.sentmessage.deliveredmessage.readmessage.failedcall.queuedcall.ringingcall.answeredcall.completedcall.failedcall.no_answercall.busy

    • urlstringRequired

      Where 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

  • templatePublicMessageTemplateSelector

    3 fields of template
    • idstring (uuid)

      The template’s id. Or name it by name + language.

    • languagestring

      at most 16 characters

    • namestring

      at most 160 characters

  • textstring

    WhatsApp type: "text": the message (at most 4,000 characters). Email type: "text": the plain-text body.

    at most 100000 characters

  • toPublicMessageRecipient

    2 fields of to
    • emailstring

      Email: the address. The contact with this address is used, or created (needs contacts:write as well).

      at most 320 characters

    • phonestring

      WhatsApp and SMS: international format. The contact with this number is used, or created (needs contacts:write as well).

  • typestringRequired

    WhatsApp: template any time, with consent; text, media, interactive and reaction are free-form, only inside the 24-hour window the customer opened. Email and SMS take template or text; SMS also mms — a picture (media, one JPEG or PNG ≤ 5 MB) with optional text, to US and Canadian numbers only, from one of your registered numbers, priced per message.

    One oftemplatetextmediainteractivereactionlocationcontactsmms

  • variablesRecord<string, string>

    Template variables by name, exactly the template’s variables list (var1… or named parameters, header_*, button{i}_var1, button{i}_code).

Response 202PublicMessage

Its fields are listed under Get message.

Errors

Request
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"
  }
}'
Response 202 (json)
{
  "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/v1/messages/{messageId}

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 fields
  • buttonPublicMessageButton | nullRequired

    2 fields of button
    • payloadstringRequired

      The payload you set on the button when you sent it.

    • textstring | nullRequired

      The button’s visible text (inbound taps).

  • channelstringRequired

    One ofwhatsappemailsms

  • chargePublicMessageCharge | null

    What 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 charge
    • amountMinorintegerRequired

      Minor units of currency debited from the prepaid balance (0 when reversed or waived).

    • categorystringRequired

      What it was priced as (marketing, utility, authentication, service; email and SMS their own categories).

    • currencystringRequired

    • ratePerUnitMinorintegerRequired

    • ratedAtstring (date-time)Required

    • statusstringRequired

      charged; 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 ofchargedreversedunratedwaived

    • unitsintegerRequired

      SMS segments, else 1.

  • contactIdstring (uuid)Required

  • contactsPublicSharedContact[] | nullRequired

    type: "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 contacts
    • emailsPublicSharedContactEmail[]Required

      2 fields of emails
      • emailstringRequired

      • typestring | nullRequired

    • namestring | nullRequired

    • organizationstring | nullRequired

    • phonesPublicSharedContactPhone[]Required

      2 fields of phones
      • phonestringRequired

        As the customer’s phone wrote it; not normalized.

      • typestring | nullRequired

  • contextPublicMessageContext | nullRequired

    The 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 context
    • messageIdstring (uuid) | nullRequired

      Our id for the replied-to message, when it is one we sent.

    • providerMessageIdstringRequired

  • conversationIdstring (uuid)Required

  • createdAtstring (date-time)Required

  • deliveredAtstring (date-time) | nullRequired

  • directionstringRequired

    One ofinboundoutbound

  • emailPublicMessageEmail | nullRequired

    Email only; null on every other channel.

    7 fields of email
    • attachmentsPublicMessageEmailAttachment[]Required

      What the email carried. The files themselves are deleted once it is sent or fails.

      3 fields of attachments
      • contentTypestringRequired

      • filenamestringRequired

      • sizeintegerRequired

        Bytes, decoded.

    • bccstring[]Required

      Blind copies, masked like to.

    • ccstring[]Required

      Visible copies, masked like to.

    • fromstring | nullRequired

      The address it is sent from.

    • subjectstring | nullRequired

    • tostring | nullRequired

      The recipient, masked: the first character of the mailbox and the domain.

    • trackingPublicEmailTracking | null

      Open and click tracking, when the sending domain tracks (PATCH /v1/email/domains/{domain}); null when the email went out untracked. email.opened and email.clicked say when they first happen.

      2 fields of tracking
      • clicksPublicEmailTrackingCountRequired

        3 fields of clicks
        • countintegerRequired

          Hits judged a person’s (machine hits — mail privacy proxies, security scanners, link checkers — are never counted).

        • enabledbooleanRequired

          Whether the sending domain tracked this when the email went out.

        • firstAtstring (date-time) | nullRequired

      • opensPublicEmailTrackingCountRequired

        3 fields of opens
        • countintegerRequired

          Hits judged a person’s (machine hits — mail privacy proxies, security scanners, link checkers — are never counted).

        • enabledbooleanRequired

          Whether the sending domain tracked this when the email went out.

        • firstAtstring (date-time) | nullRequired

  • failedAtstring (date-time) | nullRequired

  • failurePublicMessageFailure | nullRequired

    2 fields of failure
    • codestringRequired

      Stable machine value: META_<code> for a Meta refusal, or one of ours.

    • reasonstringRequired

      A plain-language reason a merchant can read.

  • idstring (uuid)Required

  • livemodebooleanRequired

    False when a test-mode (tc_test_…) key created it: it went to a sandbox, never to a real provider, and was never billed.

  • locationPublicMessageLocation | nullRequired

    type: "location" only: the location the customer shared.

    5 fields of location
    • addressstring | nullRequired

    • latitudenumberRequired

      -90–90

    • longitudenumberRequired

      -180–180

    • namestring | nullRequired

    • urlstring | nullRequired

      A link WhatsApp sent with it (usually a business’s); http(s) only.

  • mediaPublicMessageMediaInfo | nullRequired

    A 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/media once status is ready — message.media.ready says when. Null on every other message.

    7 fields of media
    • failureCodestring | nullRequired

      failed / rejected only: why, as a stable code.

    • fileNamestring | nullRequired

      A document’s name, phone-shaped runs masked.

    • indexintegerRequired

      The file’s place in its message, 0 first: what GET /v1/messages/{messageId}/media takes as index. Only an incoming MMS has more than one.

      0–9

    • kindstringRequired

      image, video, audio, document or sticker — or unknown while an incoming MMS file whose type the SMS provider did not say is still pending (its kind is known once it is stored).

    • mimeTypestring | nullRequired

    • sizeBytesinteger | nullRequired

      Known once the file is stored.

    • statusstringRequired

      pending: an inbound file is still being fetched (from WhatsApp, or an MMS file from the SMS provider). ready: stored — GET /v1/messages/:id/media issues 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 ofpendingreadyfailedrejected

  • mediaItemsPublicMessageMediaInfo[]Required

    Every file the message carries, in order — media is the first. One for a media message, up to ten for an incoming MMS (type: "mms"), none otherwise. Fetch each with GET /v1/messages/:id/media?index=<index> once its status is ready; message.media.ready says when the last of them settled with one stored, message.media.failed when none could be kept.

    7 fields of mediaItems
    • failureCodestring | nullRequired

      failed / rejected only: why, as a stable code.

    • fileNamestring | nullRequired

      A document’s name, phone-shaped runs masked.

    • indexintegerRequired

      The file’s place in its message, 0 first: what GET /v1/messages/{messageId}/media takes as index. Only an incoming MMS has more than one.

      0–9

    • kindstringRequired

      image, video, audio, document or sticker — or unknown while an incoming MMS file whose type the SMS provider did not say is still pending (its kind is known once it is stored).

    • mimeTypestring | nullRequired

    • sizeBytesinteger | nullRequired

      Known once the file is stored.

    • statusstringRequired

      pending: an inbound file is still being fetched (from WhatsApp, or an MMS file from the SMS provider). ready: stored — GET /v1/messages/:id/media issues 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 ofpendingreadyfailedrejected

  • metadataRecord<string, string>Required

    The metadata you sent, echoed verbatim.

  • objectstringRequired

    One ofmessage

  • orderPublicMessageOrder | nullRequired

    type: "order" only: the catalog order the customer placed.

    3 fields of order
    • catalogIdstring | nullRequired

    • itemsPublicMessageOrderItem[]Required

      4 fields of items
      • currencystring | nullRequired

      • itemPricenumber | nullRequired

        The unit price, in currency.

      • productRetailerIdstringRequired

      • quantityintegerRequired

        at least 0

    • textstring | nullRequired

      What the customer wrote with the order.

  • pricingPublicMessagePricing | nullRequired

    4 fields of pricing
    • billableboolean | nullRequired

    • categorystring | nullRequired

    • modelstring | nullRequired

    • typestring | nullRequired

  • providerMessageIdstring | nullRequired

    The provider’s id once sent or received: the WhatsApp wamid…, or the email’s Message-ID (Amazon SES or the SMTP relay’s).

  • reactionPublicMessageReaction | nullRequired

    type: "reaction" only: the emoji (null when the customer removed their reaction). The message reacted to is context.

    1 field of reaction
    • emojistring | nullRequired

      The emoji; null when the reaction was removed.

  • readAtstring (date-time) | nullRequired

  • scheduledAtstring (date-time) | null

    A scheduled message (sendAt): the instant it goes. It stays queued until then (cancel it with DELETE /v1/messages/{id}). Null on every other message.

  • sentAtstring (date-time) | nullRequired

  • smsPublicMessageSms | nullRequired

    SMS only; null on every other channel.

    8 fields of sms
    • countrystring | nullRequired

      The destination country (ISO 3166 alpha-2), read from the number — what the SMS is priced by. On an inbound SMS: the sender’s country.

    • encodingstringRequired

      One ofgsm7ucs2

    • expiresAtstring (date-time) | nullRequired

      An authentication SMS sent with sms.validitySeconds: not sent after this instant (it fails as EXPIRED_BEFORE_SEND).

    • headerstring | nullRequired

      The 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’s senderId names 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 | nullRequired

      An 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 ofstopstarthelp

    • pricePublicMessageSmsPrice | nullRequired

      What 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 price
      • amountstringRequired

        Decimal text, six places.

      • currencystringRequired

        One ofUSD

    • segmentsintegerRequired

      Concatenated 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) | nullRequired

      A promotional SMS held for its window (sms.deferUntilWindow): the instant it may go. It stays queued until then; message.sent follows when it goes out.

  • statusstringRequired

    Outbound messages move queued → sending → sent → delivered → read, or failed. Inbound messages are received.

    One ofqueuedsendingsentdeliveredreadfailedreceived

  • templatePublicMessageTemplateRef | nullRequired

    3 fields of template
    • idstring (uuid)Required

    • languagestringRequired

    • namestringRequired

  • textstring | nullRequired

    The text: inbound text, a free-form reply, or the rendered template body.

  • typestringRequired

    Outbound: template, text, media or interactive (and, on SMS, mms — a picture message). Inbound: the WhatsApp message type (text, button, interactive, image, …).

  • updatedAtstring (date-time)Required

  • warningsPublicMessageWarning[]Required

    Test 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 warnings
    • codestringRequired

      Stable: branch on it.

      One ofWHATSAPP_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_VERIFIED

    • messagestringRequired

      What a live send needs instead, in words.

Errors

Request
curl 'https://api.trovacast.com/v1/messages/MESSAGE_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "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/v1/messages/{messageId}

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-Keystring

    Makes 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

Request
curl -X DELETE 'https://api.trovacast.com/v1/messages/MESSAGE_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200 (json)
{
  "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/v1/messages/{messageId}/media

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

  • indexinteger

    Which of the message’s files (mediaItems[].index); the first when unset. Only an incoming MMS has more than one.

Response 200PublicMessageMediaLink

  • expiresAtstring (date-time)Required

  • fileNamestring | nullRequired

    The file’s name (documents), phone-shaped runs masked.

  • kindstringRequired

    image, video, audio, document or sticker.

  • messageIdstring (uuid)Required

  • mimeTypestringRequired

  • objectstringRequired

    One ofmedia_link

  • sizeBytesinteger | nullRequired

  • urlstringRequired

    A presigned download link. A credential while it lives: do not log or share it.

Errors

Request
curl 'https://api.trovacast.com/v1/messages/MESSAGE_ID/media' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "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/v1/messages/{messageId}/read

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-Keystring

    Makes 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

Request
curl -X POST 'https://api.trovacast.com/v1/messages/MESSAGE_ID/read' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200 (json)
{
  "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"
    }
  ]
}