Filter all messages
Use this endpoint to search processed email messages and identify specific messages of interest sent from your account. The response returns a list of messages that match your filter criteria, including each message's sg_message_id and key delivery attributes such as sender, recipient, subject, and status. Pass the sg_message_id to the Filter Messages by ID endpoint to retrieve full event-level details for that message.
POST/v3/logs
Base url: https://api.sendgrid.com (for global users and subusers)
Base url: https://api.eu.sendgrid.com (for EU regional subusers)
List recent messages within Email Logs, or search for messages using a filter.
Bearer <<YOUR_API_KEY_HERE>>application/jsonOptional
Allowed event fields and operators
| Field | Operators |
|------------------------- |----------------------|
| sg_message_id | = |
| subject | = |
| to_email | = |
| status | IN |
| reason | = |
| categories | IN |
| sg_message_id_created_at | >, <, >=, <= |
- multiple conditions can be combined with
AND - nesting is not allowed
INoperator accepts a list of string values:field IN ('value1', 'value2')
sg_message_id_created_at > TIMESTAMP "2025-01-01T00:00:00Z" AND sg_message_id_created_at < TIMESTAMP "2025-02-01T00:00:00Z" AND status IN ('delivered', 'processed') AND categories IN ('newsletter', 'marketing')Optional
Number of messages to return (1–1000).
10Minimum: 1Maximum: 1000Optional
For requests authenticated as the parent account, this argument must be passed if the desired messages belong to a subuser. You can only call this endpoint for 1 subuser at a time.
["20223230"]Max items: 1A page of messages matching the filter.
Optional
List of messages matching the filter query.
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const data = {5query: "query",6};78const request = {9url: `/v3/logs`,10method: "POST",11body: data,12};1314client15.request(request)16.then(([response, body]) => {17console.log(response.statusCode);18console.log(response.body);19})20.catch((error) => {21console.error(error);22});