clankie

API

Extension routes

Routes the Discord, voice, computer, media and browser extensions add to the Clankie service, with their credentials.

On this page

These routes come from Clankie's built-in extensions. Each group exists only while its extension is switched on. The owner switches one with clankie extensions on <id> or clankie extensions off <id>, and the service reads the switches once when it starts. GET /v1/extensions lists each extension's id and state. Most routes here take the operator token; some also accept a device session, the lead token or the Discord bridge token, as each one says. See the API overview for the credentials.

Discord

The Discord extension (switch persona) adds the owner's view of Clankie's Discord rooms, the Discord settings, and the record of the owner's opt-in to the user-session body. Every response under /v1/discord/ carries cache-control: no-store, and request bodies there are limited to 32 KiB.

Where a route accepts a device session, the device needs the grant named in its Auth line. terminalObserve is part of the Supervise and Take Control presets; steer is part of both as well.

List rooms

GET /v1/discord/rooms

Lists the Discord rooms Clankie has a conversation for, with delivery counts and the owner's pending guidance for each.

Auth: Operator token, or Device session with the terminalObserve grant.

Response 200

Field Type Description
rooms object[] Up to 512 rooms.
rooms[].conversationId string The room's conversation.
rooms[].title string Optional. #channel · server or DM with <name>; absent while the names are unknown.
rooms[].lane string Optional. discord_presence (text) or discord_voice.
rooms[].targetId string Optional. The room's Discord address.
rooms[].coverage string observed or unknown.
rooms[].since string ISO time counting started.
rooms[].received integer Deliveries received.
rooms[].answered integer Deliveries answered.
rooms[].silent integer Deliveries he chose not to answer.
rooms[].missed integer Deliveries missed.
rooms[].failed integer Deliveries that failed.
rooms[].unrecoveredFailed integer Optional. Failures with no confirmed reply or room notice.
rooms[].abandoned integer Optional. Failures closed for a permanent reason and never retried.
rooms[].pending integer Deliveries still in progress.
rooms[].absorbedUnknown integer Deliveries absorbed with an unknown outcome.
rooms[].lastReason string Optional. Reason code of the latest observation.
rooms[].lastObservedAt string Optional. ISO time of the latest observation.
rooms[].guidance object The room's guidance: revision (integer), state (empty, pending, consumed, expired), optional text, optional updatedAt.

Errors

Status error When
403 room_observe_required No operator token, or the device lacks terminalObserve, or its session lapsed during the request.
503 captain_unavailable The conversation list could not be read.
403 room_access_unavailable Authority could not be confirmed while answering.
sh
curl -sS http://127.0.0.1:4310/v1/discord/rooms \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Set room guidance

POST /v1/discord/room-guidance

Leaves one note for Clankie's next turn in a room, or clears it. The note is held as pending until a turn in that room uses it.

Auth: Operator token, or Device session with the steer grant.

Request body (JSON)

Field Type Required Description
conversationId string yes A room from GET /v1/discord/rooms.
text string no 1 to 4000 characters. Omit to clear the guidance.
expectedRevision integer yes The guidance revision you last read.

Response 200

Field Type Description
revision integer The new revision (expectedRevision + 1).
state string pending when text was set, empty when cleared.
text string Optional. The stored text.
updatedAt string Optional. ISO time of the change.

Errors

Status error When
403 room_guidance_required No operator token, or the device lacks steer.
400 invalid_room_guidance The body does not match the schema.
404 room_not_found The conversation is not a current Discord room.
409 guidance_revision_conflict expectedRevision is not the current revision.
503 captain_unavailable The conversation could not be read.
403 room_access_unavailable Authority lapsed during the request, or the body is not JSON.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/discord/room-guidance \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"conversationId":"'"$CONVERSATION_ID"'","text":"Keep replies short in this room.","expectedRevision":0}'

Read Discord settings

GET /v1/discord/settings

Returns the owner's Discord settings, their revision, and setup details for the settings screen.

Auth: Operator token, or Device session with the terminalObserve grant.

Response 200

Field Type Description
settings object The Discord settings. Every field is listed in the settings table under Update Discord settings.
revision string 64-character hex digest of settings. Send it back as expectedRevision when you write.
setup object Optional. Setup details.
setup.definition object The setup screen's definition: schemaVersion (1 or 2), sentences (object[]), advancedGroups (object[] of title and fields), choiceLabels (object of strings).
setup.machineName string The host's name.
setup.invite object Optional, when applicationId is set: role, permissions (decimal string), url (the bot invite link).
setup.checks object[] Optional. Permission checks from the connected account: guildId (optional), sentenceId, kind (a permission such as send_messages, manage_webhooks, connect, or fleet_channel), status (passed, failed, not_checked).
setup.testPostAvailable boolean Optional. true when POST /v1/discord/setup/test-post can run.

