Skip to main content
GET
/
messages
/
{message_id}
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});

const message = await client.messages.retrieve('message_id');

console.log(message);
import os
from courier import Courier

client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
message = client.messages.retrieve(
"message_id",
)
print(message)
package main

import (
"context"
"fmt"

"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)

func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
message, err := client.Messages.Get(context.TODO(), "message_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", message)
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.messages.MessageRetrieveParams;
import com.courier.models.messages.MessageRetrieveResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();

MessageRetrieveResponse message = client.messages().retrieve("message_id");
}
}
require "courier"

courier = Courier::Client.new(api_key: "My API Key")

message = courier.messages.retrieve("message_id")

puts(message)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Courier\Client;
use Courier\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');

try {
$message = $client->messages->retrieve('message_id');

var_dump($message);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using TryCourier;
using TryCourier.Models.Messages;

CourierClient client = new();

MessageRetrieveParams parameters = new() { MessageID = "message_id" };

var message = await client.Messages.Retrieve(parameters);

Console.WriteLine(message);
courier messages retrieve \
--api-key 'My API Key' \
--message-id message_id
curl --request GET \
--url https://api.courier.com/messages/{message_id} \
--header 'Authorization: Bearer <token>'
{
  "id": "1-5e2b2615-05efbb3acab9172f88dd3f6f",
  "status": "CANCELED",
  "enqueued": 1,
  "sent": 1,
  "delivered": 1,
  "opened": 1,
  "clicked": 1,
  "recipient": "string",
  "event": "string",
  "notification": "string",
  "error": "string",
  "reason": "BOUNCED",
  "providers": [
    {}
  ]
}
{
"message": "Example message text",
"type": "invalid_request_error"
}
{
"message": "Example message text",
"type": "invalid_request_error"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

message_id
string
required

A unique identifier associated with the message you wish to retrieve (results from a send).

Response

id
string
required

A unique identifier associated with the message you wish to retrieve (results from a send).

status
enum<string>
required

The current status of the message.

Available options:
CANCELED,
CLICKED,
DELAYED,
DELIVERED,
DIGESTED,
ENQUEUED,
FILTERED,
OPENED,
ROUTED,
SENT,
SIMULATED,
THROTTLED,
UNDELIVERABLE,
UNMAPPED,
UNROUTABLE
enqueued
integer<int64>
required

A UTC timestamp at which Courier received the message request. Stored as a millisecond representation of the Unix epoch.

recipient
string
required

A unique identifier associated with the recipient of the delivered message.

event
string
required

A unique identifier associated with the event of the delivered message.

notification
string
required

A unique identifier associated with the notification of the delivered message.

sent
integer<int64>

A UTC timestamp at which Courier passed the message to the Integration provider. Stored as a millisecond representation of the Unix epoch.

delivered
integer<int64>

A UTC timestamp at which the Integration provider delivered the message. Stored as a millisecond representation of the Unix epoch.

opened
integer<int64>

A UTC timestamp at which the recipient opened a message for the first time. Stored as a millisecond representation of the Unix epoch.

clicked
integer<int64>

A UTC timestamp at which the recipient clicked on a tracked link for the first time. Stored as a millisecond representation of the Unix epoch.

error
string | null

A message describing the error that occurred.

reason
enum<string> | null

The reason for the current status of the message.

Available options:
BOUNCED,
FAILED,
FILTERED,
NO_CHANNELS,
NO_PROVIDERS,
OPT_IN_REQUIRED,
PROVIDER_ERROR,
UNPUBLISHED,
UNSUBSCRIBED
providers
object[] | null