Menu

Marketing Campaign Stats

The Marketing Campaigns Stats endpoints allow you to retrieve stats for both Automations and Single Sends.

Note: These endpoints provide stats for Marketing Campaigns only. For stats related to event tracking, please see the Stats section under Event Tracking below.

Get Single Send Click Tracking Stats by ID

Get Single Send Click Tracking Stats by ID

GET /marketing/stats/singlesends/{id}/links

This endpoint lets you retrieve click-tracking stats for one Single Send.

The stats returned list the URLs embedded in the specified Single Send and the number of clicks each one received.

Responses are paginated. You can limit the number of responses returned per batch using the page_size query string parameter. The default is 50, but you specify a value between 1 and 100.

You can retrieve a specific page of responses with the page_token query string parameter.

Authentication

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required

Path Parameters

id
string
required

Query String

page_size
integer

number of results to return

default: 100minimum: 0
page_token
string

token corresponding to a specific page of results, as provided by metadata

group_by
array

A/B Single Sends have multiple variation IDs and phase IDs. Including these additional fields allows further granularity of stats by these fields.

ab_variation_id
string
format: uuid
ab_phase_id
string
Allowed Values: test, send

Responses

object
results
array[object]

This is the index of the link's location in the email contents.

required
url
string

This is the URL of the link clicked. If {{custom_fields}} are part of the URL, they will be included.

format: uri
url_location
integer

This is the location of the link clicked in each Single Send A/B variation, or in the Single Send itself if there are no variations. Links are numbered from the top down; the topmost link is index 0.

minimum: 0
ab_variation
string

This is the A/B variation of the Single Send stat returned. It is set to "all" if the ab_variation query parameter was not set in the request and group_by doesn't contain ab_variation.

format: uuid
ab_phase
string

This is the A/B phase of the Single Send stat returned. If the ab_phase query parameter was not provided, it will return "all".

Allowed Values: send, test, all
clicks
integer

the number of clicks on this particular link

minimum: 1
_metadata
object
required
prev
string

The URL of the previous page of results. If this field isn't present, you're at the start of the list.

format: uri
self
string

The URL of the current page of results.

format: uri
next
string

The URL of the next page of results. If this field isn't present, you're at the end of the list.

format: uri
count
number

The number of items in the entire list, i.e., across all pages.

total_clicks
integer
object
errors
array[object]
message
string

the error message

field
string

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.