List messages
Fetch the statuses of messages you've previously sent.
URL: https://api.courier.com/messages
Method: GET
Query Parameters
archivedboolean
A boolean value that indicates whether archived messages should be included in the response.
cursorstring
A unique identifier that allows for fetching the next set of message statuses.
eventstring
A unique identifier representing the event that was used to send the event.
liststring
A unique identifier representing the list the message was sent to.
messageIdstring
A unique identifier representing the
message_id
returned from either /send or /send/list.notificationstring
A unique identifier representing the notification that was used to send the event.
recipientstring
A unique identifier representing the recipient associated with the requested profile.
statusstring
An indicator of the current status of the message. Multiple status values can be passed in.
tagsstring
A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in.
enqueued_afterstring
The enqueued datetime of a message to filter out messages received before
traceIdstring
The unique identifier used to trace the requests
Response
status: 200 OK
pagingobject
+ Show Properties
resultsarray
An array of Messages
+ Show Properties
Request Example
- cURL
- Node.js
- Ruby
- Python
- Go
- PHP
curl --request GET \
--url https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34 \
--header 'Accept: application/json'
// Dependencies to install:
// $ npm install node-fetch --save
const fetch = require('node-fetch');
const options = {
method: 'GET',
headers: {
Accept: 'application/json'
},
};
fetch('https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
# Dependencies to install:
# $ python -m pip install requests
import requests
url = "https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34"
headers = {
"Accept": "application/json"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34"
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
// Dependencies to install:
// $ composer require guzzlehttp/guzzle
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.courier.com/messages?archived=false&cursor=MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA%3D%3D&event=welcome-message&list=event-change&messageId=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3¬ification=1-5fa64f03-2a3d64b92a1f1a061ab4c3c3&recipient=0460766e-8463-4905-ae98-b72c7aef41d6&status=OPENED&tags=tag-1%2Ctag-2&enqueued_after=1686752793725&traceId=1a3b9d40d64fbf34', [
'headers' => [
'Accept' => 'application/json',
],
]);
echo $response->getBody();
Responses Example
{
"paging": {
"cursor": "MTU4OTQ5NTI1ODY4NywxLTVlYmRjNWRhLTEwODZlYWFjMWRmMjEwMTNjM2I0ZjVhMA==",
"more": true
},
"results": [
{
"id": "1-5e2b2615-05efbb3acab9172f88dd3f6f",
"status": "DELIVERED",
"enqueued": 1562611073426,
"sent": 1562611074138,
"delivered": 1562611077139,
"opened": 1562611083411,
"clicked": 1562611084123,
"recipient": "CC607F6E84A34305AE98B72C",
"event": "my-event",
"notification": "TAFGNB3GNQ4MZVHW4WV4R8Q8ZVN4",
"error": "400 Bad Request",
"reason": "UNSUBSCRIBED"
}
]
}
Example
Method: GET
URL: https://api.courier.com/messages