Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Routines and triggers

Make a routine

Gives a teammate a routine to do by itself on some days of the week: once at a time, or every so many minutes from a time (every). With cron in the place of days, the routine runs on that cron expression. Each run's answer is posted to the routine's own conversation, unless notify is false. Every run uses the organization's AI plan, so this needs an owner or admin, and a routine may not run more often than the teammate's daily run limit allows.

post/api/v1/routines

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 routines create
MCP tooltroopy_create_routine
Rate limit20 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
agent*string

The teammate's handle, like chief

At most 40 characters

name*string

At least 1 characters · At most 60 characters

task*string

What to do each time, as you'd tell the teammate

At least 1 characters · At most 1000 characters

daysarray<integer>

Days of the week it runs on, 0 is Sunday. Send days, or cron

At most 7 items

hourinteger

When it runs, or when it starts repeating (with every)

Default 0 · At least 0 · At most 23

minuteinteger

Default 0 · At least 0 · At most 59

everyinteger | null

Minutes between runs, from hour:minute to the end of each of its days (15, 30, 60, 120, 180, 240, 360 or 720). Null runs it once a day, at hour:minute

Default null

cronstring | null

A cron expression of five fields (minute, hour, day of the month, month, day of the week), like 0 7 * * 1, in the time zone of the routine. It takes numbers, *, lists, ranges and steps. Send it in the place of days, hour, minute and every. Null for a routine with days and a time

Default null

timezonestring

The time zone of its times, like Europe/Berlin. Without it, the time zone of the workspace

At most 64 characters

notifyboolean

Post each result to the routine's conversation (true), or run quietly (false)

Default true

Response

201 · application/json
data*object
18 properties
id*string

A 24-character id

agent*string
name*string
task*string
days*array<integer>

Days of the week it runs on, 0 is Sunday. Empty for a routine on a cron expression

hour*integer
minute*integer
every*integer | null

Minutes between runs within a day; null runs once a day, at hour:minute

cron*string | null

Its cron expression, in its time zone. Then days, hour, minute and every say nothing. Null for a routine with days and a time

timezone*string
notify*boolean

Whether each result is posted to the routine's conversation. A quiet routine keeps its results in its runs only

paused*boolean
nextRunAt*string | null
lastRunAt*string | null
lastRunId*string | null
lastError*string | null

Why the last time couldn't start

threadId*string | null

The conversation each run's answer is posted to

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.
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.