The JetKVM has an HTTP API for your own code and for AI agents. A script can read the state of the JetKVM, take a screenshot, send keyboard and mouse input, switch the power, mount disk images, and change settings.
| Endpoint | Use |
|---|---|
POST /api/rpc |
Call the methods of the web UI from your own code. |
GET /api/screenshot |
Get the screen of the connected computer as a JPEG image. |
POST /api/mcp |
Connect an AI agent through the Model Context Protocol (MCP). |
All endpoints use the same tokens, roles, and rules.
- In the web UI, go to Settings > Access > Agents and API.
- Turn on Allow agents and API access.
- Select Create API token, select a role, and give the token a name.
- Copy the token. The JetKVM shows it one time only.
Send a JSON-RPC 2.0 request with POST to /api/rpc. Put the token in the
Authorization header.
export JETKVM_TOKEN=jk_...
curl http://jetkvm.local/api/rpc \
-H "Authorization: Bearer $JETKVM_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"getDeviceID"}'The response is a JSON-RPC 2.0 response:
{ "jsonrpc": "2.0", "id": 1, "result": "0123456789abcdef" }Methods with parameters take them by name in params:
curl http://jetkvm.local/api/rpc \
-H "Authorization: Bearer $JETKVM_TOKEN" \
-d '{"jsonrpc":"2.0","id":2,"method":"setATXPowerAction","params":{"action":"power-short"}}'Send one request object for each call. Batch requests are not supported.
GET /api/screenshot returns the screen of the connected computer as a JPEG
image. A browser does not have to be connected. The call needs the View role.
curl http://jetkvm.local/api/screenshot \
-H "Authorization: Bearer $JETKVM_TOKEN" \
-o screen.jpgThe image is at most 1280 by 720 pixels and keeps the aspect ratio of the screen. To read small text, get a part of the screen. A smaller part has more detail:
curl "http://jetkvm.local/api/screenshot?region=640,0,320,180" \
-H "Authorization: Bearer $JETKVM_TOKEN" \
-o part.jpgregion is x,y,width,height in pixels of the screenshot.
If video capture is off, the JetKVM starts it for the call. That first call can take 1 to 3 seconds. Capture stops 30 seconds after the last call.
The call returns status 503 when the computer sends no picture, for example when it is off or asleep, and while OS Services sends the video. To get screenshots in that case, turn off Video in the OS Services settings.
/api/mcp is an MCP server with the Streamable HTTP transport. An agent can see
the screen and operate the connected computer with it.
-
In the web UI, go to Settings > Access > Agents and API.
-
Select Connect an agent, select the client and a role, and give the token a name.
-
Run the command that the page shows. For Claude Code, the command is:
claude mcp add --transport http jetkvm http://jetkvm.local/api/mcp \ --header "Authorization: Bearer jk_..."
The role of the token sets the tools that the agent gets.
| Tool | Role | The agent can |
|---|---|---|
screenshot |
View | See the screen. |
zoom |
View | See a part of the screen in more detail, to read small text. |
click |
Control | Click, double-click, or right-click at a point. |
move_mouse |
Control | Move the pointer to a point. |
drag |
Control | Drag from one point to a second point. |
scroll |
Control | Turn the mouse wheel at a point. A computer with natural scrolling, which is the default on macOS, moves the content the opposite way. |
type_text |
Control | Type text. |
paste_text |
Control | Paste text through the clipboard. Needs OS Services. |
copy_text |
Control | Get the clipboard text as exact characters. Needs OS Services. |
press_key |
Control | Press a key or a key combination, for example ctrl+c. |
power |
Control | Press the power or reset button, switch the DC power on or off, wake the computer, or read the power state. The button actions need the ATX Power Control extension. The DC actions need the DC Power Control extension. |
mount_image |
Control | Connect a disk image from a URL as a virtual USB drive. |
unmount_image |
Control | Remove the virtual USB drive. |
terminal |
Control | Run commands in a shell on the connected computer. Needs OS Services. |
serial |
Control | Send text to the serial port of the JetKVM and read what the device on that port sends. Needs the Serial Console extension. |
list_methods |
Admin | List the methods of /api/rpc. |
call_method |
Admin | Call a method of /api/rpc. |
shell |
Admin | Run commands in a root shell on the JetKVM itself. |
- All coordinates are pixels in the image from
screenshot. - Each tool that changes the screen returns a new screenshot. The JetKVM waits until the screen stops changing, for a maximum of 1.2 seconds.
type_textuses the keyboard layout from Settings > Keyboard. Set it to the layout of the connected computer. One call types a maximum of 2000 characters.paste_textandcopy_textuse the clipboard of the connected computer. They need OS Services on that computer, with clipboard sharing on. Without it, the call returns an error that tells the agent to usetype_textor to read the text from a screenshot.copy_textreturns the text that is on the clipboard, so the agent selects the text and presses the copy shortcut first.terminal,serial, andshellwork in the same way:inputis the text to send. Write\nfor Enter.terminalandshellsend Enter as a terminal does.serialsends the text as it is.- The call returns the output that arrives after the input. It returns when the output stops for 300 ms, or after a maximum of 5 seconds.
- A call without
inputreturns only the new output. Use it to read more output of a long command. - The output is plain text. The JetKVM removes the terminal control codes.
- The JetKVM keeps a maximum of 16 KB of output that the agent did not read. It drops the oldest output first, and the result says so.
- Each tool has one session, and all tokens share it. The session stays open between calls, so the current directory and a login stay. It is separate from the terminal of a person in the web UI. A person in the web UI sees the same serial output as the agent.
- The session closes after 10 minutes without a call. It also closes when a person turns API access off, and when the token that used it last is revoked or expires. The next call starts a new session.
- While a person has control, a
terminalorserialcall withinputreturns an error. A call withoutinputstill returns the new output.shellis not affected. The sessions stay open. terminalneeds OS Services on the connected computer, with the terminal on.serialneeds Serial Console as the active extension. Without them, the call returns an error that says what to do.
- A failed tool call returns a result with
isErrorand a message that says what to do.
Each token has one role. A role includes the methods of the roles before it.
| Role | The token can |
|---|---|
| View | Read the state of the JetKVM and of the connected computer. |
| Control | Operate the connected computer: keyboard, mouse, power, disk images, the OS Services terminal, and the serial console. |
| Admin | Change the settings of the JetKVM, update it, and reset it. Run commands as root on the JetKVM. |
A method that is not in the View or Control table needs the Admin role.
Some methods work only in the web UI, with every role. No token can call them
through /api/rpc or call_method. A View token or a Control token cannot
create or revoke tokens, turn API access on, take or release control, turn on
developer mode, or set the SSH key.
An Admin token is different. The shell tool gives it a root shell on the
JetKVM, and root can change each file and setting of the JetKVM. Thus an Admin
token can do all that a person can do in the web UI, and these methods do not
limit it.
A failed call has an error object with a code and a message. The message
says what to do.
| HTTP status | Code | Cause |
|---|---|---|
| 400 | -32700 | The body is not one JSON-RPC request object. |
| 400 | -32602 | A parameter of /api/screenshot is not valid. |
| 401 | -32001 | The token is missing, not valid, revoked, or expired. |
| 403 | -32002 | The role of the token does not include the method. |
| 403 | -32004 | API access is off. |
| 409 | -32005 | A person is using the keyboard or mouse, or has control of them. |
| 200 | -32601 | The method does not exist. |
| 200 | -32603 | The method failed. The cause is in data. |
| 503 | -32603 | No screenshot is available. The message gives the cause. |
- A person has priority. After a person presses a key, clicks, or scrolls in the web UI, input methods return error -32005 for 5 seconds. Wait and send the call again. Other methods are not affected. Text that a token types stops at that moment, and the call returns the error. A token gets the same error while a paste or a keyboard macro runs. A mouse move alone does not start the 5 seconds. It extends them while they run.
- A person can take control. A person selects Take control in the web UI. Then input methods and input tools return error -32005 until that person selects Resume. Input that is in progress stops. Screenshots and all other methods continue to work, so a token can see what the person does. Wait and send the call again. Control also ends when that person closes or reloads the web UI, or when a different browser connects.
- Tokens can expire. A token with an expiry date stops on that date. Create a new token in the web UI.
- The name of the token is visible. While a token sends input or takes a screenshot, the web UI shows a border around the screen, the name of the token, and its last action.
- The JetKVM stores a hash of each token. It cannot show a token again.
- With
http://, the token is sent as clear text. Use the API on a network that you trust, or use the Tailscale address of the JetKVM. - Give each script its own token with the lowest role that works. Revoke a token when you stop using it.
- An Admin token can change the network settings, install an update, and reset
the JetKVM to the factory state. With the
shelltool, it also has a root shell on the JetKVM. Treat an Admin token as full control of the JetKVM, including its tokens, developer mode, and the SSH key. - A Control token can run commands on the connected computer with the
terminaltool, when the terminal is on in the OS Services settings.
The methods are the methods of the web UI. They follow the firmware version, and
a new version can change or remove a method. Read getLocalVersion if your code
depends on a version.
The tables are generated from the handler table in jsonrpc.go. A parameter
with ? is optional. To update the tables, run:
go test -run TestAPIReferenceIsCurrent -update-api-reference .| Method | Parameters | Result |
|---|---|---|
getATXState |
object | |
getActiveExtension |
string | |
getDCPowerState |
object | |
getDeviceCapabilities |
string[] | |
getDeviceID |
string | |
getJigglerState |
boolean | |
getKeyDownState |
object | |
getKeyboardLayout |
string | |
getKeyboardLedState |
object | |
getLocalVersion |
object | |
getStorageDownloadState |
object | |
getStorageSpace |
object | |
getUSBState |
string | |
getUsbEmulationState |
boolean | |
getVideoState |
object | |
getVirtualMediaState |
object | |
listStorageFiles |
object | |
ping |
string |
| Method | Parameters | Result |
|---|---|---|
absMouseReport |
x: number, y: number, buttons: number |
|
cancelStorageDownload |
||
checkMountUrl |
url: string |
object |
getKeyboardMacros |
any | |
getWakeOnLanDevices |
object[] | |
guestClipboardGet |
object | |
guestClipboardSet |
text: string |
object |
keyboardReport |
modifier: number, keys: number[] |
|
keypressReport |
key: number, press: boolean |
|
mountBuiltinInstaller |
||
mountWithHTTP |
url: string, mode: string |
|
mountWithStorage |
filename: string, mode: string |
|
relMouseReport |
dx: number, dy: number, buttons: number |
|
rpcMountBuiltInImage |
filename: string |
|
runKeyboardMacro |
macro: string |
|
sendWOLMagicPacket |
macAddress: string, broadcastIP?: string |
|
setATXPowerAction |
action: string |
|
setDCPowerState |
enabled: boolean |
|
setJigglerState |
enabled: boolean |
|
startStorageDownload |
url: string, filename: string |
object |
unmountImage |
||
wakeHost |
||
wheelReport |
wheelY: number, wheelX: number |
| Method | Parameters | Result |
|---|---|---|
checkPublicIPAddresses |
||
checkUpdateComponents |
params: object, includePreRelease: boolean |
object |
deleteSerialCommandHistory |
||
deleteStorageFile |
filename: string |
|
deregisterDevice |
||
emitTestLog |
level: string |
|
factoryReset |
||
getAudioConfig |
object | |
getAutoUpdateState |
boolean | |
getBacklightSettings |
object | |
getCloudState |
object | |
getDefaultLogLevel |
string | |
getDevChannelState |
boolean | |
getDevModeState |
object | |
getDisplayRotation |
object | |
getEDID |
string | |
getEDIDPresets |
object[] | |
getHostDisplayIdleMode |
object | |
getJigglerConfig |
object | |
getLocalAuthSessionTimeout |
number | |
getLocalLoopbackOnly |
boolean | |
getMassStorageMode |
string | |
getMqttSettings |
object | |
getMqttStatus |
object | |
getNetworkSettings |
object | |
getNetworkState |
object | |
getOsServicesSettings |
object | |
getPublicIPAddresses |
refresh: boolean |
object[] |
getSSHKeyState |
string | |
getSerialCommandHistory |
string[] | |
getSerialSettings |
object | |
getStreamQualityFactor |
number | |
getSupportedVideoCodecs |
string[] | |
getTLSState |
object | |
getTailscaleControlURL |
string | |
getTailscaleStatus |
object | |
getTimezones |
string[] | |
getUpdateStatus |
object | |
getUpdateStatusChannel |
object | |
getUsbConfig |
object | |
getUsbDevices |
object | |
getVideoCodecPreference |
string | |
getVideoLogStatus |
string | |
getVideoSleepMode |
object | |
guestFileDrop |
drop: object |
object |
guestUpdateStart |
||
isUpdatePending |
boolean | |
loginTailscale |
authKey: string |
|
logoutTailscale |
||
reboot |
force: boolean |
|
renewDHCPLease |
||
sendCustomCommand |
command: string |
|
setActiveExtension |
extensionId: string |
|
setAudioConfig |
params: object |
|
setAutoUpdateState |
enabled: boolean |
boolean |
setBacklightSettings |
params: object |
|
setCloudUrl |
apiUrl: string, appUrl: string |
|
setDCRestoreState |
state: number |
|
setDefaultLogLevel |
level: string |
|
setDevChannelState |
enabled: boolean |
|
setDisplayRotation |
params: object |
|
setEDID |
edid: string |
|
setHostDisplayIdleMode |
enabled: boolean |
|
setJigglerConfig |
jigglerConfig: object |
|
setKeyboardLayout |
layout: string |
|
setKeyboardMacros |
params: object |
any |
setLocalAuthSessionTimeout |
timeoutMinutes: number |
|
setLocalLoopbackOnly |
enabled: boolean |
|
setMassStorageMode |
mode: string |
string |
setMqttSettings |
settings: object |
|
setNetworkSettings |
settings: object |
object |
setOsServicesSettings |
settings: object |
object |
setSerialCommandHistory |
commandHistory: string[] |
|
setSerialSettings |
settings: object |
|
setStreamQualityFactor |
factor: number |
|
setTLSState |
state: object |
|
setTailscaleControlURL |
controlURL: string |
|
setTailscaleEnabled |
enabled: boolean |
|
setTerminalPaused |
terminalPaused: boolean |
|
setUsbConfig |
usbConfig: object |
|
setUsbDeviceState |
device: string, enabled: boolean |
|
setUsbDevices |
devices: object |
|
setUsbEmulationState |
enabled: boolean |
|
setVideoCodecPreference |
codec: string |
|
setVideoSleepMode |
duration: number |
|
setWakeOnLanDevices |
params: object |
|
startStorageFileUpload |
filename: string, size: number |
object |
switchTailscaleToBuiltin |
||
testMqttConnection |
settings: object |
object |
tryUpdate |
||
tryUpdateComponents |
params: object, includePreRelease: boolean, resetConfig: boolean |
| Method | Parameters | Result |
|---|---|---|
createApiToken |
name: string, role: string, client: string, expiresInDays?: number |
object |
getApiAccess |
object | |
revokeApiToken |
id: string |
|
setApiAccessEnabled |
enabled: boolean |
|
setDevModeState |
enabled: boolean |
|
setPersonControl |
held: boolean |
|
setSSHKeyState |
sshKey: string |
|
setVideoStreamPaused |
paused: boolean, hiddenTab: boolean |