Errors

Status error When
403 room_observe_required No operator token, or the device lacks terminalObserve.
409 settings_revision_conflict The settings changed while the response was built. Read again.
403 room_access_unavailable Authority could not be confirmed while answering.
sh
curl -sS http://127.0.0.1:4310/v1/discord/settings \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Update Discord settings

POST /v1/discord/settings

Replaces the Discord settings, guarded by the revision you read. Send the whole settings object from GET /v1/discord/settings with your changes. A defaulted setting you leave out keeps its current value; an optional setting you leave out, such as ownerUserId or applicationId, is cleared. A new tracker forum binding must name an existing built-in tracker project and a forum channel the Discord body can see.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
expectedRevision string yes The revision you read (64 hex characters).
settings object yes The Discord settings, as in the table below.

Response 200

The same shape as GET /v1/discord/settings: settings, revision and optional setup, after the write.

Errors

Status error When
403 operator_required The request does not carry the operator token.
400 invalid_discord_settings The body does not match the schema.
409 settings_revision_conflict expectedRevision is not the current revision.
400 tracker_forum_project_not_found A new forum binding names a project that does not exist.
400 tracker_forum_not_found The forum channel was not found in that server.
400 tracker_forum_not_a_forum The channel exists but is not a forum.
400 tracker_forum_unverified The server's channels could not be read to check the binding.
503 settings_unavailable Settings cannot be written.
403 operator_revoked The operator token stopped verifying during the request.
403 room_access_unavailable Authority lapsed during the write, or the body is not JSON.
sh
curl -sS http://127.0.0.1:4310/v1/discord/settings \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
| jq '{expectedRevision: .revision, settings: (.settings + {voiceEnabled: true})}' \
| curl -sS -X POST http://127.0.0.1:4310/v1/discord/settings \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d @-

Discord settings fields

Discord IDs are numeric strings of 5 to 32 digits. ID lists hold up to 64 entries and default to [].

Field Type Default Description
guilds object {} Per-server options keyed by server ID (up to 64). Each value: role (participant or admin), optional participantHarness (pi or claude), owners (me, everyone, role), ownerRoleId (required when owners is role), fleetEnabled, optional fleetChannelId, trackingLevel.
serverId string none The selected server. Kept for older clients; new writers edit guilds.
role string participant participant or admin, for the selected server.
servers object[] [] Older per-server list: serverId, role, owners, ownerRoleId.
roomSkills object[] [] Skills granted to one channel: serverId, channelId, skill (house-hunting), optional household (existing).
mainConversationChannelIds string[] [] Private text channels that reach the main conversation.
trackerForums object[] [] Up to 16 forums that show a built-in tracker project: serverId, forumId, projectId (UUID), memberPosts (auto or owner_tag, default auto), memberDailyLimit (0 to 500, default 20).
houseHuntingAuthorBindings object[] [] Owner-confirmed bindings of a legacy author label to a Discord user: household, userId, legacyAuthor, ownerConfirmed (true).
fleetEnabled boolean false Post fleet messages in Discord.
fleetChannelId string none The room fleet messages use.
trackingLevel string off off, project_updates, project_activity or all_issues.
applicationId string none The Discord application ID.
guildId string none The command and live-check server.
managedGuildId string none The one server Clankie may create channels in.
teamVisible boolean none Show the team; omitted means visible.
ambientRoleIds string[] [] Roles holding the ambient tier.
ambientUserIds string[] [] Users holding the ambient tier.
approvalRoleIds string[] [] Roles that may approve.
ownerUserId string none The owner's Discord user ID.
systemActorUserIds string[] [] Individual compatibility grants.
systemActorGuildIds string[] [] Retired input; grants nothing.
systemActorChannelIds string[] [] Retired input; skill rooms use roomSkills.
textIngressEnabled boolean false Accept text messages.
ingressGuildIds string[] [] Servers text is accepted from.
ingressChannelIds string[] [] Channels text is accepted from; empty means every channel in those servers.
ingressDmPolicy string deny deny, owner_only or allowlist.
ingressDmUserIds string[] [] Users allowed to DM when the policy is allowlist.
ingressContextMessages integer 10 Earlier messages read for context, 0 to 50.
wakeTrigger string none What wakes Clankie for channel chat: mention, name or any.
ambientChannelIds string[] [] Channels whose chat may be kept briefly for context.
toolProgressChannelIds string[] [] Channels that show tool activity cards.
presenceGuildIds string[] [] Servers for presence.
presenceChannelIds string[] [] Channels for presence.
voiceEnabled boolean false Allow voice.
voiceGuildIds string[] [] Servers for voice.
voiceChannelIds string[] [] Voice channels allowed.
voiceChannelId string none A single voice channel.
voiceJoinPolicy string ambient Who may summon him into a call: ambient or guild_members.
voiceConsentPolicy string explicit Who counts as consenting to be heard: explicit or presence.
voiceTranscriptLoggingEnabled boolean false Keep consented speech and reply text for GET /v1/discord/voice-transcripts.
activeBody string bot Which Discord body speaks: bot or user_session.
userSessionEnabled boolean false Allow the user-session body. It also needs its allowlists, the recorded opt-in, and activeBody set to user_session.
userSessionGuildIds string[] [] Servers for the user-session body.
userSessionChannelIds string[] [] Channels for the user-session body.
userSessionVoiceEnabled boolean false Let the user-session body talk in voice.
userSessionVoiceChannelIds string[] [] Voice channels for the user-session body.
userSessionDmPolicy string owner_only deny, owner_only or allowlist.
userSessionDmUserIds string[] [] Users allowed to DM the user-session body under allowlist.
activityApplicationIdGba string none The Activity's embedded application ID.
activityTunnelName string none The named tunnel that publishes the Activity.
activityTunnelHostname string none The public hostname routed to that tunnel.

