V1
API v1•Message Expiration

Message Expiration

Message Expiration Mechanics

Emess dynamically assigns Time-To-Live (TTL) values to all incoming SMS messages based on their urgency tier. This guarantees that time-sensitive codes (e.g. OTPs) do not arrive hours later if there is a temporary network disruption.

TTL Duration by Priority Tier

When Emess receives a message request, an absolute UTC timestamp (sendBefore) is automatically calculated from the resolved template's priority tier:

Template Priority TierResolved TypeUse casesDefault TTL
CRITICALcriticalOTPs, security alerts2 Minutes
STANDARDstandardTransactional notifications1 Hour
BULKbulkMarketing, broadcasts24 Hours

*Note: You can override these defaults by explicitly passing a sendBefore ISO 8601 string in your request payload (must not be earlier than the default minimum for the template's tier).*

How Priority is Determined in v1 vs v0

In API v0: The caller manually passed type: "critical" | "standard" | "bulk" in every /sms/send payload.

In API v1: Priority is bound to the approved SMS Template (priorityTier). You no longer pass type when sending a message — Emess automatically routes and computes TTL from the matched template.

Delivery Workflow

Emess utilizes a deterministic execution pipeline to ensure your messages are processed correctly:

  1. Template Resolution & Ingestion: Emess validates your template parameters (or matches your raw message against approved templates) and queues the message for delivery.
  2. Expiration Guard: Right before delivery, Emess checks if the current time has surpassed the message's sendBefore limit. If it has, the delivery is aborted and the message is marked as EXPIRED. A refund is automatically credited back to your balance.
  3. Execution: If valid, the message is dispatched. To prevent duplicated deliveries or unexpected behaviors, Emess performs no automatic retries on failed dispatches. Failed messages will simply be marked as such in your dashboard and via GET /api/v1/sms/:id.