provider QueryMessages GET
/messages @utdk/sendgrid
/messages Filter all messages
This is **BETA** functionality. You may not have access, and we reserve the right to change functionality without notice.
Filter all messages to search your Email Activity. All queries need to be [URL encoded](https://meyerweb.com/eric/tools/dencoder/), and have this format:
`query={query_type}="{query_content}"`
encoded, this would look like this:
`query=type%3D%22query_content%22`
for example:
Filter by a specific email - `query=to_email%3D%22example%40example.com%22`
Filter by subject line - `query=subject%3d%22A%20Great%20Subject%22`
**Full list of basic query types and examples:**
| **Filter query** | **Unencoded Example** (put this one into the try it out query - it'll automatically encode it for you) | **Encoded Example** (use this one in your code) |
|-----------------|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| msg_id | msg_id=“filter0307p1las1-16816-5A023E36-1.0” | msg_id%3D%22filter0307p1las1-16816-5A023E36-1.0%22 |
| from_email | from_email=“testing@sendgrid.net” | from_email%3D%22testing%40sendgrid.net%22 |
| subject | subject="This is a subject test" | subject%22This%20is%20a%20subject%20test%22 |
| to_email | to_email="example@example.com" | to_email%3D%22example%40example.com%22 |
| status | | status%22processed%22 |
| template_id | | |
| asm_group_id | | |
| api_key_id | | |
| events | status="processed" | status%3D%22processed%22 |
| originating_ip | | |
| categories | | |
| unique_args | | |
| outbound_ip | | |
| last_event_time | last_event_time=“2017-11-07T23:13:58Z” | last_event_time%3D%E2%80%9C2017-11-07T23%3A13%3A58Z%E2%80%9D |
| clicks | clicks="0" | clicks%3D%220%22 |
For information about building compound queries, and for the full query language functionality, see the [query language reference](https://docs.google.com/a/sendgrid.com/document/d/1fWoKTFNfg5UUsB6t9KuIcSo9CetKF_T0bGfWJ_gdPCs/edit?usp=sharing).
Coming soon, example compound queries: limit + to email + date
- query query required
- Use the query syntax to filter your email activity.
- string
- limit query
- The number of messages returned. This parameter must be greater than 0 and less than or equal to 1000
- number
- X-Query-Id header
- string
- X-Cursor header
- string
- Authorization header required
- string
Try it
Authentication
Configure credentials for Email Activity (beta)
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.
Saved automatically to browser storage.
Code snippet
Updates live as you fill in the form above.
TypeScript
import sendgrid from '@utdk/sendgrid';
await sendgrid.getMessages({
"limit": 10,
"Authorization": "Bearer <<YOUR_API_KEY_HERE>>"
})