Unique Arguments

This information will be stored as a “Not PII” field and may be used for counting or other operations as SendGrid runs its systems. These fields generally cannot be redacted or removed. You should take care not to place PII in this field. SendGrid does not treat this data as PII, and its value may be visible to SendGrid employees, stored long-term, and may continue to be stored after you’ve left SendGrid’s platform.

The SMTP API JSON string allows you to attach an unlimited number of unique arguments to your email up to 10,000 bytes. The arguments are used only for tracking. They can be retrieved through the Event API or the Email Activity page.

When passing unique_args please make sure to only use strings as shown in our examples. Any other type could result in unintended behavior.

These arguments can be added using a JSON string like this:

{
  "unique_args": {
    "customerAccountNumber": "55555",
    "activationAttempt": "1",
    "New Argument 1": "New Value 1",
    "New Argument 2": "New Value 2",
    "New Argument 3": "New Value 3",
    "New Argument 4": "New Value 4"
  }
}

These arguments can then be seen in posts from the SendGrid Event Webhook. The contents of one of these POST requests would look something like this:

Example Webhook Post Data

{
  "sg_message_id": "145cea24eb8.1c420.57425.filter-132.3382.5368192A3.0",
  "New Argument 1": "New Value 1",
  "event": "processed",
  "New Argument 4": "New Value 4",
  "email": "useexampexample@example.com",
  "email": "example@example.com",
  "smtp-id": "<145cea24eb8.1c420.57425@localhost.localdomain>",
  "timestamp": 1399331116,
  "New Argument 2": "New Value 2",
  "New Argument 3": "New Value 3",
  "customerAccountNumber": "55555",
  "activationAttempt": "1"
}

Bounces returned with the Return-Path cause `uniquergs not to be attached to an event. This can cause issues when developing uniqueargs POST handling.

To apply different unique arguments to individual emails, you may use substitution tags. An example of this would look like:

{
  "sub": {
    "-account_number-": ["314159", "271828"]
  },
  "unique_args": {
    "customerAccountNumber": "-account_number-"
  }
}

Additional Resources

See a mistake? Edit this page