Bot policy, team rules and setup scripts
Developer·6 minutes to read
What it does
How an administrator runs the team's bots, each through the same engine as its screen:
- The bot policy (Organisation → Policies): whether bots are on for the team, what they may do, how the automatic reviewer works, who may use them and where their computers may connect.
- Team rules (Organisation → Rules): standing instructions every member's bot reads on the surfaces each rule names.
- Setup scripts (Organisation → Setup): what every member's computer runs when it starts. A change runs only once a second administrator approves it.
Organisation secrets have no route: they are set on the dashboard only.
Authentication
A read key reads GET /policy/bots, GET /rules and GET /setup-scripts. Every other call needs an admin key from a current owner or admin; a read or write key on one of them is 401.
Request
Bot policy
GET /api/v1/policy/bots— the whole policy:enabled— off, no member starts a run; their computers, bots and history are kept.capabilities—templateSharing(off,teamorpublic),actionRecording,localExecutionCeiling(the most any member's desktop may allow:always_allow,ask_every_timeornever_allow; a member's own choice is kept and applies again when the limit is lifted) anddelegation(whether a bot may hand coding work to a connected coding tool).approvalReview—enforced(the automatic reviewer runs for Team Bots wherever they run) and the reviewer'sallowandblockinstructions.access—mode(allmembers, or chosengroups) andgroupIds. A member outside the chosen groups is refused when a run starts.network—mode(unset,allow_all,default_with_network_settingsornetwork_settings_only) andallowlist, the organisation's own destinations. Change the allowlist through/organisation/egress-entries.network.lockedis alwaystrue: members never change the network setting in this product, only an administrator does.
PATCH /api/v1/policy/bots— any of the fields above; inside an object, any of its fields.allowandblock(up to 20 each, 500 characters each) andgroupIdsreplace the stored list. TurningactionRecordingon needsactionRecordingAcknowledgement: true, the workforce notice;network.mode: "allow_all"needs a non-blanknetwork.acknowledgement.network.locked: trueis accepted and changes nothing;network.locked: falseis refused with 400invalid_requestnamingnetwork.locked, and nothing in that request is written. An unknown group refuses the whole request before anything is written. Answers the policy asGETdoes.
curl -sS "$BOTSEON_API_URL/api/v1/policy/bots" \
-H "authorization: Bearer $BOTSEON_API_KEY" \
-H "accept: application/json"
Team rules
GET /api/v1/rules—limit(1–200, default 50) andcursor, newest first. Each rule:id,content,surfaces(chat,computer,routines,channels),enabled,createdAt,updatedAt.POST /api/v1/rules— body{ "content": "Answer in British English." }(1–500 characters), optionallysurfaces(every surface by default) andenabled(on by default). Needs anIdempotency-Key. An organisation keeps at most 20 rules.PATCH /api/v1/rules/{id}— any ofcontent,surfacesandenabled.DELETE /api/v1/rules/{id}— answers the rule it removed.
An id that is not a live rule of this organisation is 404. A rule reaches each member's next run.
Setup scripts
GET /api/v1/setup-scripts—data, the approved scripts (name,setup,check), the approvedversion, andpending, the change waiting for a second administrator (nullwhen there is none).PUT /api/v1/setup-scripts/{name}— create or replace one script.{name}is lowercase letters and digits joined by hyphens, up to 64 characters. Body{ "setup": "…", "check": "…" }:setupup to 32 KB;check, optional, up to 4 KB — when it exits 0,setupis skipped. A script that carries a secret is refused.DELETE /api/v1/setup-scripts/{name}— remove one script; a name the approved scripts do not hold is404.POST /api/v1/setup-script-proposals/{id}/decision— body{ "decision": "approved" }or"rejected". The administrator who proposed a change may withdraw it but not approve it. Answers the scripts asGETdoes.
PUT and DELETE answer 202 with the proposal (id, version, proposedBy, proposedAt, scripts as they would be). Once approved, every member's computer runs the scripts at its next start. One change waits at a time.
Response
GET /api/v1/policy/bots:
{
"enabled": true,
"capabilities": {
"templateSharing": "team",
"actionRecording": false,
"localExecutionCeiling": "ask_every_time",
"delegation": true
},
"approvalReview": {
"enforced": true,
"allow": ["Reading files in the repository"],
"block": ["Sending email outside the company"]
},
"access": { "mode": "groups", "groupIds": ["6f1e2d3c-4b5a-4968-8776-655443322110"] },
"network": { "mode": "default_with_network_settings", "allowlist": ["registry.npmjs.org"], "locked": true }
}
Mapping from the source product's admin API
| The source product | Botseon |
|---|---|
| Turn bots on or off for the team | PATCH /policy/bots enabled |
| Capabilities: template sharing, action recording, local execution ceiling | capabilities.templateSharing, .actionRecording (with .actionRecordingAcknowledgement), .localExecutionCeiling; .delegation as well |
| Enforced approval review, its allow and block instructions | approvalReview.enforced, .allow, .block |
| Who may use bots: everyone or chosen groups | access.mode, access.groupIds |
| Network policy | network.mode (with network.acknowledgement); the allowlist through /organisation/egress-entries |
Network policy locked | network.locked, always true; false is a 400 |
| Team rules: list, create, update, delete | GET/POST /rules, PATCH/DELETE /rules/{id} |
| Setup scripts: list, upsert, delete | GET /setup-scripts, PUT/DELETE /setup-scripts/{name}, approved through POST /setup-script-proposals/{id}/decision |
| Team secrets | Dashboard only, as in the source product |
Errors
| Status | Code | When | What to do |
|---|---|---|---|
| 400 | invalid_request | A malformed body, an empty patch, action recording without the acknowledgement, allow_all without one, network.locked: false, over 20 instructions of a kind, an unknown group, a rule over 500 characters, a script name that is not a slug, a script with a secret in it. | Read details. |
| 401 | unauthenticated | The key is missing or refused, a read or write key on a write, or an admin key whose creator is no longer an admin. | Use an admin key from a current admin. |
| 403 | forbidden | Template sharing, group access or enforced review on a personal organisation; approving your own setup change. | Ask a second administrator. |
| 404 | not_found | No such rule, script or pending change. | List first. |
| 409 | conflict | A 21st rule; a setup change while another waits; a change already decided. | Decide the waiting change first. |
Rate limits
The same buckets as every other route. See Envelopes, errors, idempotency and paging.
Last verified against build 4afda7a.