Settings that older clients still send and this version retired are dropped, not refused.

Browse the Discord directory

GET /v1/discord/directory

Lists servers, or one server's channels, roles or people, as the active Discord body sees them. Use it to fill pickers for settings.

Auth: Operator token, or Device session with the terminalObserve grant.

Query parameters

Name Type Required Description
kind string no servers (default), channels, roles or people.
guildId string for all kinds but servers The server to list.
limit integer no 1 to 200, default 100.
after string no Continue after this ID (the previous page's nextCursor).

Response 200

Field Type Description
schemaVersion integer 1.
body string The Discord body that answered: bot or user_session.
kind string The kind listed.
state string connected, disconnected, partial or unavailable.
entries object[] Up to 200 entries: id, name, kind (server, role, person, bot, text, voice, stage, forum, media, announcement, category, thread, other), optional guildId.
hasMore boolean More entries follow.
nextCursor string Optional. Pass as after for the next page.
reason string Optional. runtime_not_connected, directory_unavailable, server_unavailable, gateway_cache_incomplete, permissions_unknown or people_not_fully_loaded.

Errors

Status error When
403 room_observe_required No operator token, or the device lacks terminalObserve.
400 invalid_discord_directory_request Bad query, or guildId missing for channels, roles or people.
409 discord_body_changed The active body changed while the list was read.
sh
curl -sS "http://127.0.0.1:4310/v1/discord/directory?kind=channels&guildId=$GUILD_ID&limit=50" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Send a setup test post

POST /v1/discord/setup/test-post

Posts a fixed test message to one channel, after checking that the active body may send messages there. Use it to prove setup works.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
guildId string yes The server.
channelId string yes The channel to post in.
expectedRevision string yes The settings revision you read.

Response 200

Field Type Description
outcome string posted, unavailable or unconfirmed.
body string With posted: bot or user_session.
guildId string With posted.
channelId string With posted.
messageId string With posted: the message created.
reason string With unavailable: permissions_not_verified, account_changed or runtime_unavailable. With unconfirmed: post_receipt_unavailable.

Errors

Status error When
403 operator_required The request does not carry the operator token.
400 invalid_discord_test_post The body does not match the schema.
409 settings_revision_conflict The settings or the active body changed since you read them.
403 operator_revoked The operator token stopped verifying, or the request was aborted.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/discord/setup/test-post \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"guildId":"'"$GUILD_ID"'","channelId":"'"$CHANNEL_ID"'","expectedRevision":"'"$REVISION"'"}'

Read presence status

GET /v1/discord/presence-status

Returns each Discord presence session's phase and counts, and the screen shares the bodies report. It carries no message content; clankie status reads it.

Auth: Operator token.

Response 200

Field Type Description
schemaVersion integer 1.
sessions object[] One per presence session.
sessions[].phase string off, connecting, present, voice_active, go_live_active, degraded or failed.
sessions[].gatewayConnected boolean Whether the body's Discord connection is up.
sessions[].transportKind string bot or user_session.
sessions[].voiceGuildCount integer Servers with active voice.
sessions[].activityCount integer Activity instances.
sessions[].updatedAt string ISO time of the last change.
streams object[] Screen shares: userId, channelId, watching (boolean), hasFrame (boolean).

