Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Sessions

Change the settings of Sessions

Turns Sessions on or off, and changes how it looks. Send only what changes. With the source troopy, Sessions turns on only when the workspace has its site in Analytics. With posthog, it needs PostHog connected with a key that can read its session recordings: the switch reads them one time. The first look comes within a minute. Each look is one run of the Product analyst, or else the lead, on the AI plan of the workspace. Owners and admins.

patch/api/v1/session-settings

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 sessions update-settings
MCP toolNone. Call it over REST or with the CLI.
Rate limit30 calls in 60 seconds, for each key
RetriesSend an Idempotency-Key header. A retry with the same key gets the first answer back, and the operation runs one time.

Body

application/json
onboolean

Whether Troopy looks at the new sessions on a schedule

sourceenum<string>

Where Troopy reads the sessions. troopy: the events of Troopy's own script on the site, as Analytics has it. posthog: the session recordings of the PostHog that the workspace connected

troopyposthog

everyHoursinteger

How often Troopy looks, in hours: 3, 6, 12 or 24. Each look reads the sessions since the look before

maxSessionsinteger

How many sessions a teammate reads in one look, the busiest first

At least 1 · At most 20

countriesarray<string>

Only sessions from these countries, as ISO codes like US. Empty: every country

At most 60 items

skipPathsarray<string>

Leave out a session when each page that it viewed is under one of these paths, like /tools

At most 20 items

replaysboolean

Whether the script records a share of the visits as session replays, with every typed field masked. It needs the site of Analytics. Put the new tag on the site after a change

replaySamplenumber

The share of visits that the script records, 0.01 to 1

At least 0.01 · At most 1

replayTextenum<string>

masked: the recorder hides the words of every element as stars. shown: the words show, and each typed field stays masked. Put the new tag on the site after a change

maskedshown

replayConsentboolean

Whether the recorder waits for the consent of the visitor. The page calls troopy("consent", true) after a yes, and troopy("consent", false) stops it. Put the new tag on the site after a change

ticketsenum<string>

off: a person makes each bug ticket. high: Troopy makes a bug ticket for each new high or critical problem, 3 a day at most

offhigh

repostring | null

The GitHub repo that each bug ticket of Sessions changes, as owner/name. Null: the Engineer picks the repo

branchstring | null

The branch that the work of each bug ticket of Sessions starts from, and that its pull request goes into, like staging. Null: the default branch of the repo. A ticket keeps the branch that was set when Troopy made it

Response

200 · application/json
data*object
13 properties
on*boolean

Whether Troopy looks at the new sessions on a schedule

source*enum<string>

Where Troopy reads the sessions. troopy: the events of Troopy's own script on the site, as Analytics has it. posthog: the session recordings of the PostHog that the workspace connected

troopyposthog

everyHours*integer

How often Troopy looks, in hours: 3, 6, 12 or 24. Each look reads the sessions since the look before

maxSessions*integer

How many sessions a teammate reads in one look, the busiest first

At least 1 · At most 20

countries*array<string>

Only sessions from these countries, as ISO codes like US. Empty: every country

At most 60 items

skipPaths*array<string>

Leave out a session when each page that it viewed is under one of these paths, like /tools

At most 20 items

replays*boolean

Whether the script records a share of the visits as session replays, with every typed field masked. It needs the site of Analytics. Put the new tag on the site after a change

replaySample*number

The share of visits that the script records, 0.01 to 1

At least 0.01 · At most 1

replayText*enum<string>

masked: the recorder hides the words of every element as stars. shown: the words show, and each typed field stays masked. Put the new tag on the site after a change

maskedshown

replayConsent*boolean

Whether the recorder waits for the consent of the visitor. The page calls troopy("consent", true) after a yes, and troopy("consent", false) stops it. Put the new tag on the site after a change

tickets*enum<string>

off: a person makes each bug ticket. high: Troopy makes a bug ticket for each new high or critical problem, 3 a day at most

offhigh

repo*string | null

The GitHub repo that each bug ticket of Sessions changes, as owner/name. Null: the Engineer picks the repo

branch*string | null

The branch that the work of each bug ticket of Sessions starts from, and that its pull request goes into, like staging. Null: the default branch of the repo. A ticket keeps the branch that was set when Troopy made it

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.
409 conflictThis Idempotency-Key was used for a different request, or that request is still running. Use a new key for a new request.
429 rate_limitedWait the number of seconds in Retry-After, then retry.