Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Surveys

Change a survey, show it or stop it

Changes the name, the questions, who gets the survey and how often. With active true, the survey shows in the product, and the survey that showed before stops. With active false, it stops. A survey with no question cannot show. Send only what changes. Owners and admins only.

patch/api/v1/surveys/{id}

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 surveys set
MCP toolNone. Call it over REST or with the CLI.
Rate limit60 calls in 60 seconds, for each key

Path parameters

id*string

A 24-character id

Body

application/json
namestring

At least 1 characters · At most 80 characters

scoredboolean

Asks how a customer would feel without the product, or leaves that question out

questionsarray<object>

The open questions, whole and in order. It takes the place of the list that the survey has. A question keeps its answers while it keeps its id

At most 5 items

2 properties
idstring

The id of a question that the survey has now. Leave it out for a new question

text*string

At least 5 characters · At most 200 characters

audienceenum<string>

engagedeveryone

againinteger | null

After how many days a customer gets the survey again. Null: one time

activeboolean

true: the survey shows, in the place of the survey that showed. false: it stops

Response

200 · application/json
data*object
14 properties
id*string

A 24-character id

name*string

The name of the survey, for the people of the business. Customers never see it

active*boolean

The survey shows in the product now. One survey of a workspace shows at a time

scored*boolean

The survey asks how a customer would feel without the product. The score comes from this question, and its words are fixed

questions*array<object>

The open questions, in the order that the survey asks them, after the question of the score. A customer can skip each one

2 properties
id*string
text*string

The question, in the words of the business

audience*enum<string>

engaged: the users who know the product, 7 days after they began, with steady use or 3 days of use in the last 30. everyone: each user

engagedeveryone

again*integer | null

After how many days a customer gets the survey again. Null: a customer answers it one time

shown*integer

The customers who saw the survey

answered*integer

The customers who answered it

lastAnswerAt*string | null

When a customer last answered it

score*object | null

The score of this survey, each customer with its latest answer to it. Null when it does not ask that question

8 properties
answers*integer

The answers that count: each answer but no_longer_use

very*integer

Would be very disappointed without the product

somewhat*integer

Would be somewhat disappointed

not*integer

Would not be disappointed

gone*integer

No longer use the product. These are not in the score

love*number | null

The share that would be very disappointed, in percent. Null under 5 answers

low*number | null

The low end of the 95% range of that share, in percent. Null under 10 answers

level*enum<string>

hidden: under 5 answers, so no share. directional: 5 to 9 answers. ranked: 10 or more

hiddendirectionalranked

by*object

Who made it

2 properties
type*string
name*string | null
activatedAt*string | null

When the survey last began to show

createdAt*string

ISO 8601 date and time

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.
404 not_foundCheck the path and any id in it. Every operation is listed in /api/v1/openapi.json.
429 rate_limitedWait the number of seconds in Retry-After, then retry.