Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Filter messages by ID



API Overview

api-overview page anchor

Use this endpoint to retrieve detailed events for a specific message. You can obtain an sg_message_id from the Filter All Messages endpoint. This endpoint provides comprehensive details and the full event timeline for a single email.


GET/v3/logs/{sg_message_id}

Base url: https://api.sendgrid.com (for global users and subusers)

Base url: https://api.eu.sendgrid.com (for EU regional subusers)

Get all of the details about the specified message.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
sg_message_idstring
required

The ID of the message you are requesting details for.

Property nameTypeRequiredDescription
subuserstring<^\d+$>

Optional

For requests authenticated as the parent account, this argument must be passed if the desired message belongs to a subuser.

200400403404429default

Detailed information for the specified message, including all events related to the message

Schema
Property nameTypeRequiredDescriptionChild properties
from_emailstring

Optional

The 'From' email address used to deliver the message. This may not be a valid email address.


sg_message_idstring

Optional

A unique ID assigned to the message.


subjectstring

Optional

The email's subject line.


to_emailstring

Optional

The intended recipient's email address.


statusenum<string>

Optional

A summary of the message status based on which events have occurred.

| Event | Status | | -- | -- | | processed | processed | | drop, cancel_drop | dropped | | deferred | deferred | | bounce | bounced | | bounce(type=block) | blocked | | delivered, click, open | delivered |

Possible values:
processeddelivereddeferreddroppedbouncedblocked

template_idstring

Optional

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


asm_group_idinteger

Optional

The unsubscribe group associated with this email.


teammatestring

Optional

Teammate's username.

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

api_key_idstring

Optional

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

Pattern: ^$|^[A-Za-z0-9_-]+Max length: 50

events
array(oneOf):

Optional

All events recorded for this message. Most recent events will be returned upto the maximum of 100 events.

Max items: 100

client_ipstring

Optional

The IP address of the user who sent the message.


categoryarray[string]

Optional

The categories associated with the message.


custom_argsobject

Optional

Custom key-value pairs associated with the message.


outbound_ipstring

Optional

The IP address used to send to the remote Mail Transfer Agent.


outbound_ip_typestring

Optional

The type of outbound IP address used to send the message.

Example: dedicated

marketing_campaign_idinteger

Optional

The ID of the marketing campaign associated with the message.


marketing_campaign_namestring

Optional

The name of the marketing campaign associated with the message.


marketing_campaign_split_idinteger

Optional

The ID of the split associated with the marketing campaign.


marketing_campaign_versionstring

Optional

The version of the marketing campaign associated with the message.

Filter messages by IDLink to code sample: Filter messages by ID
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const sg_message_id =
5
"zYMjsUZORvevDeb4hlcVjg.recvd-6f5cbff5dc-k58s2-1-68CB0DC2-12.0";
6
7
const request = {
8
url: `/v3/logs/${sg_message_id}`,
9
method: "GET",
10
};
11
12
client
13
.request(request)
14
.then(([response, body]) => {
15
console.log(response.statusCode);
16
console.log(response.body);
17
})
18
.catch((error) => {
19
console.error(error);
20
});