Errors

Status error When
401 operator_authentication_required Missing or wrong operator token.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS http://127.0.0.1:4310/v1/discord/presence-status \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Read voice transcripts

GET /v1/discord/voice-transcripts

Reads the retained voice transcript: consented speech and Clankie's reply text from Discord calls, in the order recorded, a page at a time. Nothing is retained unless the owner turned on voiceTranscriptLoggingEnabled; while it is off the route answers an empty page with enabled: false. Responses carry cache-control: no-store.

Auth: Operator token, or Device session with the terminalObserve grant. The lead token and the Discord bridge token are also accepted.

Query parameters

Name Type Required Description
limit integer no 1 to 200, default 100.
cursor string no 12 digits: the previous page's nextCursor. Omit to start at the beginning.

Response 200

Field Type Description
schemaVersion integer 1.
enabled boolean Whether transcript retention is on.
entries object[] Up to limit entries.
entries[].role string assistant for Clankie's lines; user or absent for a speaker.
entries[].body string bot or user_session.
entries[].occurredAt string ISO time.
entries[].guildId string The server.
entries[].channelId string The voice channel.
entries[].stayId string Optional. The voice stay.
entries[].deliveryId string The delivery the line belongs to.
entries[].speakerId string The speaker's Discord user ID, or clankie for his lines.
entries[].displayName string Optional. The speaker's display name.
entries[].text string What was said.
entries[].textSource string Assistant lines: native_audio or tts_text.
entries[].textComplete boolean Assistant lines: whether the text is complete.
entries[].outcome string Assistant lines: played, interrupted, suppressed, failed or truncated.
entries[].audioStarted boolean Assistant lines: whether audio began playing.
entries[].playbackMs number Assistant lines: milliseconds played.
entries[].itemId string Assistant lines: the response item.
entries[].playbackId string Assistant lines, optional.
entries[].responseId string Assistant lines, optional.
nextCursor string 12 digits. Pass as cursor for the next page.
hasMore boolean More entries follow.

Errors

Status error When
401 captain_authentication_required No accepted credential.
400 invalid_voice_transcript_query limit or cursor is out of range.
403 room_observe_required The device lost terminalObserve or its session lapsed during the read.
403 voice_transcripts_disabled Retention was switched off during the read.
503 voice_transcript_settings_unavailable Settings could not be read.
500 voice_transcript_read_failed The transcript could not be read.
503 captain_execution_unavailable The service cannot check bearer tokens.
sh
curl -sS "http://127.0.0.1:4310/v1/discord/voice-transcripts?limit=50" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Record user-session opt-in

POST /v1/discord/user-session/opt-in

Records the owner's acceptance of the risk of running Clankie on a normal Discord user account. The user-session body does not start without an active opt-in. A new record replaces the previous one.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
schemaVersion integer yes 1.
characterId string yes The character that will use the account.
acknowledgement string yes The owner's own words accepting the risk, 1 to 2048 characters. Kept for audit.
guildIds string[] yes 1 to 64 server IDs.
channelIds string[] yes 1 to 256 channel IDs.
dmPolicy string yes deny, owner_only or allowlist.

Response 201

Field Type Description
schemaVersion integer 1.
optIn object The record.
optIn.optInId string Its ID.
optIn.characterId string As sent.
optIn.credentialRef string discord_user_session: the stored credential it applies to. No token is carried.
optIn.profileHash string The policy profile in force. A change of profile invalidates the opt-in.
optIn.acknowledgement string As sent.
optIn.guildIds string[] As sent.
optIn.channelIds string[] As sent.
optIn.dmPolicy string As sent.
optIn.recordedAt string ISO time.
optIn.revokedAt string Optional. ISO time it was revoked.

Errors

Status error When
401 operator_authentication_required Missing or wrong operator token.
400 invalid_discord_user_session_opt_in The body does not match the schema.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/discord/user-session/opt-in \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"schemaVersion":1,"characterId":"clankie","acknowledgement":"I accept the account risk.","guildIds":["'"$GUILD_ID"'"],"channelIds":["'"$CHANNEL_ID"'"],"dmPolicy":"owner_only"}'

Read user-session opt-in

GET /v1/discord/user-session/opt-in

Returns the latest opt-in record, revoked or not, or null when none was ever recorded. The user-session body reads it before it connects.

Auth: Operator token, lead token or Discord bridge token.

Response 200

Field Type Description
schemaVersion integer 1.
optIn object or null The record, with the fields listed under the POST response.

Errors

Status error When
401 authentication_required No accepted credential.
503 authentication_unavailable The service cannot check credentials.
sh
curl -sS http://127.0.0.1:4310/v1/discord/user-session/opt-in \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Revoke user-session opt-in

