API
Pairing and devices
Health probe, device pairing, paired devices, owner keys, support grants, account tokens and owner asks.
On this page
- Health
- Check health
- Pairing
- Create a pairing offer
- Redeem a pairing offer
- Complete pairing
- End an automation run
- Create a same-Mac companion offer
- Redeem a same-Mac companion offer
- Manage trusted companion apps
- Devices
- List devices
- Revoke a device
- Read this device
- Refresh the device session
- Record push delivery
- Read the diagnostics default
- Owner keys
- Register an owner key
- Reset a device's owner key
- List owner keys
- Support grants
- List support grants
- Create a support grant
- Revoke a support grant
- Create a support pairing offer
- Account tokens
- List account tokens
- Register an account token
- Remove an account token
- List devices with an account token
- Owner asks
- List owner asks
- Approve an owner ask
- Decline an owner ask
This page covers the service's health probe, how a device pairs with a Mac, how paired devices are listed and revoked, owner device keys, support grants, account API tokens, and the owner's side of owner asks. Routes take an operator token, a device session, an account token, or no credential, as each endpoint states.
Health
A public liveness probe. No optional part of it can make it fail.
Check health
GET /health
Reports that the service is up, with process counters and the state of the parts it runs. Fields marked optional appear only when that part has something to report.
Auth: None.
Response 200
| Field | Type | Description |
|---|---|---|
ok |
boolean | Always true. |
service |
string | Always "clankie". |
processHealth.schemaVersion |
number | Always 1. |
processHealth.instanceId |
string | UUID of this service process. |
processHealth.pid |
number | Process id. |
processHealth.uptimeMs |
number | Process uptime in milliseconds. |
processHealth.cpu.userMicros |
number | User CPU time in microseconds. |
processHealth.cpu.systemMicros |
number | System CPU time in microseconds. |
extensions |
object[] | Optional. Last known state of each extension: id, state (off, starting, running, degraded, stopped), optional reason code. |
doorway |
object | Optional. Public gateway state: state is disabled, unavailable, connecting, connected or sign_in_required (the last also carries since). |
runtime |
object | Optional. Boot identity: pid, commit (40-hex), root (checkout path), instanceId. |
captainTurns.running |
boolean | Whether this service runs the lead's turns. |
captainTurns.reason |
string | Optional. Why turns are not running. |
self |
object | Which body this is: optional selfId, epoch (number), state (active, frozen, released), dormant (boolean), optional transferId, optional releasedTo (peer, epoch, at). |
runtimeHealth |
object | Optional. Runtime health observation, see below. |
runtimeHealth fields: state (starting, disabled, healthy, sustaining, alarm, cooldown), durationMs, reasons (array of cpu, health), delivery (none, accepted, unavailable), and optional observedAt, cpuPercent, healthLatencyMs, healthAvailable, recorded, lastAlarmAt, lastRecoveryAt, lastIncidentDurationMs.
curl -sS http://127.0.0.1:4310/healthPairing
Pairing turns a one-time offer into a paired device. The owner mints an offer, which returns a link and a one-time code. The device redeems the link or code and gets a pending device id and a completion token. The device then completes pairing, choosing which of the offered grants it accepts, and receives its device session. An ordinary offer is valid for five minutes; a completion token for ten minutes; a device session for seven days unless a support grant ends it sooner.
Every device carries a grant set:
| Field | Type | Description |
|---|---|---|
chat |
boolean | Use chat. |
steer |
boolean | Steer agents. |
terminalObserve |
boolean | Watch terminal panes, read only. |
terminalControl |
boolean | Type into terminal panes. A device with all four grants has Take Control. |
Create a pairing offer
POST /v1/pairing/offer
Mints a single-use pairing offer. An empty body mints an ordinary five-minute offer that offers Take Control. run scopes the offer to an automation run whose devices are revoked when the run ends or expires. review mints a long-lived offer for app reviewers or testers.
Auth: Operator token. The owner's own app on the same Mac can also call it with its Device session with Take Control, over loopback; it may not use run or review.
Request body (JSON, optional)
| Field | Type | Required | Description |
|---|---|---|---|
run.runId |
string | Yes, with run |
1 to 128 characters: letters, digits, _, -. |
run.purpose |
string | Yes, with run |
test, proof, simulator or gateway-probe. |
run.ttlSeconds |
integer | No | 60 to 3600. Default 900. |
review.days |
integer | Yes, with review |
Offer lifetime in days, 1 to 31. |
run and review cannot be sent together.
Response 200
| Field | Type | Description |
|---|---|---|
version |
number | Always 1. |
deepLink |
string | clankie://connect link the app opens or shows as a QR code. |
code |
string | The code to hand to the device. When the link goes through the public gateway this is the full link. |
localCode |
string | Typed code in the form XXXX-XXXX. Absent on review offers. |
expiresAt |
string | ISO time the offer expires. |
run |
object | Present for run offers: runId, purpose, expiresAt. |
review |
boolean | true on review offers. |
gateway |
boolean | true when the link carries the public gateway route. |
direct |
string | The Mac's direct control origin, when one is configured. |
qr.size |
number | Present only when a device minted the offer. Modules per side. |
qr.modules |
string | Row by row, 1 dark and 0 light. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token (and no qualifying device). |
| 403 | forbidden |
The device is not the owner's own app, or a device sent run or review. |
| 400 | malformed |
Body does not match the schema. |
| 400 | run_review_conflict |
Both run and review were sent. |
| 503 | public_gateway_unavailable |
The public gateway cannot carry the offer and no direct route is configured. |
| 409 | run_ended |
The named run was already ended. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/offer \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Redeem a pairing offer
POST /v1/pairing/redeem
Exchanges the offer secret from the link, or the typed code, for a pending device and a single-use completion token. No grants are active until the device completes pairing. The body is limited to 4 KiB.
Auth: None. The offer secret or code is the credential.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
offerSecret |
string | One of the two | The secret from the pairing link. |
code |
string | One of the two | The typed code. Case, spaces and dashes are ignored. |
device.name |
string | Yes | Device name, 1 to 64 characters. |
device.platform |
string | Yes | ios, android, macos or unknown. |
Send exactly one of offerSecret and code.
Response 200
| Field | Type | Description |
|---|---|---|
deviceId |
string | The pending device's id. |
host.name |
string | The Mac's display name. |
hostBaseUrl |
string | Optional. Public gateway base URL for this Mac. |
offeredGrants |
object | Grant set the device may accept. |
completionToken |
string | Single-use token for the complete step. |
expiresAt |
string | ISO time the pending device and token expire. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | malformed |
Body does not match the schema. |
| 410 | expired |
Unknown, expired or ended offer. |
| 409 | consumed |
The offer was already redeemed. |
| 410 | run_ended |
The offer's run was ended. |
| 409 | support_pairing_requires_read_state |
The offer belongs to a support grant that is not read-state. |
| 409 | device_identity_conflict |
The new device id collided with an existing one. |
| 503 | device_authentication_unavailable |
The Mac cannot issue device sessions. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/redeem \
-H "Content-Type: application/json" \
-d '{"code":"'"$PAIRING_CODE"'","device":{"name":"My iPhone","platform":"ios"}}'Complete pairing
POST /v1/pairing/complete
Activates the pending device with the grants it accepts and returns its device session. The accepted set may only narrow the offered set. The body is limited to 4 KiB.
Auth: None. The completion token is the credential.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
completionToken |
string | Yes | Token from the redeem step. |
acceptedGrants |
object | Yes | Grant set with all four fields; each true must also be true in offeredGrants. |
Response 200
| Field | Type | Description |
|---|---|---|
deviceId |
string | The device's id. |
deviceToken |
string | The device session bearer. |
grants |
object | The accepted grant set. |
sessionExpiresAt |
string | ISO time the session expires. |
relayUrl |
string | Optional. Relay base URL for this device. |
directRoute.controlPlaneUrl |
string | Optional. Direct control origin. |
directRoute.relayUrl |
string | Optional. Direct relay origin. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | malformed |
Body does not match the schema, or the accepted grants exceed the offer. |
| 410 | expired |
The token or pending device expired, or its support grant ended. |
| 409 | consumed |
The token was already used or the device is no longer pending. |
| 403 | revoked |
The pending device was revoked or its run ended. |
| 409 | support_pairing_requires_read_state |
The device's support grant is not read-state. |
| 503 | device_authentication_unavailable |
The Mac cannot issue device sessions. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/complete \
-H "Content-Type: application/json" \
-d '{"completionToken":"'"$COMPLETION_TOKEN"'","acceptedGrants":{"chat":true,"steer":true,"terminalObserve":true,"terminalControl":false}}'End an automation run
POST /v1/pairing/runs/:id/end
Cancels the run's outstanding offers and revokes every device the calling operator paired for that run. Later offers for the same run are refused.
Auth: Operator token.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | The run id: 1 to 128 letters, digits, _ or -. |
Response 200
| Field | Type | Description |
|---|---|---|
revokedDeviceIds |
string[] | Devices revoked for this run. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 400 | malformed |
The run id does not match the pattern. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/runs/$RUN_ID/end \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Create a same-Mac companion offer
POST /v1/pairing/local/offer
Mints a one-time offer for Clankie's own app on this Mac. Minting a new one replaces any unredeemed one. The three /v1/pairing/local/* routes exist only on a macOS host that is not hosted, and answer only a native client calling 127.0.0.1 directly over loopback with Content-Type: application/json. Responses are not cached.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
version |
number | Always 1. |
offerSecret |
string | 22-character one-time secret. |
expiresAt |
string | ISO time the offer expires. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 403 | native_loopback_required |
The request did not come directly from a native client over loopback. |
| 404 | not_found |
The host is not macOS, or is hosted. |
| 503 | device_authentication_unavailable |
The Mac cannot issue device sessions. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/local/offer \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Redeem a same-Mac companion offer
POST /v1/pairing/local/redeem
Exchanges a companion offer secret for a device session with Take Control in one step. Only an app the owner has trusted (see the next route) can redeem; a refused attempt does not use up the offer. If the companion device already exists, it gets a fresh session with its existing grants.
Auth: None. Only an app on the owner's trusted list, on this Mac, can call it.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
offerSecret |
string | Yes | The 22-character secret from the companion offer. |
Response 200
| Field | Type | Description |
|---|---|---|
deviceId |
string | The companion device's id. |
deviceToken |
string | The device session bearer. |
grants |
object | Grant set. |
sessionExpiresAt |
string | ISO time the session expires. |
host.name |
string | The Mac's display name. |
relayUrl |
string | Relay origin on this Mac. |
directRoute.controlPlaneUrl |
string | This service's loopback origin. |
directRoute.relayUrl |
string | Relay loopback origin. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | companion_app_untrusted |
The calling app is not trusted. The body also carries reason: peer_unknown, not_signed or untrusted. |
| 400 | malformed |
Body does not match the schema. |
| 410 | expired |
Unknown or expired offer. |
| 409 | consumed |
The offer was already redeemed. |
| 403 | revoked |
The companion device was revoked. |
| 403 | native_loopback_required |
The request did not come directly from a native client over loopback. |
| 404 | not_found |
The host is not macOS, or is hosted. |
| 503 | device_authentication_unavailable |
The Mac cannot issue device sessions. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/local/redeem \
-H "Content-Type: application/json" \
-d '{"offerSecret":"'"$COMPANION_OFFER_SECRET"'"}'Manage trusted companion apps
POST /v1/pairing/local/trusted-apps
Lists, adds or removes the apps allowed to redeem a same-Mac companion offer. There is no GET; listing is op: "list". Adding an app whose code requirement is already trusted changes nothing. The body is limited to 16 KiB.
Auth: Operator token, sent directly over loopback from a native client.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
op |
string | Yes | list, add or remove. |
app.label |
string | With add |
Display name, 1 to 100 characters. |
app.requirement |
string | With add |
Code requirement, 1 to 4096 characters. |
app.identifier |
string | With add |
Bundle identifier, 1 to 256 characters. |
app.teamId |
string | No | 10-character team id. |
id |
string | With remove |
UUID of the trusted app to remove. |
Response 200
| Field | Type | Description |
|---|---|---|
apps |
object[] | Trusted apps after the change. |
apps[].id |
string | UUID. |
apps[].label |
string | Display name. |
apps[].requirement |
string | Code requirement. |
apps[].identifier |
string | Bundle identifier. |
apps[].teamId |
string | Optional. Team id. |
apps[].addedAt |
string | ISO time it was added. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 400 | malformed |
Body does not match the schema. |
| 403 | native_loopback_required |
The request did not come directly from a native client over loopback. |
| 404 | not_found |
The host is not macOS, or is hosted. |
| 503 | settings_unavailable |
Settings cannot be written. |
| 503 | device_authentication_unavailable |
The Mac cannot issue device sessions. |
curl -sS -X POST http://127.0.0.1:4310/v1/pairing/local/trusted-apps \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"op":"list"}'Devices
Paired devices, as the owner manages them and as each device sees itself.
A device list item has these fields:
| Field | Type | Description |
|---|---|---|
deviceId |
string | Device id. |
name |
string | Device name. |
platform |
string | ios, android, macos or unknown. |
status |
string | pending, active or revoked. |
grants |
object | Grant set: offered while pending, accepted once active. |
review |
boolean | Optional. true when paired through a review offer. |
scope |
string | Optional. connector for a connector device. |
run |
object | Optional. Automation run: runId, purpose, expiresAt. |
pairingIds |
string[] | Optional. Grouped lists only: every registration in the row. |
createdAt |
string | ISO time the device was created. |
activatedAt |
string | Optional. ISO activation time. |
lastRefreshAt |
string | Optional. ISO time of the last session refresh. |
lastSeenAt |
string | Optional. ISO time the device was last seen. |
push |
object | Optional. Last push state: registrationId, sequence, enabled. |
revokedAt |
string | Optional. ISO revocation time. |
revokedBy |
string | Optional. Who revoked it. |
ownerRightsUnannouncedAt |
string | Optional. Set when Clankie could not tell the owner this device gained owner rights. |
List devices
GET /v1/devices
Lists paired and pending devices, newest first. Pending devices whose pairing window has passed are left out.
Auth: Operator token or Device session.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
grouped |
string | No | true groups registrations that share a push registration into one row with pairingIds. |
Response 200
An array of device list items.
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS "http://127.0.0.1:4310/v1/devices?grouped=true" \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Revoke a device
POST /v1/devices/:id/revoke
Revokes a device. Revoking an already revoked device succeeds and changes nothing.
Auth: Operator token or Device session with Take Control.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | Device id. |
Response 200
The device list item after revocation.
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control or is not the owner's own device. |
| 404 | device_not_found |
No such device, or its pairing window passed. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/devices/$DEVICE_ID/revoke \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read this device
GET /v1/devices/self
Returns the calling device's own registration, used to restore a session on launch. Not cached.
Auth: Device session.
Response 200
| Field | Type | Description |
|---|---|---|
deviceId |
string | Device id. |
name |
string | Device name. |
platform |
string | ios, android, macos or unknown. |
grants |
object | Grant set in effect. |
ownerDevice |
boolean | Whether this is the owner's own paired device. |
host.name |
string | The Mac's display name. |
sessionExpiresAt |
string | ISO time the session expires. |
scope |
string | Optional. connector for a connector device. |
supportGrantId |
string | Optional. Support grant this device was paired under. |
supportScope |
string | Optional. read-state or shell. |
directRoute.controlPlaneUrl |
string | Optional. Direct control origin. |
directRoute.relayUrl |
string | Optional. Direct relay origin. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | device_authentication_required |
Missing or invalid device session. |
| 401 | expired |
The session expired. |
| 401 | revoked |
The device was revoked. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS http://127.0.0.1:4310/v1/devices/self \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN"Refresh the device session
POST /v1/devices/self/session/refresh
Issues a new device session token. Grants come from the device's stored record, so a refresh never widens access.
Auth: Device session.
Response 200
| Field | Type | Description |
|---|---|---|
deviceToken |
string | The new device session bearer. |
grants |
object | Grant set in effect. |
sessionExpiresAt |
string | ISO time the new session expires. |
relayUrl |
string | Optional. Relay base URL. |
directRoute.controlPlaneUrl |
string | Optional. Direct control origin. |
directRoute.relayUrl |
string | Optional. Direct relay origin. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | device_authentication_required |
Missing or invalid session, or the device is not active. |
| 401 | expired |
The session expired. |
| 401 | revoked |
The device was revoked. |
| 403 | forbidden |
A device with terminal control that is not the owner's own device. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/devices/self/session/refresh \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN"Record push delivery
POST /v1/devices/self/push
Records that the device turned push delivery on or off. Only a registration reference and its version are stored here. Each change needs a higher sequence; repeating the same state at the same sequence returns it unchanged.
Auth: Device session.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
registrationId |
string | Yes | UUID of the push registration. |
sequence |
integer | Yes | Positive version number of this state. |
enabled |
boolean | Yes | Whether push delivery is on. |
Response 200
| Field | Type | Description |
|---|---|---|
registrationId |
string | Recorded registration. |
sequence |
integer | Recorded version. |
enabled |
boolean | Recorded state. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | malformed |
Body does not match the schema. |
| 409 | stale_push_registration |
sequence is lower than the recorded one. |
| 409 | conflicting_push_registration |
Same sequence with a different registration or state. |
| 401 | device_authentication_required |
Missing or invalid session, or the device is not active. |
| 401 | revoked |
The device was revoked. |
| 401 | expired |
The session expired. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/devices/self/push \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"registrationId":"'"$PUSH_REGISTRATION_ID"'","sequence":1,"enabled":true}'Read the diagnostics default
GET /v1/devices/self/diagnostics-default
Returns the account's diagnostics default. Not cached.
Auth: Operator token or Device session.
Response 200
| Field | Type | Description |
|---|---|---|
diagnosticsDefault |
boolean | The diagnostics default. The service returns true. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 503 | unavailable |
The response could not be built. |
curl -sS http://127.0.0.1:4310/v1/devices/self/diagnostics-default \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN"Owner keys
The owner's own paired device registers a public key that it uses to sign approvals. Workers read the list of keys to check those approvals. Responses are not cached.
Register an owner key
POST /v1/devices/self/owner-key
Registers the calling device's owner key. Registering the device's current key again returns it unchanged. Replacing a current key needs replacementProof; a key the device already replaced is never accepted again. The body is limited to 4 KiB.
Auth: Device session with Take Control, on the owner's own paired device (not a connector, support session or automation run).
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
publicKey |
string | Yes | The device's P-256 public key, 87-character base64url. |
deviceKeyId |
string | No | 43-character key id; must match the id the service derives from publicKey. |
proof |
string | Yes | Signature from the device's new key, base64url. |
replacementProof |
string | When replacing a key | Signature from the device's current key, base64url. |
Response 200
| Field | Type | Description |
|---|---|---|
deviceKeyId |
string | Key id. |
ownerId |
string | The owner the key belongs to. |
publicKey |
string | The registered public key. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | forbidden |
The device is not the owner's own active device with Take Control. |
| 400 | malformed |
Body does not match the schema. |
| 400 | invalid_public_key |
publicKey is not a valid P-256 key. |
| 400 | key_id_mismatch |
deviceKeyId does not match the key. |
| 400 | invalid_proof |
proof is not valid for this device and key. |
| 409 | key_registered_elsewhere |
Another device registered this key. |
| 409 | key_retired |
This key was replaced and cannot come back. |
| 403 | replacement_proof_required |
The device has a current key and no replacementProof was sent. |
| 403 | invalid_replacement_proof |
replacementProof is not valid. |
| 401 | device_authentication_required |
Missing or invalid device session. |
| 401 | expired |
The session expired. |
| 401 | revoked |
The device was revoked. |
| 503 | owner_keys_unavailable |
The key store cannot be written. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/devices/self/owner-key \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"publicKey":"'"$OWNER_PUBLIC_KEY"'","proof":"'"$OWNER_KEY_PROOF"'"}'Reset a device's owner key
POST /v1/devices/:id/owner-key/reset
Retires a device's current owner key, for a lost key. The retired key reads as revoked, and the device's next registration starts fresh.
Auth: Operator token.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | Device id. |
Response 200
| Field | Type | Description |
|---|---|---|
deviceId |
string | The device. |
reset |
boolean | true when a current key was retired, false when the device had none. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 404 | device_not_found |
No such device. |
| 503 | owner_keys_unavailable |
The key store cannot be written. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/devices/$DEVICE_ID/owner-key/reset \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"List owner keys
GET /v1/owner-keys
Lists every registered owner public key. A key carries revokedAt once it was replaced, its device was revoked or stopped being the owner's, or its automation run ended.
Auth: None.
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
number | Always 1. |
keys |
object[] | Registered keys. |
keys[].deviceKeyId |
string | Key id. |
keys[].ownerId |
string | The owner the key belongs to. |
keys[].publicKey |
string | Public key, base64url. |
keys[].revokedAt |
string | Optional. ISO time the key stopped being valid. |
curl -sS http://127.0.0.1:4310/v1/owner-keysSupport grants
A support grant is a time-limited window the owner opens for support. A read-state grant can mint a pairing offer for a support device, which pairs with no grants and can only read its own registration and refresh its session. These routes refuse anyone but the owner with 403 owner_required.
A grant has these fields:
| Field | Type | Description |
|---|---|---|
grantId |
string | UUID. |
scope |
string | read-state or shell. |
status |
string | active, revoked or expired. |
createdAt |
string | ISO creation time. |
expiresAt |
string | ISO expiry time. |
revokedAt |
string | Optional. ISO revocation time. |
supportRef |
string | The owner's support reference. |
List support grants
GET /v1/support/grants
Lists all support grants.
Auth: Operator token or Device session with Take Control.
Response 200
| Field | Type | Description |
|---|---|---|
grants |
object[] | Support grants. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | owner_required |
The caller is not the owner. |
curl -sS http://127.0.0.1:4310/v1/support/grants \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Create a support grant
POST /v1/support/grants
Opens a support window. The body is limited to 2 KiB.
Auth: Operator token or Device session with Take Control.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
scope |
string | Yes | read-state or shell. |
durationSeconds |
integer | Yes | 1 to 259200 (72 hours). |
supportRef |
string | Yes | Support reference, 1 to 128 characters. |
Response 200
The created grant.
Errors
| Status | error |
When |
|---|---|---|
| 400 | invalid_support_grant |
Body does not match the schema. |
| 403 | owner_required |
The caller is not the owner. |
| 409 | support_window_capacity |
Too many unexpired grants. |
| 503 | support_unavailable |
The grant could not be recorded. |
curl -sS -X POST http://127.0.0.1:4310/v1/support/grants \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"scope":"read-state","durationSeconds":3600,"supportRef":"ticket-123"}'Revoke a support grant
POST /v1/support/grants/:id/revoke
Revokes a grant. Revoking a grant that is no longer active returns it unchanged.
Auth: Operator token or Device session with Take Control.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | Grant id. |
Response 200
The grant after revocation.
Errors
| Status | error |
When |
|---|---|---|
| 403 | owner_required |
The caller is not the owner. |
| 404 | support_grant_not_found |
No such grant. |
curl -sS -X POST http://127.0.0.1:4310/v1/support/grants/$GRANT_ID/revoke \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Create a support pairing offer
POST /v1/support/grants/:id/pairing-offer
Mints a single-use pairing offer for a support device under an active read-state grant. The offer lasts five minutes or until the grant expires, whichever comes first. The support device redeems and completes it like any other offer.
Auth: Operator token or Device session with Take Control.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | Grant id. |
Response 200
| Field | Type | Description |
|---|---|---|
version |
number | Always 1. |
deepLink |
string | clankie://connect pairing link. |
code |
string | The code to hand to the device. When the link goes through the public gateway this is the full link. |
expiresAt |
string | ISO time the offer expires. |
gateway |
boolean | Optional. true when the link carries the public gateway route. |
direct |
string | Optional. The Mac's direct control origin. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | owner_required |
The caller is not the owner. |
| 410 | support_grant_inactive |
The grant is not active, or ended while the offer was minted. |
| 409 | support_pairing_requires_read_state |
The grant's scope is shell. |
| 503 | public_gateway_unavailable |
The public gateway cannot carry the offer and no direct route is configured. |
curl -sS -X POST http://127.0.0.1:4310/v1/support/grants/$GRANT_ID/pairing-offer \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Account tokens
Account API tokens (clk_…) are minted by the account portal. The owner registers a token's hash on the Mac; the token can then read this Mac's devices until it expires or is removed. Tokens are read only. When the Mac is bound to one account workspace, only that workspace's tokens register or work. Responses are not cached.
A token entry has these fields:
| Field | Type | Description |
|---|---|---|
id |
string | Token entry id. |
prefix |
string | Display prefix, clk_ plus six characters. |
workspaceId |
string | Account workspace. |
scopes |
string[] | machines:read, devices:read. |
expiresAt |
string | ISO expiry time. |
createdAt |
string | ISO registration time. |
lastUsedAt |
string | Optional. ISO time last used. |
List account tokens
GET /v1/account-tokens
Lists registered tokens. Hashes are never returned.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
tokens |
object[] | Token entries. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
curl -sS http://127.0.0.1:4310/v1/account-tokens \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Register an account token
POST /v1/account-tokens
Registers a token by its hash. Expired entries are dropped when a new one is added. The body is limited to 4 KiB.
Auth: Operator token.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
tokenHash |
string | Yes | Lowercase hex SHA-256 of the whole token, clk_ included. |
prefix |
string | Yes | Display prefix: clk_ plus six characters. |
workspaceId |
string | Yes | Account workspace, 1 to 128 letters, digits, _ or -. |
scopes |
string[] | Yes | One or both of machines:read, devices:read. |
expiresAt |
string | Yes | ISO expiry time, in the future. |
Response 200
The registered token entry.
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 400 | malformed |
Body does not match the schema. |
| 400 | expired |
expiresAt is not in the future. |
| 400 | capacity |
The Mac holds the maximum of 256 live tokens. |
| 409 | duplicate |
This hash is already registered. |
| 403 | wrong_workspace |
The Mac is bound to a different workspace. |
| 503 | account_tokens_unavailable |
The token store cannot be written. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/account-tokens \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tokenHash":"'"$TOKEN_HASH"'","prefix":"'"$TOKEN_PREFIX"'","workspaceId":"'"$WORKSPACE_ID"'","scopes":["devices:read"],"expiresAt":"2027-01-01T00:00:00Z"}'Remove an account token
DELETE /v1/account-tokens/:id
Removes a token. It stops working on the next request.
Auth: Operator token.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | Token entry id. |
Response 200
| Field | Type | Description |
|---|---|---|
ok |
boolean | Always true. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 404 | account_token_not_found |
No such token entry. |
| 503 | account_tokens_unavailable |
The token store cannot be written. |
| 503 | operator_authentication_unavailable |
Operator authentication cannot run. |
curl -sS -X DELETE http://127.0.0.1:4310/v1/account-tokens/$TOKEN_ID \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"List devices with an account token
GET /v1/account/devices
Lists this Mac's devices, with the same items and order as GET /v1/devices (not grouped).
Auth: Account token with devices:read.
Response 200
An array of device list items.
Errors
| Status | error |
When |
|---|---|---|
| 401 | account_token_required |
Missing, unknown or wrong-workspace token. |
| 401 | account_token_expired |
The token expired. |
| 403 | insufficient_scope |
The token lacks devices:read. |
| 503 | account_tokens_unavailable |
The token store cannot be read. |
curl -sS http://127.0.0.1:4310/v1/account/devices \
-H "Authorization: Bearer $CLANKIE_ACCOUNT_TOKEN"Owner asks
An owner ask is a step a worker needs the owner to approve himself, such as installing one exact build on one of his devices. The owner's app lists open asks as cards and answers each with an approval or a decline. Open asks close unanswered after 30 minutes, and asks are kept in memory, so a restart drops them. Responses are not cached.
An ask card has these fields:
| Field | Type | Description |
|---|---|---|
askId |
string | Lowercase UUID. |
kind |
string | Always install. |
state |
string | open, approved, declined or expired. |
raisedAt |
string | ISO time raised. |
expiresAt |
string | ISO time the ask closes unanswered. |
worker.seatId |
string | The raising worker's seat. |
worker.occupantId |
string | Identifier of the worker's running session. |
worker.displayName |
string | Worker name to show. |
install.app |
string | App name. |
install.build |
string | 40-hex commit the build was made from. |
install.target.id |
string | Target device, as platform:id. |
install.target.name |
string | Target device name to show. |
install.target.kind |
string | iphone, ipad, watch, mac, pc or other. |
install.launch |
boolean | Whether the worker may open the app after installing. |
project |
string | Project name. |
issue |
string | Optional. Related issue. |
binding |
object | The decision an approval of this ask covers: decisionId, decisionRevision, action, seat.id, seat.occupantId, optional sourceRevision, optional target. |
decidedAt |
string | Optional. ISO time approved or declined. |
List owner asks
GET /v1/owner/asks
Lists asks, open ones first, newest first within a state. Answered and expired asks stay listed for a while after they close.
Auth: Operator token or Device session on the owner's own paired device (not a connector, support session or automation run).
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
number | Always 1. |
asks |
object[] | Ask cards. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | device_authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device is not the owner's own paired device. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS http://127.0.0.1:4310/v1/owner/asks \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN"Approve an owner ask
POST /v1/owner/asks/:askId/approve
Approves an open ask with an approval the owner's device signed with its current owner key. The service checks it before storing it; the raising worker reads it back. The operator token cannot approve. The body is limited to 4 KiB.
Auth: Device session on the owner's own paired device (not a connector, support session or automation run).
Path parameters
| Name | Type | Description |
|---|---|---|
askId |
string | Ask id. |
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
approval |
object | Yes | Signed approval from the device's owner key for this ask's binding. |
Response 200
| Field | Type | Description |
|---|---|---|
ask |
object | The ask card, now approved. |
Errors
| Status | error |
When |
|---|---|---|
| 404 | not_found |
No such ask. |
| 409 | approved, declined or expired |
The ask is no longer open; error is its state. |
| 400 | malformed |
Body or approval does not parse. |
| 403 | not_this_devices_key |
The approval was not made with this device's current owner key. |
| 422 | approval_refused |
The approval does not hold for this ask. The body also carries a code. |
| 409 | settled |
The ask was answered while this request ran. |
| 403 | forbidden |
The device is not the owner's own paired device. |
| 401 | device_authentication_required |
Missing or invalid device session. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/owner/asks/$ASK_ID/approve \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"approval":'"$SIGNED_APPROVAL_JSON"'}'Decline an owner ask
POST /v1/owner/asks/:askId/decline
Declines an open ask. The operator token cannot decline. The body is limited to 2 KiB.
Auth: Device session on the owner's own paired device (not a connector, support session or automation run).
Path parameters
| Name | Type | Description |
|---|---|---|
askId |
string | Ask id. |
Request body (JSON, optional)
| Field | Type | Required | Description |
|---|---|---|---|
note |
string | No | Up to 500 characters. |
Response 200
| Field | Type | Description |
|---|---|---|
ask |
object | The ask card, now declined. |
Errors
| Status | error |
When |
|---|---|---|
| 404 | not_found |
No such ask. |
| 409 | approved, declined or expired |
The ask is no longer open; error is its state. |
| 400 | malformed |
Body does not match the schema. |
| 403 | forbidden |
The device is not the owner's own paired device. |
| 401 | device_authentication_required |
Missing or invalid device session. |
| 503 | device_authentication_unavailable |
Device authentication cannot run. |
curl -sS -X POST http://127.0.0.1:4310/v1/owner/asks/$ASK_ID/decline \
-H "Authorization: Bearer $CLANKIE_DEVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'