From a0e07ca74d5a92f983b5fa77ec1679bc7a3d3d9f Mon Sep 17 00:00:00 2001 From: Andrew Tongen Date: Fri, 13 Nov 2026 15:27:33 -0600 Subject: [PATCH] Document link metrics and who-clicked endpoints - Link Metrics: the response for one email's clicks broken down by link. Each link has an opaque key, a type (url, trigger or system), unique and total clicks, share_of_clicks (what the email dashboard shows) and click_rate (unique clicks over sends) - Fetch link metrics: GET /v2/:account_id/metrics/email/links, by broadcast_id (the broadcast and its variations) or email_id (any email from email metrics, including Workflow and Email Series Campaign emails); activity and sent bases; owner time zone dates; 366-day range; at most 1,000 links, with links_total and links_truncated - List the subscribers who clicked a link: GET /v2/:account_id/metrics/email/links/subscribers, by link key, with total_count, active_count and cursor paging (limit up to 1,000) - Both endpoints share a 60 requests per account per hour limit, separate from email metrics; cached results do not count - Metrics intro points to Link Metrics --- source/includes/rest/_metrics.md | 478 +++++++++++++++++++++++++++++++ 1 file changed, 478 insertions(+) diff --git a/source/includes/rest/_metrics.md b/source/includes/rest/_metrics.md index 1038b93ba0d..9d8cfd0c451 100644 --- a/source/includes/rest/_metrics.md +++ b/source/includes/rest/_metrics.md @@ -2,6 +2,8 @@ The Metrics API returns aggregate email performance for an account: sends, deliveries, opens, clicks, bot clicks, unsubscribes, hard and soft bounces, complaints, orders, and revenue. +[Link metrics](#link-metrics) break one email's clicks down by link, and list the subscribers who +clicked each one. Results cover Single-Email Campaigns, Email Series Campaigns, and automation emails sent by Workflows. Confirmation emails (double opt-in) are excluded. Order and revenue values are @@ -421,3 +423,479 @@ applied per account. + +## Link Metrics + +> A link metrics response looks like this: + +```json +{ + "broadcast_id": "123456", + "email_ids": [4455661, 4455662], + "start_date": "2026-10-01", + "end_date": "2026-10-31", + "basis": "activity", + "sends": 1000, + "links_total": 3, + "links_truncated": false, + "links": [ + { + "key": "url:https://example.com/sale", + "type": "url", + "url": "https://example.com/sale", + "unique_clicks": 60, + "total_clicks": 90, + "share_of_clicks": 0.6, + "click_rate": 0.06 + }, + { + "key": "trigger:rule:789012", + "type": "trigger", + "url": "https://example.com/offer", + "trigger": { + "type": "rule", + "name": "Tag buyers" + }, + "unique_clicks": 30, + "total_clicks": 30, + "share_of_clicks": 0.3, + "click_rate": 0.03 + }, + { + "key": "system:unsubscribe", + "type": "system", + "label": "Unsubscribe Link", + "unique_clicks": 10, + "total_clicks": 10, + "share_of_clicks": 0.1, + "click_rate": 0.01 + } + ] +} +``` + +Link metrics break one email's clicks down by link: the same counts the email dashboard's link +list shows. Bot clicks are excluded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescription
broadcast_idThe requested Single-Email Campaign id. Only present when the request includes broadcast_id.
email_idThe requested email id. Only present when the request includes email_id.
email_idsThe ids of the emails the counts cover. A Single-Email Campaign covers its email and each of its variations.
start_dateThe first day of the range, after defaults are applied.
end_dateThe last day of the range, after defaults are applied.
basisactivity or sent. See Fetch link metrics.
sendsThe number of the email's sends in the range, delivered or not. Matches sends in email metrics, not deliveries.
links_totalThe number of links clicked in the range.
links_truncatedtrue when more links were clicked than links lists.
linksUp to 1,000 clicked links, most unique clicks first.
+ +Each entry in `links` has: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
keyAn opaque identifier for the link. Pass it to List the subscribers who clicked a link. Do not parse it.
typeurl for a plain link, trigger for a trigger link, or system for a link Drip adds: Unsubscribe, View In Browser, and View Subscriptions.
urlThe link's destination. Present for url and trigger links.
labelThe name of a system link, such as Unsubscribe Link. Present for system links only.
triggerAn object with the type (rule or workflow) and name of the rule or workflow the link triggers. Present for trigger links only.
unique_clicksThe number of sends with at least one click on the link. One recipient can click several links, so unique clicks do not add up to the email's click count.
total_clicksThe number of clicks on the link, counting repeat clicks by the same recipient.
share_of_clicksunique_clicks divided by the sum of unique_clicks across the listed links, as the email dashboard shows it.
click_rateunique_clicks divided by sends.
+ +Rates are rounded to four decimal places. + +## Fetch link metrics + +> To fetch link metrics for a Single-Email Campaign: + +```shell +curl "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links?broadcast_id=BROADCAST_ID" \ + -H 'User-Agent: Your App Name (www.yourapp.com)' \ + -u YOUR_API_KEY: +``` + +```ruby +require "net/http" +require "json" + +uri = URI("https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links") +uri.query = URI.encode_www_form("broadcast_id" => "BROADCAST_ID") + +request = Net::HTTP::Get.new(uri) +request.basic_auth("YOUR_API_KEY", "") +request["User-Agent"] = "Your App Name (www.yourapp.com)" + +response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) +end + +puts response.body +``` + +```javascript +const params = new URLSearchParams({ broadcast_id: "BROADCAST_ID" }); + +const response = await fetch( + `https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links?${params}`, + { + headers: { + "User-Agent": "Your App Name (www.yourapp.com)", + "Authorization": "Basic " + Buffer.from("YOUR_API_KEY:").toString("base64") + } + } +); + +const body = await response.json(); +``` + +> The response is a link metrics object. + +> If the email, Single-Email Campaign, or account is not found, responds with a 404 Not Found: + +```json +{ + "errors": [{ + "code": "not_found_error", + "message": "The resource you requested was not found" + }] +} +``` + +> If the rate limit is exceeded, responds with a 429 Too Many Requests and a +> Retry-After header: + +```json +{ + "errors": [{ + "code": "rate_limit_exceeded", + "message": "Rate limit exceeded: at most 60 link metrics requests per account per hour." + }] +} +``` + +Returns clicks per link for one email. Pass exactly one of `broadcast_id` or `email_id`. +`broadcast_id` covers a Single-Email Campaign and its variations. `email_id` takes the +`email_id` that [Fetch email metrics](#fetch-email-metrics) returns, so it also reaches Email +Series Campaign and Workflow emails. + +Dates are whole days in the account owner's time zone. `basis` chooses which clicks count: + +* `activity` (the default, as in the Drip app): clicks that occurred in the range, and sends + created in the range. +* `sent`: sends with a send time in the range, and every click they received, whenever it + occurred. Use `sent` to compare with or combine [email metrics](#fetch-email-metrics). Counts + can still differ slightly, because the two reports detect bots differently. + +Results are cached per email and range, for about 15 minutes when the range ends today and longer +for older ranges. A repeated request returns the cached result. If the report cannot be produced +in time, the endpoint responds with a `503 Service Unavailable`; retry later. + +### Limits + + + + + + + + + + + + + + + + + + +
LimitApplies to
366 daysThe date range, after defaults are applied
1,000 linkslinks in the response; links_total and links_truncated report the rest
+ +Requests with an invalid argument, or a date range over the limit, are rejected with a +`400 Bad Request`. + +### Rate limits + +The two link endpoints share their own rate limit, separate from the standard API rate limit and +from the [email metrics](#fetch-email-metrics) limit. Limits are applied per account. Only +requests that compute a new result count; cached results do not. + + + + + + + + + + + + + + +
LimitWindow
60 requestsPer hour
+ +### HTTP Endpoint + +`GET /v2/:account_id/metrics/email/links` + +### Arguments + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
broadcast_idThe id of a Single-Email Campaign. Required unless email_id is passed; pass one or the other, not both.
email_idAn email_id returned by Fetch email metrics. Required unless broadcast_id is passed.
start_dateOptional. The first day of the range in YYYY-MM-DD format, inclusive. Defaults to the Single-Email Campaign's send date for broadcast_id (at most 366 days before end_date), otherwise to 30 days ago.
end_dateOptional. The last day of the range in YYYY-MM-DD format, inclusive. Defaults to today.
basisOptional. activity or sent. Defaults to activity.
+ +## List the subscribers who clicked a link + +> To list the subscribers who clicked a link: + +```shell +curl -G "https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links/subscribers" \ + --data-urlencode "broadcast_id=BROADCAST_ID" \ + --data-urlencode "key=url:https://example.com/sale" \ + -H 'User-Agent: Your App Name (www.yourapp.com)' \ + -u YOUR_API_KEY: +``` + +```ruby +require "net/http" +require "json" + +uri = URI("https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links/subscribers") +uri.query = URI.encode_www_form( + "broadcast_id" => "BROADCAST_ID", + "key" => "url:https://example.com/sale" +) + +request = Net::HTTP::Get.new(uri) +request.basic_auth("YOUR_API_KEY", "") +request["User-Agent"] = "Your App Name (www.yourapp.com)" + +response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) +end + +puts response.body +``` + +```javascript +const params = new URLSearchParams({ + broadcast_id: "BROADCAST_ID", + key: "url:https://example.com/sale" +}); + +const response = await fetch( + `https://api.getdrip.com/v2/YOUR_ACCOUNT_ID/metrics/email/links/subscribers?${params}`, + { + headers: { + "User-Agent": "Your App Name (www.yourapp.com)", + "Authorization": "Basic " + Buffer.from("YOUR_API_KEY:").toString("base64") + } + } +); + +const body = await response.json(); +``` + +> The response looks like this: + +```json +{ + "key": "url:https://example.com/sale", + "broadcast_id": "123456", + "email_ids": [4455661, 4455662], + "start_date": "2026-10-01", + "end_date": "2026-10-31", + "basis": "activity", + "total_count": 58, + "active_count": 55, + "subscribers": [ + { + "id": "z1togz2hcjrkpp5treip", + "email": "john@acme.com", + "status": "active" + } + ], + "next_cursor": "MTIzNDU2Nzg" +} +``` + +> If the link key is not one of the email's clicked links, responds with a 404 Not Found: + +```json +{ + "errors": [{ + "code": "not_found_error", + "message": "The resource you requested was not found" + }] +} +``` + +Returns the subscribers with at least one non-bot click on one link. Pass the same +`broadcast_id` or `email_id`, dates, and `basis` as the [Fetch link metrics](#fetch-link-metrics) +request that returned the link, and the link's `key`. URL-encode the key: it can contain a URL. + +`total_count` is the number of subscribers who clicked the link, and `active_count` is how many of +them are still active. `subscribers` lists one page of them, in a stable order. +A page holds at most `limit` subscribers and can hold fewer. While more remain, +`next_cursor` is set; pass it as `cursor` to fetch the next page, until `next_cursor` is `null`. + +`unique_clicks` counts sends and `total_count` counts people, so they differ when one subscriber +received the email more than once. The response repeats the window properties of +[link metrics](#link-metrics). + +Every page and every link of the same email and range is served from one cached result, so paging +through a list, or listing several links, counts once against the +link rate limit in [Fetch link metrics](#fetch-link-metrics). If the list cannot be produced in time, the endpoint responds +with a `503 Service Unavailable`; retry later. + +### HTTP Endpoint + +`GET /v2/:account_id/metrics/email/links/subscribers` + +### Arguments + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyDescription
keyRequired. A link key returned by Fetch link metrics.
broadcast_idThe id of a Single-Email Campaign. Required unless email_id is passed; pass one or the other, not both.
email_idAn email_id returned by Fetch email metrics. Required unless broadcast_id is passed.
start_dateOptional. As in Fetch link metrics.
end_dateOptional. As in Fetch link metrics.
basisOptional. As in Fetch link metrics.
limitOptional. The maximum number of subscribers per page, a whole number from 1 to 1,000. Defaults to 100.
cursorOptional. The next_cursor from a previous response, to fetch the next page.