DELETE /v1/discord/user-session/opt-in

Revokes the active opt-in. The user-session body stops being allowed to act.

Auth: Operator token.

Response 200

Field Type Description
schemaVersion integer 1.
optIn object The record, now with revokedAt.

Errors

Status error When
401 operator_authentication_required Missing or wrong operator token.
409 discord_user_session_opt_in_not_active There is no active opt-in to revoke.
503 operator_authentication_unavailable The service cannot check the operator token.
sh
curl -sS -X DELETE http://127.0.0.1:4310/v1/discord/user-session/opt-in \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Discord body routes

The Discord extension's own processes, and the lead for its presence heartbeat, call these routes. They are listed so you can recognise them; they are not meant for owner clients. POST /v1/captain/presence stays mounted with the persona switch off; the others need it on.

Method Path Purpose Credential
POST /v1/discord/presence-session-events Report a presence session's lifecycle events Discord bridge token
POST /v1/discord/presence-actions Ask the body to perform a Discord action (reply, react, send a message, join voice, start an Activity and so on) Discord bridge token or lead token
GET /v1/discord/presence-sessions Read the full presence session records Discord bridge token or lead token
GET /v1/discord/voice-history Read recent completed voice stays (limit 1 to 32, default 5) Discord bridge token or lead token
POST /v1/captain/presence Heartbeat the lead's presence lease Discord bridge token or lead token

Voice

The voice extension (switch voice) adds the phone composer's transcription status.

Read composer transcription status

GET /v1/composer/transcription/status

Tells the app whether voice dictation in the composer is available and what limits apply. The service has no transcription connection, so it answers mode local and state ineligible. Responses carry cache-control: no-store.

Auth: Device session with the chat grant. Support-access devices are refused.

Response 200

Field Type Description
schemaVersion integer 1.
mode string local.
state string ineligible.
maxDurationMs integer 180000.
maxAudioBytes integer 5825580.
maxChunkBytes integer 262144.

Errors

Status error When
401 authentication_required No valid device session with chat.
403 forbidden The device's session or grant lapsed during the request.
503 unavailable An unexpected failure.
sh
curl -sS http://127.0.0.1:4310/v1/composer/transcription/status \
  -H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN"

Computer

The computer extension (switch computer) lets an owner-held conversation see and drive this Mac's screen. The computer body exists only on macOS; on other hosts POST /v1/computer answers 503 computer_body_unavailable. Actions other than status, release, revoke and recover also need the machine's access level to allow screen use.

Check computer authority

POST /v1/computer/authority

Checks whether this request may act on the computer for a conversation. It changes nothing.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
conversationId string yes A conversation the lead owns.
action string yes effect or recover.

Response 200 when authorized, 401 when not

Field Type Description
conversationId string As sent.
authorized boolean Whether the request may act.

Errors

Status error When
400 invalid_computer_authority_request The body does not match the schema.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/computer/authority \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"conversationId":"'"$CONVERSATION_ID"'","action":"effect"}'

Run a computer command

POST /v1/computer

Runs one command on the computer body for a conversation. A conversation first acquires the computer lease, then captures a window and sends input against that capture. Every capture is fresh for 30 seconds, and input is accepted only against the latest capture. Responses carry cache-control: no-store. The body limit is 2 MiB.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
conversationId string yes A conversation the lead owns.
command object yes One command, chosen by command.action.

command by action:

action Other fields Returns
status none bodyId, lease (object or null: resource, conversationId, expiresAt in epoch ms, state active or recovery_required), busy, and on hosts with an input switch allowInput and inputReady.
acquire ttlMs (1 to 300000, default 300000) {"outcome":"acquired","lease":{...}} with bodyId, conversationId, leaseId, issuedAt, heartbeatAt, expiresAt, optional allowInput; or busy with the holder's lease; or rejected with a reason.
renew leaseId, ttlMs {"outcome":"renewed","lease":{...}} or rejected.
release leaseId {"outcome":"released"} or rejected.
revoke leaseId {"outcome":"revoked"} or rejected.
recover optional ownerRecovery: reason, expectedHolder, expectedExpiresAt {"outcome":"released"}, or rejected with reason, detail and next. ownerRecovery is the owner's explicit decision that the previous holder's input has stopped, for the local Mac only.
inventory leaseId bodyId, observedAt, complete, apps (appId, name), windows (appId, windowId, title).
capture leaseId, target (appId, windowId), capture (normal or classic_read_only, default normal) A screenshot record: screenshotId, bodyId, conversationId, leaseId, sequence, capturedAt, expiresAt, target, width, height, coordinates, inputReady, optional accessibility, elements (id, label, actionable), sha256.
frame leaseId, screenshotId The capture's image: screenshotId, encoding (png), data (base64), byteLength, sha256.
input leaseId, requestId (UUID), screenshotId, inputs (1 to 64) A receipt: requestId, bodyId, conversationId, leaseId, screenshotId, completedAt, outcome (confirmed, failed, uncertain), inputs (index, outcome, detail), optional reason. Reusing a requestId returns the original receipt and never repeats the input.

