Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Filter messages by message ID



API Overview

api-overview page anchor

You must purchase additional email activity history(link takes you to an external page) to gain access to the Email Activity Feed API.

The Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages.

Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them.

See "Getting Started with the Email Activity Feed API" for help building queries and working with the API.

You can also work with email activity in the Activity section of the Twilio SendGrid App(link takes you to an external page).


GET/v3/messages/{msg_id}

Base url: https://api.sendgrid.com

Get all of the details about the specified message.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
msg_idstringrequired

The ID of the message you are requesting details for.

200400404429
SchemaExample
Property nameTypeRequiredDescriptionChild properties
from_emailstring<email>

The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account.

Default: test0@example.com

msg_idstring

A unique ID assigned to the message. This ID can be used to retrieve activity data for the specific message.


subjectstring

The email's subject line.


to_emailstring<email>

The intended recipient's email address.


statusenum<string>

The message's status.

Possible values:
processeddeliverednot_delivered

template_idstring

The ID associated with a Twilio SendGrid email template used to format the message.


asm_group_idinteger

The unsubscribe group associated with this email.

Minimum: 1

teammatestring

Teammate's username

Pattern: ^$|^[A-Za-z0-9]+Min length: 0Max length: 64

api_key_idstring

The ID of the API Key used to authenticate the sending request for the message.

Pattern: ^[A-Za-z0-9]+Min length: 3Max length: 50

eventsarray[object]

List of events related to email message


originating_ipstring<ipv4>

This is the IP of the user who sent the message.


categoriesarray[string]

Categories users associated to the message


unique_argsstring

JSON hash of key-value pairs associated with the message.

Default: Null

outbound_ipstring<ipv4>

IP used to send to the remote Mail Transfer Agent.


outbound_ip_typeenum<string>

Whether or not the outbound IP is dedicated vs shared

Possible values:
dedicatedshared

Filter messages by message ID

filter-messages-by-message-id page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_19
const client = require('@sendgrid/client');
_19
client.setApiKey(process.env.SENDGRID_API_KEY);
_19
_19
const msg_id = "ZGkrHSypTsudrGkmdpJJ";
_19
_19
const request = {
_19
url: `/v3/messages/${msg_id}`,
_19
method: 'GET',
_19
_19
}
_19
_19
client.request(request)
_19
.then(([response, body]) => {
_19
console.log(response.statusCode);
_19
console.log(response.body);
_19
})
_19
.catch(error => {
_19
console.error(error);
_19
});


Rate this page: