Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Analytics

Get the mentions on X and Reddit

The posts on X and Reddit in the period that name the domain of the site, or the words and handles of its settings. It also gives each X post, or link in the bio of a handle, whose t.co link brought visits in the period. Each has those visitors and their revenue. The most visitors come first, then the newest.

get/api/v1/analytics/mentions

Authorization

HeaderAuthorization: Bearer <API key>
Or the headerX-API-Key: <API key>
API keyMake one in Troopy under Settings > API keys. It acts as you, in its workspace.

Other ways to call it

CLItroopy analytics mentions
MCP tooltroopy_get_analytics_mentions
Rate limit60 calls in 60 seconds, for each key

Query parameters

periodenum<string>

now is the last 10 minutes. 7d and 30d end today. 3m, 6m and 12m are whole months that end with this month. week starts on Monday. custom needs from and to

nowtodayyesterday24h7d30d3m6m12mweekmonthyearallcustom

Default "30d"

fromstring

YYYY-MM-DD, in the workspace's time zone

date

tostring

YYYY-MM-DD. The period includes this day

date

compareenum<string>

Also gives another window: previous is the window just before, with the same length. year is the same days a year before. custom is compare_from to compare_to

previousyearcustom

compare_fromstring

With compare custom: the first day of the other window

date

compare_tostring

With compare custom: the last day of the other window

date

filter_channelstring

channel: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_referrerstring

referrer: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_sourcestring

utm source: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_mediumstring

utm medium: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_campaignstring

utm campaign: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_termstring

utm term: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_contentstring

utm content: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_refstring

ref: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_sourcestring

source: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_viastring

via: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_pagestring

page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_entry_pagestring

entry page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_exit_pagestring

exit page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_hostnamestring

hostname: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_countrystring

country: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_regionstring

region: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_citystring

city: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_languagestring

language: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_browserstring

browser: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_osstring

os: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_devicestring

device: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_screenstring

screen: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_goalstring

goal: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_propertystring

Visitors who sent a goal with a property: op:name=value[,name=value], such as is:plan=pro. The op is one of is, is_not, contains, does_not_contain, matches and does_not_match

At most 500 characters

filter_visit_countstring

Sessions by the visitor's visit number: is:1 (new), gte:2 (returning), lte, is_not

At most 500 characters

limitinteger

Default 50 · At least 1 · At most 200

searchstring

Only posts whose text or author contains these words, any case

At most 100 characters

platformenum<string>

Only the posts of one platform

xreddit

trafficboolean | enum<string>

Only posts whose links brought visits in the period

truefalse

Response

200 · application/json
data*array<object>
9 properties
platform*enum<string>

xreddit

text*string
author*string

@handle on X, u/name on Reddit

url*string | null
at*string | null

When the author posted it. null for a link in a bio

score*integer

Likes on X, upvotes on Reddit

comments*integer
visitors*integer

The visitors in the period from its t.co links. Only X posts have them

revenue*integer

Their revenue, minor units

Errors

400 invalid_inputFix the field named in detail. Each operation's schema is in /api/v1/openapi.json.
401 unauthorizedSend an API key as `Authorization: Bearer tr_live_...`. Create one in Troopy under Settings.
403 forbiddenThe key lacks a scope this operation needs, or its owner lacks the role. detail says which; create a key with the scope, or ask an organization owner or admin.
429 rate_limitedWait the number of seconds in Retry-After, then retry.