Each entry of inputs has a kind and an optional expect (field: tree, focused_element, document_text or selected_text; equals: string), plus foreground (boolean, default false):

kind Fields
click at (x, y in screenshot pixels), button (left or right, default left)
element elementId from the capture's elements
type text (1 to 16384 characters), clear (default false)
key keys (1 to 256 characters)
scroll direction (up, down, left, right), amount (1 to 100), optional at
drag from, to

Errors

Status error When
401 computer_authorization_required Missing operator token, or the conversation is not one the lead owns.
400 invalid_computer_request The body is not JSON or does not match the schema.
403 machine_access_refused The machine's access level does not allow screen use. The body adds machine, accessLevel, required and detail.
409 computer_request_refused The command could not run (stale lease, stale capture, operation in progress). The body adds retry; read status and never replay input with a new requestId.
503 computer_body_unavailable This host has no computer body.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/computer \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"conversationId":"'"$CONVERSATION_ID"'","command":{"action":"status"}}'

Media

The media extension (switch media) makes pictures and video clips with the provider and model the owner configured, and keeps the owner's drafts of the lead's pixel skin. A generation that cannot run answers 200 with outcome refused and a reason; only a malformed body or a failed upstream is an error status.

Generate an image

POST /v1/media/images

Draws a picture, or edits one Clankie made earlier. The result is a reference to the saved file.

Auth: Operator token, lead token or Discord bridge token.

Request body (JSON)

Field Type Required Description
schemaVersion integer yes 1.
prompt string yes 1 to 4000 characters.
aspectRatio string no Shape hint such as 16:9.
sourceRef string no Edit this generated picture: sha256:<hex>:generated/<file>.

Response 200

Field Type Description
result.outcome string ok or refused.
result.schemaVersion integer 1.
result.artifactRef string With ok: sha256:<hex>:generated/<file>.
result.filename string With ok.
result.mimeType string With ok.
result.byteLength integer With ok.
result.provider string With ok: the provider used.
result.model string With ok: the model used.
result.providerRequestId string With ok, optional.
result.reason string With refused: no_model_configured, credential_unavailable, provider_unsupported, provider_failed, artifact_too_large or media_unavailable.
result.detail string With refused, optional.

Errors

Status error When
401 authentication_required No accepted credential.
400 invalid_media_request The body does not match the schema.
502 media_upstream_failure The generation failed unexpectedly.
503 authentication_unavailable The service cannot check credentials.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/media/images \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"schemaVersion":1,"prompt":"A small robot watering a plant","aspectRatio":"1:1"}'

Generate a video

POST /v1/media/videos

Starts a video render, or resumes one. The route waits a bounded time; a render still running comes back pending with a requestId, and the same call with that requestId picks it up without paying twice.

Auth: Operator token, lead token or Discord bridge token.

Request body (JSON)

Send either prompt (to start) or requestId (to resume), not both.

Field Type Required Description
schemaVersion integer yes 1.
prompt string to start 1 to 4000 characters.
requestId string to resume From a pending result. A resumed render keeps its pictures, so it takes no frame fields.
aspectRatio string no Shape hint such as 16:9.
durationSeconds integer no 1 to 15.
firstFrame string no The picture to open on: a generated-media reference or a PNG, JPEG or WebP data: URI.
lastFrame string no The picture to end on. Needs firstFrame; the same picture makes a loop.
referenceImages string[] no 1 to 3 pictures of a subject or style, in the same forms.

Response 200

Field Type Description
result.outcome string ok, pending or refused.
result.schemaVersion integer 1.
result.artifactRef string With ok: sha256:<hex>:generated/<file>.
result.filename, result.mimeType, result.byteLength, result.provider, result.model string, integer With ok.
result.requestId string With pending: pass it to resume.
result.waitedSeconds integer With pending.
result.reason string With refused: as for images.
result.detail string With refused, optional.

Errors

Status error When
401 authentication_required No accepted credential.
400 invalid_media_request The body does not match the schema.
502 media_upstream_failure The render failed unexpectedly.
503 authentication_unavailable The service cannot check credentials.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/media/videos \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"schemaVersion":1,"prompt":"Waves rolling onto a beach at dusk","durationSeconds":5}'

