We use cookies to give you the best possible experience while you browse through our site. By continuing to use our website you implicitly agree to the usage of cookies on this site.

Read More

Sending SMS DLR via HTTP

Introduction

The SMS-DLR API is an HTTP endpoint used to send SMS DLR messages.

Authorization

Please use your API Key's HTTP Token for authorization.

Endpoint

POST /sms HTTP/1.1
Host: sms.tychron.online

Request Headers

NameDefaultDescriptionExample
Accept application/json Only JSON is currently supported for sending SMS via HTTP.
Accept: application/json,*/*
Authorization Bearer KEY Please use your API Key's HTTP Token for authorization.
Authorization: Bearer Rb2VRMSsm0VxHOIcniw6hCJhUqRExQk2
Content-Type  This header denotes the data type of a request body.
Content-Type: application/json

Response Codes

CodeDescriptionSolutions
200 OKThe request was successful and should contain the requested data. 
207 Multi-StatusThe request was understood and well formed, but one or more recipients have failed. This status may also be used if a recipient is not allowed (e.g. international, shortcode or sender-id)The 207 request body will be similar to the 200 status, however one or more recipients will have an error status.
400 Bad RequestThe payload body of the request is malformed or the request contains invalid parameters.Check your JSON payload for invalid or missing parameters, or run it through a JSON linter.
401 UnauthorizedThe request may be deemed unauthorized due to a number of factors.
  • The Authorization header is not set.
  • The provided API HTTP token is invalid, expired, or not active.
  • The requesting account may be unauthorized from making requests.
This error typically results from using an incorrect API token in requests. Check your API token for typos.

If the error persists, please contact support. ([email protected])
403 ForbiddenThe user is not permitted to make the specified request(s). In this instance, the user is likely not authorized to use the SMS API.This error typically results from using an incorrect API token in requests. Check your API token for typos.

Please contact support for additional details.([email protected])
415 Unsupported Media TypeThe content-type used to make the request is not supported. At this time, only JSON is supported.Convert the request to JSON.

Content-Type: application/json
422 Unprocessable EntityThe parameters of the request body failed validation or contain invalid values.The response body will contain specific details for the request failure. Correct the request parameters based on these details.
500 Internal Server ErrorThe request has not been fulfilled due to a server error.Please report this error and contact support for further assistance.
([email protected])

Response Headers

NameDescriptionExample
Content-TypeAt this time, only application/json is supported and will be returned.
Content-Type: application/json
X-CDR-IDAn ID used to identify the CDR (Call Detail Record) generated by the request. Please provide this ID for any billing questions when contacting support.
X-CDR-ID: 01EYVQ227DEWG8YX7FGC0NJ3BC

Supported Output Types

The SMS API only supports JSON as an output type.

Request Format

POST /sms HTTP/1.1
Accept: application/json
Authorization: Bearer YOUR_API_KEY_HERE
Content-Type: application/json
{
  "id": "message1id",
  "type": "sms_dlr",
  "from":"+12003004000",
  "delivery_status": "delivered",
  "delivery_error_code": "000",
  "sms_id": "01GTFCEBFR5RJG3RWXCD8QRDZN"
}

Request Parameters

Fields marked with a * are mandatory.

ParameterTypeDescriptionExample
Root
idStringThe ID used to identify the message."my_message_id1"
type *String
Must be set to "sms_dlr".
"sms_dlr"
from *String

The sending number that will appear in the DLR.

The number must be formatted in E164 format, e.g. (+12003004000).

"+12003004001"
delivery_statusString

  • delivered
  • expired
  • deleted
  • undelivered
  • accepted
  • unknown
  • rejected
"delivered"
delivery_error_codeStringNormally a three digit code further describing an error, contact support for a full detailed list of error codes."000"
sms_id *String

The ID of the SMS message this delivery report is being created for, note that is REQUIRED.

.

Please note for multipart messages, each segment will require its own DLR.

"01EYVMVWJQ9F3VYAJ833W9GZJ9"
request_mclBoolean

When sending to a valid TenDLC number the basic MCL data can be returned in the immediate request.

Your account may not allow MCL on SMS requests, if you would like to have MCL return on request, or regardless of this flag being set, please contact support.

Note that MCL charges may apply if this flag is set to true (unless explictly disabled by your account).

false

Response Format

HTTP/1.1 200 OK
Content-Type: application/json
X-Request-ID: uYmqci22QoeTA8Zj
{
  "01GTFCEBFR5RJG3RWXCD8QRDZN": {
    "id": "01GTFCJRXEBPXERXET9J06FS05",
    "direction": "outbound",
    "from": "12003004000",
    "to": "12003004001",
    "type": "sms_dlr",
    "body": "id:01GTFCEBFR5RJG3RWXCD8QRDZN sub:000 dlvrd:000 submit date:2303012007 done date:2303012008 stat:DELIVRD err:000 text:",
    "encoding": 0,
    "inserted_at": "2021-02-18T22:39:43Z",
    "updated_at": "2021-02-18T22:39:43Z",
    "processed_at": "2021-02-18T22:39:43Z",
    "expires_at": null,
    "submitted_at": null,
    "done_at": null
  }
}

Please note the above example is for demonstrative purposes only.

Response Parameters

Parameters marked with   *   are always present in all requests

ParameterTypeDescriptionExample
Root
*Map<String, Response>A map with the SMS ID as the key and the message response as the value.
Response
id *String

The ID supplied by the system to identify the message.

Note in the case of multipart (i.e. UDH) messages, this ID will be the "multipart_id" that identifies all segments of the message.

"01EYVMVWJQ9F3VYAJ833W9GZJ9"
direction *StringAlways "outbound""outbound"
from *StringThe sender number"12003004000"
to *StringThe recipient number, extracted from the original SMS."12003004001"
type *StringWill always be "sms_dlr" for DLR requests."sms_dlr"
body *StringThe raw generated DLR body, can be safely ignored, but can also be used for debugging.""
encoding *Integer

The encoding that was used for the message.

Note that messages will always return in UTF-8, the encoding is provided for informational purposes when diagnosing issues with upstream message delivery.

3
remote_service_providerString

The name of the service provider.

This field will not be present if MCL is unavailable.

"ACME Corp."
remote_reference_idString

A Tychron issued ID which identifies the carrier the message is destined for, note that is field is only available if "return_mcl" or MCL for SMS Requests is enabled.

This field will not be present if MCL is unavailable

"us_acme"
delivery_statusStringWill be the same as the requested "delivery_status""delivered"
delivery_error_codeStringWill be the same as the requested "delivery_error_code""000"
inserted_atDatetimeDenotes the time the system successfully accepted the message."2020-04-18T11:30:00Z"
updated_atDatetimeDenotes when the message's status was last modified."2020-04-18T11:30:00Z"
expires_atDatetimeDenotes the time the meassage expires."2020-04-18T11:30:00Z"
sent_atDatetime

Denotes when the message was sent.

Will always be nil upon return from an sms request.

"2020-04-18T11:30:00Z"
submitted_atDatetime

Denotes when the original SMS was considered accepted.

Will be the current timestamp.

"2020-04-18T11:30:00Z"
done_atDatetime

Denotes when the original DLR was considered accepted.

Will be the current timestamp.

"2020-04-18T11:30:00Z"
csp_campaignCSPCampaignAn object containing the Campaign information of the request, if available.
CSPCampaign
idString

The Tychron issued UUID for the campaign.

This will be null if no campaign is available.

"c045cf8c-0d97-4241-9f03-1a80ba1d7acb"
tcr_brand_idStringTCR issued Brand ID."B123456"
tcr_campaign_idStringTCR issued Campaign ID."C123456"

Response Types

TypeDescription
smsAn sms forward request.
sms_dlrAn sms delivery receipt

UDH

UDH is one of the methods to create concatenated messages for sending through the sms ecosystem.

Delivered At

It is normal for "delivered_at" and"processed_at" to be null upon request.

References

E.164

E.164 format is the international telephone numbering plan that gives each device on the Public Switched Telephone Network (PSTN) a globally unique number.

The E.164 format consists of a 7 to 15 digit number prepended with a "+" character.

Examples: +12003004000, +332828373552

Encodings

The table below contains all of the encodings supported by Tychron's SMS API. Every payload sent to the API must be made in JSON and encoded in UTF-8.

All SMS messages sent through the API are automatically encoded, but particular encodings may be enforced through the "encode_as" parameter.

To enforce a specific encoding, please reference the table below as needed.

EncodingParameter Value
GSM 7bit (unpacked)0
ASCII1
Latin-13
UCS-2 / UTF-168