Messages
Messages
The Messages API allows you to list, search, view, modify and create SMS and email messages within your SMSByrd account.
Retrieve a message
Get //add css
If you are using one of SMSByrd’s client libraries, we highly recommend using the .Get method instead of .GetById, as it automatically waits for results to arrive!
Retrieves the detail for a single message. Simply supply the unique identifier for the required message.
To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call.
Path parameters
id: String
The identifier of the message to be retrieved. This can be found via other API calls such as List/Search.
//code snippet
Delete a message
Delete: //add css /api/messages/:id
Permanently deletes a message. This operation cannot be undone. Also deletes any attachments related to the message.
Body parameters
id: String
The identifier of the message to be deleted. //code snippet
List all messages
GET: /api/messages?server=:server
Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first.
Query parameters
server: String
The identifier of the server hosting the messages.
receivedAfter: Date/Time
Limits results to only messages received after this date/time.
page: Integer
Used in conjunction with itemsPerPage to support pagination.
itemsPerPage: Integer
A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
dir: String
Optionally limits results based on the direction (Sent or Received), with the default being Received.
//code snippets
Delete all messages
DELETE: /api/messages?server=:server
Permanently deletes all messages held by the specified server. This operation cannot be undone. Also deletes any attachments related to each message.
Query parameters
server: String
The identifier of the server to be emptied.
Search for messages
POST: /api/messages/search?server=:server
If you are using one of SMSByrd’s client libraries, we highly recommend using the .Get method instead of .Search, as it automatically waits for results to arrive. It also returns the whole email/SMS, rather than just a message summary.
Returns a list of message summaries matching the specified search criteria, in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first.
To get the full message content, including HTML & Text body content, you need to use the Retrieve a message endpoint. Alternatively you can search and retrieve in a single call by using our official client libraries.
Query parameters
server: String The identifier of the server hosting the messages.
receivedAfter: Date/Time Limits results to only messages received after this date/time.
page: Integer Used in conjunction with itemsPerPage to support pagination.
itemsPerPage: Integer A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
dir: String Optionally limits results based on the direction (Sent or Received), with the default being Received.
Body parameters
sentFrom: String The full email address or phone number from which the target message was sent.
sentTo: String The full email address or phone number to which the target message was sent.
subject: String The value to seek within the target email’s subject line.
body: String The value to seek within the target message’s HTML or text body.
match: String If set to ALL (default), then only results that match all specified criteria will be returned. If set to ANY, results that match any of the specified criteria will be returned.
Forward a message
POST: /api/messages/:id/forward
Forward an email or SMS message to a verified external email address. Supply the unique identifier for message you want to forward, as well as additional, relevant options.
To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call.
Path parameters
id: String The identifier of the message to be forwarded. This can be found via other API calls such as Search for messages.
Body parameters
to: String The verified external email address to which the message should be sent.
subject: String Optionally override an email's subject line.
html: String Any HTML content to prefix the forwarded message with.
text: String Any plain text content to prefix the forwarded message with.
Reply to a message
POST: /api/messages/:id/reply
Reply to an email or SMS message. Supply the unique identifier for message you want to forward, as well as additional, relevant options.
Email replies can only be sent back to verified external email address. SMS replies can only contain approved phrases to prevent fraud.
To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call.
Path parameters
id: String The identifier of the message to be replied to. This can be found via other API calls such as Search for messages.
Body parameters
subject: String Optionally override an email's subject line.
html: String Any HTML content to prefix the reply with.
text: String Any plain text content to prefix the reply with.
attachments: Array An object array of base64-encoded attachment objects (fileName, contentType, content).
Send an email
POST: /api/messages?server=:server
You can only send emails to verified external email address. Supply the unique identifier for server you want to send from, as well as additional, relevant options.
Path parameters
server: String The identifier of the server from which the email should be sent.
Body parameters
to: String The verified external email address to which the email should be sent.
from: String Optionally overrides of the message’s ‘from’ address. This must be an address ending with YOUR_SERVER.SMSByrd.net, such as my-emails @a1bcdef2.SMSByrd.net.
subject: String The subject line for an email.
html: String HTML content for the email.
text: String Plain text content for the email.
send: Boolean If not true, then the email will be created in your server, but will not be sent.
attachments: Array An object array of base64-encoded attachment objects (fileName, contentType, content).
//code snippets