Skin drafts

A skin draft is the owner's work-in-progress pixel skin for the lead: a description, an optional reference picture, and three key poses (rest, work, comms) sampled from pictures on a pixel grid of up to 32 columns by 96 rows. When all three poses are set the draft waits for approval. Each change makes a new version (up to 64) with a new revision digest, and every write must name the expectedRevision it builds on. Responses carry cache-control: private, no-store.

All skin draft routes take the same credential and refuse paths and queries outside the documented forms.

Auth: Operator token, or Device session with Take Control.

A draft object has these fields:

Field Type Description
schemaVersion integer 1.
id string UUID.
owner string Digest of the owner account.
version integer 1 to 64.
revision string 64-character hex digest of this version.
description string The character brief.
state string awaiting_poses, awaiting_approval, approved, declined or cancelled.
generation string not_requested.
createdAt, updatedAt string ISO times.
reference object Optional. The reference picture: conversationId, artifactId, sha256, mediaType (image/png or image/jpeg), byteCount.
poses object rest, work and comms, each optional: source (as reference), sampling, sha256 of the sampled image, width, height, palette (RGB triples).
approval object Present when approved: owner, actor (kind operator or device, id), revision, poseDigests (rest, work, comms), approvedAt.

Skin draft errors:

Status error When
401 authentication_required No operator token or Take Control device session.
400 skin_draft_malformed The path, query or body is not a valid form.
403 skin_draft_owner_required The owner's authority lapsed during the request.
404 skin_draft_not_found No draft with that ID or version.
404 skin_draft_reference_not_found The reference picture is not a file delivered in that conversation, or the draft has none.
404 skin_draft_pose_not_found The pose is not set.
409 skin_draft_conflict expectedRevision or revision is not the current one.
409 skin_draft_cancelled The draft is cancelled.
409 skin_draft_rest_required Set rest before work or comms.
409 skin_draft_poses_required Approval needs all three poses.
409 skin_draft_request_conflict A create reused a requestId with different content.
409 skin_draft_reference_changed, skin_draft_artifact_changed Stored picture bytes no longer match their digest.
409 skin_draft_storage_invalid A stored draft failed its checks.
400 skin_draft_reference_format The reference is not PNG or JPEG.
400 skin_draft_invalid_reference The reference picture could not be decoded.
400 skin_draft_invalid_sampling The grid could not sample the picture.
400 skin_draft_empty_pose The sampled pose has no opaque pixels.
400 skin_draft_pose_geometry A pose's size differs from rest.
413 skin_draft_bytes_exceeded A picture or record is too large.
413 skin_draft_count_exceeded More than 128 drafts.
413 skin_draft_versions_exceeded The draft reached 64 versions.
503 skin_drafts_unavailable The draft store failed.

List skin drafts

GET /v1/operator/skin-drafts

Lists every draft at its current version.

Auth: Operator token, or Device session with Take Control.

Response 200

Field Type Description
outcome string list.
drafts object[] Up to 128 drafts.
sh
curl -sS http://127.0.0.1:4310/v1/operator/skin-drafts \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Change a skin draft

POST /v1/operator/skin-drafts

Creates a draft or changes one, chosen by action. The body limit is 16 KiB.

Auth: Operator token, or Device session with Take Control.

Request body (JSON)

action Fields Effect
create requestId (UUID, becomes the draft ID), description (1 to 4000 characters), optional reference (conversationId, artifactId: 48 hex characters) Creates a draft. Repeating the same request returns the same draft.
list none As GET.
get draftId, optional version (1 to 64) Returns one draft.
pose draftId, expectedRevision, pose (rest, work, comms), source (conversationId, artifactId), sampling Samples a pose from a delivered picture.
revise draftId, expectedRevision, description Changes the description.
approve draftId, expectedRevision Approves a draft with all three poses.
decline draftId, expectedRevision Declines the draft.
cancel draftId, expectedRevision Cancels the draft.

sampling has grid (pitch 1 to 16384, optional x and y offsets, columns 1 to 32, rows 1 to 96), and optional background (RGB triple), backgroundTolerance (0 to 255) and colors (1 to 64). Poses after rest reuse the rest palette.

Response 200

Field Type Description
outcome string draft (or list for the list action).
draft object The draft after the change.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/operator/skin-drafts \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"create","requestId":"'"$(uuidgen | tr A-Z a-z)"'","description":"A small orange robot with one antenna"}'

Get a skin draft

GET /v1/operator/skin-drafts/:id

