HTTP API for scripts
This page is for a script, or an agent that has a shell, calling colabro over HTTP with a personal token. It reads and changes records, uploads and reads files, follows changes and learns about requests. Every route below exists; the machine-readable list of them is /api/v1/openapi.json (see the last section).
An agent connected through MCP (Claude, ChatGPT and so on) does not need this page: the server gives it its instructions and tools when it connects.
The token
- In colabro open “Account” → “Tokens for scripts”, give the token a name, choose its access (“Read only” or “Read and write”) and its term (30 days, 90 days, a year, none) and press “Create token”. Copy it at once: it is shown once and starts with
cpat_. - The token acts for you, never beyond your role in each workspace. In History its edits are signed
agent:pat.<token name>@<you>. A “Read only” token can call only the reading routes; a write with it is 403. - Keep the token in a file only you can read, never in a repository or in the arguments of a command:
install -m 600 /dev/null ~/.config/colab-token # then paste the token into it, one line
export COLAB_URL=https://colabro.app
export COLAB_TOKEN="$(cat ~/.config/colab-token)"
curl -sS -H "Authorization: Bearer $COLAB_TOKEN" "$COLAB_URL/api/v1/me"
The answer names the actor and the permissions of the token: {"actor":"agent:pat.script@you","permissions":["read","write","schema","revert","views"],…}. Add ?ws=<workspace> and it also gives your role there. Without a token, or with a revoked or expired one, the answer is 401. The examples below take COLAB_URL and COLAB_TOKEN from the environment; every route is under /api/v1.
Reading
H="Authorization: Bearer $COLAB_TOKEN"
curl -sS -H "$H" "$COLAB_URL/api/v1/workspaces" # your workspaces and roles
curl -sS -H "$H" "$COLAB_URL/api/v1/workspaces/tasks" # schema, views, schema_rev, view_rev, limits
curl -sS -H "$H" "$COLAB_URL/api/v1/workspaces/tasks/objects/t1" # one object
curl -sS -H "$H" -G "$COLAB_URL/api/v1/workspaces/tasks/objects" \
--data-urlencode type=task --data-urlencode 'where={"status":"next"}' --data-urlencode limit=50
curl -sS -H "$H" -G "$COLAB_URL/api/v1/workspaces/tasks/objects" --data-urlencode text=cable # full-text search
curl -sS -H "$H" "$COLAB_URL/api/v1/workspaces/tasks/state" # everything (use it on small workspaces)
- An object is
{id, type, data, rev, created_at, created_by, updated_at, updated_by}.revis the number that you read (the revision of the workspace at the last change of that object, so it grows, but not by one): the next write names it asexpected_rev. The1in the examples below is therevof an object in a new, empty workspace; use the one you read. GET …/objectstakestype(required withouttext),where(a JSON object; a list of values matches any of them),limitandcursor: passnext_cursorof the answer ascursoruntil it isnull. Withtextthe answer is one page of the most relevant, withmore, and no cursor.GET …/objects/<id>?refs=inalso lists the objects that point at this one.- The workspace, the objects and the state come with an
ETag: send it back asIf-None-Matchand an unchanged answer is304with no body. GET …/changes?since_rev=<n>is the journal after a revision: the change sets with before and after of every object.mode=summarygives a short summary per object instead;exclude_actorleaves out one actor. Withoutsince_revthe call reads after the cursor kept for your token and moves it to the end (peek=truedoes not move it).POST …/validatechecks the stored state against the schema and rules and writes nothing:{"issues":[…]}.
Writing and conflicts
All writes of records go through one route, POST /api/v1/workspaces/<ws>/changes: a change set of one or more operations, applied all or nothing.
# create (the id is yours, or the server makes one)
curl -sS -X POST -H "$H" -H "Content-Type: application/json" -H "Idempotency-Key: $(cat /proc/sys/kernel/random/uuid 2>/dev/null || uuidgen)" \
"$COLAB_URL/api/v1/workspaces/tasks/changes" \
-d '{"comment":"New task","ops":[{"op":"create","type":"task","id":"t1","data":{"title":"Order cable","status":"inbox"}}]}'
# → {"rev":1,"change_set_id":"…","warnings":[]}
# update: expected_rev is the rev you read (1 only in a new workspace)
curl -sS -X POST -H "$H" -H "Content-Type: application/json" \
"$COLAB_URL/api/v1/workspaces/tasks/changes" \
-d '{"comment":"Start","ops":[{"op":"update","id":"t1","expected_rev":1,"patch":{"status":"doing"}}]}'
- Operations:
create(type,data),update(patch: JSON Merge Patch,nullremoves a field),replace(the wholedata) anddelete. A long text can be edited by pieces:"text_edits":{"notes":[{"old":"…","new":"…"}]}—oldmust occur once, and an edit elsewhere in the text is no conflict.commentis shown in History. update,replaceanddeleteneedexpected_rev— therevof the object as you read it. Without it the whole set is refused with422and nothing is written.createneeds none.- If somebody changed the object after your read, but not the fields of your
patch, the update goes through (merged by fields). If they changed one of those fields:409 conflict(only a change by another participant or another token counts: your own token changing the same field again after your read is merged, not a conflict) andconflicts[].fields— for each fieldfield,current,yours,updated_byandupdated_at. Read the object again, decide and send it again with the newrev. Areplaceordeleteof a changed object is always 409. Idempotency-Key(any unique string of 8 to 64 characters of letters, digits,_and-) makes a repeat after a lost answer safe: the same key with the same set returns the first answer with"replayed":true; with another set,422. A key is remembered for 24 hours.- A write that breaks the schema or a rule is
422 invalid;errorssays where:op_index,object_id,path,message. - A token with the “Read only” access, and a viewer, get 403 on a write. At most 1000 operations in a set, 256 KiB per object and a body of 1 MiB by default; the limits that apply to a workspace are in
limitsofGET /workspaces/<ws>. - Undo:
POST …/changes/<change_set_id>/revert(an object of the set changed after it is a 409). The id of a change set isidinGET …/changesandchange_set_idin the answer of a write: the same value. The schema and the views are written withPUT …/schemaandPUT …/viewswithbase_revequal toschema_revorview_revof the workspace, not itsrev. - Creating a workspace is
POST /api/v1/workspaceswith{"id","title","schema","view"}; deleting it isDELETE …/workspaces/<ws>with{"confirm":"<ws>"}(an owner only).
Files
A file is uploaded to a workspace, then attached to a record. First look whether files work on this server and what the limits are:
curl -sS -H "$H" "$COLAB_URL/api/v1/workspaces/docs/files"
# → {"enabled":true,"file_bytes":26214400,"files_bytes_per_user":…,"used_bytes":…,"accept":".jpg,.png,…","retention_days":30,…}
1. Upload. The body is the file itself; the name goes into ?name=:
curl -sS -X POST -H "$H" -H "Content-Type: application/octet-stream" \
--data-binary @photo.jpg "$COLAB_URL/api/v1/workspaces/docs/files?name=photo.jpg"
# → 201 {"id":"01J…","name":"photo.jpg","size":48211,"type":"image/jpeg","uploaded_at":"…","uploaded_by":"…"}
Use --data-binary, not -d (it would strip line breaks), and send the file whole with Content-Length (curl does): a body in chunks is 411. The type is decided by the first bytes of the file, not by its name: photos (JPEG, PNG, WebP, HEIC), PDF, text and CSV, Office and OpenDocument documents, sound (MP3, OGG/Opus, WAV, M4A/AAC, FLAC). SVG, HTML and other markup are refused: 415 unsupported_file_type. A file is at most 25 MB by default (file_bytes above), and the files of an owner at most 1 GB together (quota_exceeded, 403). Without a storage on the server: 503 files_not_configured.
2. Attach. The type of the record has a field that holds files: an array with "x-editor":"files" in its schema (at most 100 items). Put the item from the answer of the upload into it with an ordinary write; an array is replaced as a whole, so send the old items too:
curl -sS -X POST -H "$H" -H "Content-Type: application/json" "$COLAB_URL/api/v1/workspaces/docs/changes" \
-d '{"comment":"Photo","ops":[{"op":"update","id":"d1","expected_rev":3,"patch":{"files":[{"id":"01J…","name":"photo.jpg","size":48211,"type":"image/jpeg"}]}}]}'
A file that is not attached to any record within 24 hours is removed, and until then only the one who uploaded it can read it. A file removed from a record, or its record deleted, stays 30 days: a revert brings it back.
3. Read.
curl -sS -H "$H" -o photo.jpg "$COLAB_URL/api/v1/workspaces/docs/files/01J…" # the whole file
curl -sS -H "$H" -H "Range: bytes=0-1023" -o part.bin "$COLAB_URL/api/v1/workspaces/docs/files/01J…" # 206, the first KiB
- Who may read: anyone who can read the workspace, and only a file that a live record names (or your own upload not yet attached): otherwise
404. A removed one is410 file_gone. Range: one range,bytes=a-b,bytes=a-orbytes=-n, is206withContent-Range; a range past the end is416; several ranges, or a header that does not parse, give the whole file with200. Sound players and resuming a download need this. The answers carryAccept-Ranges: bytes.ETagis the id of the file (a file never changes):If-None-Matchgives304.- Photos, PDF and sound are served inline, everything else as an attachment;
?download=1makes any of them a download. The name is inContent-Disposition.
Events
curl -sS -N -H "$H" "$COLAB_URL/api/v1/workspaces/tasks/events"
A stream of Server-Sent Events. event: change follows every commit with {"rev":…,"change_set_id":"…","actor":"…"}; its id: is the revision. event: thread says that a message of a discussion was posted, edited or deleted (ids only). event: reconnect with {"delay_ms":…} says that the server is restarting: come back after that time. A : ping comment comes every 25 seconds.
There is no replay: after any break, read GET …/changes?since_rev=<the last rev you saw> first, then listen again. At most 20 streams are open at once for a person; over that, 429 with quota equal to sse_streams_per_user.
Requests to the agent
A request is a task that you set to your own agent in colabro, in the browser. A script can only look at them and learn that there is work; setting, taking and finishing a request are not routes of this API (an agent takes and finishes requests through its MCP connection).
- Look:
GET /api/v1/requests(yours across workspaces;ws,status,limit),GET …/workspaces/<ws>/requestsand…/requests/<id>. - Wait without MCP:
GET /api/v1/me/requests/wait?since=<cursor>&timeout=50is held until a request opens or the time runs out (25 to 55 seconds) and answers ids and numbers, never a text, with the nextcursor.GET /api/v1/me/requests/pendinganswers at once with the number of open requests. They take a wake tokencwak_…, made in the browser under “Account” → “Poller for the agent”, not a personal token (that is 403). One wait per token, a new wait no more often than every 2 seconds. - The ready script poller.mjs does the waiting and starts your command on new requests; see “Requests to your agent and the poller”.
- Besides that, a token can read and write discussions (
…/threads/messages): a message of a token is an ordinary message, it never becomes a request.
Errors and limits
An error is JSON {"error":"code","message":"a sentence in English"}, sometimes with more fields. Go by the status and the error code, not by the words.
| Status | What it means |
|---|---|
400 bad_request | A parameter or the body does not parse. |
401 unauthorized | No token, a wrong, expired or revoked one. |
403 forbidden, quota_exceeded | The token or your role lacks the right; or a quota is reached (quota, limit, used): a retry does not help. |
404 not_found | No such thing, or a workspace you are not a member of (the two look the same). |
409 conflict | Somebody changed what you write over (conflicts), or a workspace with that id exists. A taken id of a record is 422 invalid. |
410 file_gone | The file was removed after its window. |
| 411, 413, 415, 416 | A file without Content-Length; a body that is too large; a wrong media type or file type; a range outside the file. |
422 invalid | The data does not fit the schema or a rule, or expected_rev is missing; errors lists where. |
429 too_many_requests | A budget is used up. Wait Retry-After seconds (also retry_after in the body) and repeat; quota names the budget. |
| 502, 503 | The file storage did not answer; or the server has no file storage. |
Writes have budgets of their own, by default 120 change sets and 5000 operations a minute per person (all tokens and sessions together) and 300 change sets a minute per workspace: over them, 429 as well. The budget of requests is 600 a minute per person by default, one for the API and MCP together; the administrator of the server may change it. So batch operations into one change set and read less often (If-None-Match costs nothing but a 304). Network errors and 5xx are worth retrying with growing pauses; with Idempotency-Key a repeated write is safe.
The OpenAPI description
/api/v1/openapi.json is the description of every route a token can call, in OpenAPI 3.1: parameters, bodies, answers, statuses. It needs no token, carries an ETag, and its servers names this server. Feed it to a client generator or to your agent. The account, the administration and the sign-in of the web interface are not in it.
For agents that read sites, /llms.txt in the format of llmstxt.org points to this page, to the description and to MCP.