Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Computer

Connect the AI plan

Signs one of the organization's AI plans in on the workspace's computer. Plans with method api_key take apiKey, which Troopy checks with the provider and stores only on the computer. Plans with method device_code take nothing and answer with a userCode to approve at verificationUrl; poll GET /ai-plans until the plan is connected. Plans with method paste_code take nothing and answer with a verificationUrl to sign in at; call again with the code the provider shows there. Needs a launched computer and an owner or admin.

post/api/v1/computer/connection

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 ai connect
MCP tooltroopy_connect_ai
Rate limit10 calls in 60 seconds, for each key

Body

application/json
apiKeystring

The plan's API key, for plans whose method is api_key

codestring

The code the provider showed after signing in at verificationUrl, for plans whose method is paste_code

planstring

Which of the organization's AI plans to connect, by id. The default plan when left out

Response

200 · application/json
data*object
11 properties
provider*enum<string> | null

claudechatgptgeminigrokcopilotopenrouterzaikimiminimaxqwenanthropicopenaicursor

method*enum<string> | null

How the plan signs in: an API key; a code to approve on the provider's site (device_code); or signing in at the provider's site and pasting back the code it shows (paste_code). Null when Troopy can't connect the plan yet

api_keydevice_codepaste_code

status*enum<string>

pending: waiting for someone to approve userCode at verificationUrl (device_code), or to sign in at verificationUrl and send the code back (paste_code)

nonependingconnectedfailed

userCode*string | null

The code to enter at verificationUrl. Shown to owners and admins only

verificationUrl*string | null
expiresAt*string | null

When userCode stops working

keyHint*string | null

The last four characters of the API key in use

connectedAt*string | null
error*string | null

Why the last attempt failed, in words to show people

limitedUntil*string | null

Out of usage until then: teammates use the next plan down the list meanwhile

lapsedAt*string | null

Since when the sign-in lapsed and the plan's CLI couldn't renew it. Sign the plan in again (POST /computer/connection). Null while the sign-in is fresh

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.