Returns one draft, at its current version or an earlier one.

Auth: Operator token, or Device session with Take Control.

Path parameters

Name Type Description
id string The draft's lowercase UUID.

Query parameters

Name Type Required Description
version integer no 1 to 64.

Response 200

Field Type Description
outcome string draft.
draft object The draft.
sh
curl -sS "http://127.0.0.1:4310/v1/operator/skin-drafts/$DRAFT_ID?version=1" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Get a skin draft's reference picture

GET /v1/operator/skin-drafts/:id/reference

Returns the draft's reference picture bytes, with content-type set to its media type and an x-clankie-sha256 header carrying its digest.

Auth: Operator token, or Device session with Take Control.

Path parameters

Name Type Description
id string The draft's lowercase UUID.

Query parameters

Name Type Required Description
revision string yes The draft's current revision.

Response 200: the image (image/png or image/jpeg).

sh
curl -sS "http://127.0.0.1:4310/v1/operator/skin-drafts/$DRAFT_ID/reference?revision=$REVISION" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" -o reference.png

Get a skin draft pose

GET /v1/operator/skin-drafts/:id/poses/:pose/:kind

Returns one pose's picture: the source it was sampled from, or the sampled pixel image. The x-clankie-sha256 header carries its digest.

Auth: Operator token, or Device session with Take Control.

Path parameters

Name Type Description
id string The draft's lowercase UUID.
pose string rest, work or comms.
kind string source (the picture sampled) or native (the sampled PNG).

Query parameters

Name Type Required Description
revision string yes The draft's current revision.

Response 200: the image. native is always image/png.

sh
curl -sS "http://127.0.0.1:4310/v1/operator/skin-drafts/$DRAFT_ID/poses/rest/native?revision=$REVISION" \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" -o rest.png

Browser

The browser extension (switch browser) gives Clankie a private browser driven through named tools. It is also off when the service's environment sets CLANKIE_BROWSER_ENABLED to 0, false, no or off.

List browser tools

GET /v1/browser/tools

Returns the browser's tool catalog. Tools marked requiresShell are listed only for the operator token.

Auth: Operator token, lead token or Discord bridge token.

Response 200

Field Type Description
catalog.schemaVersion integer 1.
catalog.available boolean false means the browser could not be reached, not that it has no tools.
catalog.reason string Optional. Why it is unavailable.
catalog.tools object[] Up to 256 tools.
catalog.tools[].name string Tool name, such as browser_use_open.
catalog.tools[].description string What it does.
catalog.tools[].inputSchema object JSON Schema for its arguments.
catalog.tools[].requiresShell boolean Optional. Needs the operator token.
catalog.tools[].riskClass string read, reversible-write, irreversible-write, publish-external or destructive.
catalog.tools[].requiresApproval boolean The call needs the operator token.

Errors

Status error When
401 authentication_required No accepted credential.
502 browser_upstream_failure The catalog could not be read.
503 browser_unavailable The browser did not start.
503 authentication_unavailable The service cannot check credentials.
sh
curl -sS http://127.0.0.1:4310/v1/browser/tools \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"

Call a browser tool

POST /v1/browser/call

Runs one browser tool for a conversation. The conversation is named in the x-clankie-conversation-id header and must be one the lead owns.

Auth: Operator token.

Request body (JSON)

Field Type Required Description
schemaVersion integer yes 1.
tool string yes A tool name from the catalog.
arguments object no The tool's arguments, per its inputSchema. Default {}.

Response 200

Field Type Description
result.outcome string ok or refused, or rejected (with reason) when the conversation's authority check fails at run time.
result.tool string The tool called.
result.content string With ok: the tool's text output.
result.isError boolean With ok: the tool reported an error.
result.artifacts object[] With ok: up to 8 saved files (artifactRef, filename, mimeType, byteLength), such as screenshots.
result.reason string With refused: unknown_tool, approval_required or browser_unavailable.
result.detail string With refused, optional.

Errors

Status error When
401 authentication_required No accepted credential.
400 invalid_browser_call The body does not match the schema.
409 none (outcome rejected, reason identity_required) The header is missing, the conversation is not one the lead owns, or the caller is not the operator.
502 browser_upstream_failure The browser failed.
503 browser_unavailable The browser did not start.
503 browser_authentication_unavailable The service cannot check the operator token for an approval.
sh
curl -sS -X POST http://127.0.0.1:4310/v1/browser/call \
  -H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
  -H "x-clankie-conversation-id: $CONVERSATION_ID" \
  -H "Content-Type: application/json" \
  -d '{"schemaVersion":1,"tool":"browser_use_open","arguments":{"url":"https://example.com"}}'