GET /messages/:message_id/history
URL: https://api.courier.com/messages/:message_id/history
Method: GET
Path Parameters
message_idstringrequired
A unique identifier associated with the message you wish to retrieve (results from a send).
Query Parameters
typestring
A supported Message History type that will filter the events returned.
Responses
status: 200 OK
resultsarray
An array of events of a previously sent message
status: 400 Bad Request
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
status: 404 Message Not Found
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
Request Example
- cURL
- Node.js
- Ruby
- Python
- Go
- PHP
curl --request GET \
--url https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED \
--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/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED', 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/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED")
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/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED"
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/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED"
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/1-5e2b2615-05efbb3acab9172f88dd3f6f/history?type=DELIVERED', [
'headers' => [
'Accept' => 'application/json',
],
]);
echo $response->getBody();
Responses Example
{
"results": [
{
"data": {
"name": "Courier"
},
"event": "<Event | Notification ID>",
"profile": {},
"recipient": "<Recipient ID>",
"ts": 1562611083411,
"type": "ENQUEUED"
},
{
"event_id": "<Event>",
"notification_id": "<Notification ID>",
"ts": 1562611083411,
"type": "MAPPED"
},
{
"merged_profile": {},
"received_profile": {},
"stored_profile": {},
"ts": 1562611083411,
"type": "PROFILE_LOADED"
},
{
"channel": {
"id": "5e95b992-3505-4f66-8808-f91d5d0fe8c9"
},
"integration": {
"id": "8431c89d-aff0-484c-914d-36a257ea371f",
"provider": "sendgrid"
},
"output": {},
"ts": 1562611083411,
"type": "RENDERED"
},
{
"channel": {
"id": "ae25b99c-3d05-4f26-8108-f91d5d0fe8c9"
},
"integration": {
"id": "8431c89d-aff0-484c-914d-36a257ea371f",
"provider": "sendgrid"
},
"ts": 1562611083411,
"type": "SENT"
},
{
"channel": {
"id": "5e95b992-3505-4f66-8808-f91d5d0fe8c9"
},
"integration": {
"id": "8431c89d-aff0-484c-914d-36a257ea371f",
"provider": "sendgrid"
},
"ts": 1562611083411,
"type": "DELIVERED"
},
{
"channel": {
"id": "ae25b99c-3d05-4f26-8108-f91d5d0fe8c9"
},
"integration": {
"id": "8431c89d-aff0-484c-914d-36a257ea371f",
"provider": "sendgrid"
},
"ts": 1562611083411,
"type": "UNDELIVERABLE"
},
{
"channel": {
"id": "ae25b99c-3d05-4f26-8108-f91d5d0fe8c9"
},
"ts": 1644482783377,
"type": "UNROUTABLE"
}
]
}
{
"message": "Error Message",
"type": "invalid_request_error"
}
{
"message": "Not Found",
"type": "invalid_request_error"
}