REST API
Send and receive messages using the ToucanText REST API. The full interactive reference for every endpoint is available in Swagger.
Authentication
The API uses HTTP Basic authentication. Use your ToucanText account ID as the username and your API token as the password.
Send a message
Send a message to one or more recipients by posting a JSON body to:
POST https://ttapi.toucantext.com/Message
Parameters
The sender address. This can either be an 11 character pre-approved alpha sender or an inbound number
The recipients for the message. Each recipient can be in the form 44xxxxnnnnnn or 07xxxnnnnnn
The message content
(Optional) Additional sending parameters, supplied as an array of objects with key and value properties
Example
curl-u"ACCOUNT_ID:API_TOKEN"-X POSThttps://ttapi.toucantext.com/Message \-H"Content-Type: application/json"\-d'{"senderID": "ToucanText", "recipientList": ["447123456789"], "messageDetail": "Hello from ToucanText"}'
The response contains a results array and your account balance. Check the status and statustext of each result to confirm the outcome for each recipient; each result also includes the msgid assigned to the message.
Retrieve messages and delivery reports
Retrieve inbound messages and delivery reports from your account’s inbound queue:
GET https://ttapi.toucantext.com/Message
Parameters
The maximum number of entries to retrieve in this call
Acknowledge retrieved entries: “True” for yes or “False” for no. Acknowledged entries may no longer be returned on subsequent calls, so use “False” for testing
(Optional) Restrict the download to the specified inbound number
(Optional) Retrieve only delivery reports: “True” for yes or “False” for no
(Optional) Retrieve only inbound messages: “True” for yes or “False” for no
Example
curl-u"ACCOUNT_ID:API_TOKEN"\"https://ttapi.toucantext.com/Message?MaxMessageCount=25&AckMessages=False"
The response contains a messageList array. Each entry includes the sourceAddr, destAddr, messageContents and arrivalTimeUTC. Delivery reports have dlr set to true, with dlrOriginalMessageId identifying the original message.