Skip to main content
GET
/
messages
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 messages = await client.messages.list();

console.log(messages.paging);
import os
from courier import Courier

client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
messages = client.messages.list()
print(messages.paging)
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"),
)
messages, err := client.Messages.List(context.TODO(), courier.MessageListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messages.Paging)
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.messages.MessageListParams;
import com.courier.models.messages.MessageListResponse;

public final class Main {
private Main() {}

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

MessageListResponse messages = client.messages().list();
}
}
require "courier"

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

messages = courier.messages.list

puts(messages)
<?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 {
$messages = $client->messages->list(
archived: true,
cursor: 'cursor',
enqueuedAfter: 'enqueued_after',
event: 'event',
list: 'list',
messageID: 'messageId',
notification: 'notification',
provider: ['string'],
recipient: 'recipient',
status: ['string'],
tag: ['string'],
tags: 'tags',
tenantID: 'tenant_id',
traceID: 'traceId',
);

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

CourierClient client = new();

MessageListParams parameters = new();

var messages = await client.Messages.List(parameters);

Console.WriteLine(messages);
courier messages list \
--api-key 'My API Key'
curl --request GET \
--url https://api.courier.com/messages \
--header 'Authorization: Bearer <token>'
{
  "paging": {
    "cursor": "MTpFWUNFRkRRN0c1WERTRTU2",
    "more": true
  },
  "results": [
    {
      "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"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Query Parameters

archived
boolean | null

A boolean value that indicates whether archived messages should be included in the response.

cursor
string | null

A unique identifier that allows for fetching the next set of messages.

event
string | null

A unique identifier representing the event that was used to send the event.

list
string | null

A unique identifier representing the list the message was sent to.

messageId
string | null

A unique identifier representing the message_id returned from either /send or /send/list.

notification
string | null

A unique identifier representing the notification that was used to send the event.

provider
(string | null)[]

The key assocated to the provider you want to filter on. E.g., sendgrid, inbox, twilio, slack, msteams, etc. Allows multiple values to be set in query parameters.

recipient
string | null

A unique identifier representing the recipient associated with the requested profile.

status
(string | null)[]

An indicator of the current status of the message. Allows multiple values to be set in query parameters.

tag
(string | null)[]

A tag placed in the metadata.tags during a notification send. Allows multiple values to be set in query parameters.

tags
string | null

A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in.

tenant_id
string | null

Messages sent with the context of a Tenant

enqueued_after
string | null

The enqueued datetime of a message to filter out messages received before.

traceId
string | null

The unique identifier used to trace the requests

Response

200 - application/json
paging
Paging · object
required

Paging information for the result set.

results
MessageDetails · object[]
required

An array of messages with their details.