You can add categories to the X-SMTPAPI header of the emails you send via SendGrid. This will allow you to track emails based on your own categorization system.

Categories must be in 7bit encoding using the US-ASCII character set.

Currently, there is no limit to the number of categories you can track. However, we recommend no more than ~100 total unique categories as this will increase your ease of use in the Statistics area. Additionally, a high rate of unique categories on your account can negatively impact the rate at which we process the messages you send.

Categories should be used to group messages together by broad topic. If you need to attach unique data or identifiers to a message, use Unique Arguments instead.

Example

You can use SendGrid’s SMTP API to add these categories to your email. The following should be added to the email’s header:

Example Category Header

1
2
3
{
  "category": "Example Category"
}

In this example, SendGrid would associate statistics for the email containing that header with the category Example Category.

You can assign up to 10 categories per message:

1
2
3
4
5
6
7
8
{
  "category": [
    "dogs",
    "animals",
    "pets",
    "mammals"
  ]
}