This is the API V2 documentation. To switch out of beta revert back to our API V1.

Open SidemenuDocs
Docs
Close Sidemenu
Choose:
cURLNodePythonRuby
cURLNodePythonRuby

Message Detail Recordsmessage-detail-records

Once a send message API request goes through, your SMS or MMS will be put into a queue to be sent to its destination. A Message Detail Record (MDR) describes a specific message request and includes those that are active, pending and completed. Telnyx stores the most recent version of the MDR.

Retrieving an MDRretrieving-an-mdr

Note: You will have to acquire an API Key to run this code in your terminal.

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  "https://api.telnyx.com/v2/messages/834f3d53-8a3c-4aa0-a733-7f2d682a72df"

Response Payloadresponse-payload

{
  "data": {
    "record_type": "message",
    "id": "834f3d53-8a3c-4aa0-a733-7f2d682a72df",
    "direction": "outbound",
    "type": "sms",
    "from": "+18445550001",
    "to": [
      {
        "address": "+18665550002",
        "status": "delivered",
        "updated_at": "2019-01-23T18:10:02.574Z"
      }
    ],
    "text": "Hello, World!",
    "webhook_url": "https://www.example.com/hooks",
    "webhook_failover_url": "https://www.example.com/callbacks",
    "use_profile_webhooks": false,
    "cost": {
      "amount": "1.23",
      "currency": "USD"
    },
    "parts": 1,
    "created_at": "2019-01-23T18:10:02.574Z",
    "updated_at": "2019-01-23T18:10:02.574Z",
    "valid_until": "2019-01-23T18:10:02.574Z",
    "errors": [],
    "carrier": "Verizon",
    "line_type": "Wireless"
  }
}

MDR Schema and Status Descriptionsmdr-schema-and-status-descriptions

A Message Detail Record (MDR) describes a specific message request and includes those that are active, pending and completed. Telnyx stores the most recent version of the MDR.

MDR Schemamdr-schema

id

ID of the message request, which is a UUID.

It is included as a string in the POST /messages response payload for outbound messages, or the payload of an incoming webhook for inbound messages.

e.g., "c51c89d9-68ad-4db2-a471-cf622d21c40d"

text Text delivered in the body of the message.
webhook_url The URL where webhooks related to this message will be sent.
webhook_failover_url The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
use_profile_webhooks If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile.

created_at updated_at

Created/updated at time in Unix time in milliseconds, returned as a 13-digit integer (1 ms = 10-3 sec).

e.g., 1522097596060 is Mon, 26 Mar 2018 20:53:16 UTC

from Sender's +E.164 formatted phone number, represented as a string.
to Object containing the receiver's +E.164 formatted phone number, represented as a string, and the status of the messgae as well as the last updated timestamp.
direction Options: ["inbound", "outbound"]
carrier Indicates the carrier name for the number you're sending to or receiving from
line_type Indicates the type of number you're sending to or receiving from Options: ["Wireline", "Wireless", "VoIP"]

cost currency

Default: null

null means that the amount/currency was unknown when the MDR was cut and that the field will be populated later. This is commonly seen in MDRs posted to the delivery status webhook.

type Type of messaging service e.g., "SMS" = text message

MDR status Fieldmdr-status-field

status describes the status/state of the message request when the MDR was retrieved. The value is a string without whitespace.

Inbound Statusinbound-status

When you request an MDR for an inbound message request, the status of the retrieved MDR will most likely be "delivered". That said, there are two inbound statuses:

"received" Received by the Telnyx Messaging Services.
"delivered" Transmitted to you, after receipt.

Outbound Statusoutbound-status

For an outbound message requestAPI:

  • An MDR is only created when Telnyx attempts to send the message. A rejected request will not have an associated MDR. When a request is rejected, Telnyx responds with the reason e.g., missing or invalid value.
  • If the request includes a reachable delivery status webhook URL, we'll POST the MDR after each status update.
  • Telnyx stores the most recent version of the MDR.
  • The status of a completed request is either "delivered" or "failed", which are the "finished" statuses.

An accepted request will transition through some, but not all, of the following:

"queued" Released from scheduler and submitted to gateway. [Queued in scheduler, due to outbound rate limiting.]
"gw_timeout" No DLR (delivery receipt) from gateway.
"sent" Success DLR received from gateway. Message has been sent downstream.
"dlr_timeout" No DLR from downstream.
"delivered" To the best of our knowledge, the message was delivered.
"failed" Failure DLR from gateway or downstream, which is notification of message delivery failure.

Was this page helpful?was-this-page-helpful