List top-performing letters
const url = 'https://api.tryletterhead.com/api/v3/letters/metrics/top-performers?api=true&metric=openRate';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.tryletterhead.com/api/v3/letters/metrics/top-performers?api=true&metric=openRate' \ --header 'Authorization: Bearer <token>'Returns your companyβs letters ranked by open rate or click-to-open rate, best first. As a v3 endpoint, it requires a company-derived API key.
By default the ranking covers a rolling 90-day window. To rank a specific period instead, pass both from and to (YYYY-MM-DD); passing only one of them is rejected, and to cannot be earlier than from.
Use channels[] to restrict the ranking to specific channels. Each item includes uniqueId, title, channel, organization, publicationDate, editionUrl, and the counts behind the ranking (delivered, opens, opensUnique, clicks, clicksUnique).
Authorizations
Section titled βAuthorizations βParameters
Section titled β Parameters βQuery Parameters
Section titled βQuery Parameters βWhen set to true, this endpoint will accept authorization with your API Key.
The rate to rank by. Defaults to openRate.
Channel slugs to restrict the ranking to. Repeat the parameter for more than one channel.
Start of the period to rank (YYYY-MM-DD). Must be sent together with to.
End of the period to rank (YYYY-MM-DD). Must be sent together with from.
Responses
Section titled β Responses βTop-performing letters
object
object
Example generated
{ "items": [ { "uniqueId": "example", "title": "example", "channel": "example", "organization": "example", "publicationDate": "example", "editionUrl": "example", "delivered": 1, "opens": 1, "opensUnique": 1, "clicks": 1, "clicksUnique": 1 } ], "message": "example", "total": 1}Still can’t find what you need? Contact support.