HTTP API

1file
1figure
4min read
Sheet 36 of 47 · Automation

Filesconfig.json

Fileconfig.jsonEverything the window does is also a local HTTP endpoint, so scripts, CI jobs and agents can drive bots, the server and test runs. It listens on loopback only. Plain GET with query parameters, JSON back, POST bodies where noted.

The API page: each recipe is one call, with the token already in the copied command.
The API page listening on loopback, with Recipes, Endpoints and Usage tabs and a list of curl recipes, each with Try it and Copy buttons

A quick session

The examples on the API sheets assume the tool runs with --api-port 8767. The default port is 8766.

TOKEN=$(cat "$LOCALAPPDATA/IgniteTestTool/api-token.txt")
curl "localhost:8767/join?name=TestBot"
curl -H "X-ITT-Token: $TOKEN" "localhost:8767/chat?bot=TestBot&c=/is&wait=1500"
curl "localhost:8767/click?bot=TestBot&slot=21"
curl "localhost:8767/dialog?bot=TestBot"
curl -H "X-ITT-Token: $TOKEN" "localhost:8767/quit?bot=TestBot"

The API page shows curl lines with the header and has a button that copies the token.

Errors

Errors come back as {"error":"..."} with a 4xx or 5xx status. Inside /batch every call still answers {"error":"..."} in the list.

StatusWhen
400Bad input or a failed bot action
401Missing token
403Refused caller
404Unknown endpoint
502The agent is unreachable
500Anything else

Security

Any web page open in a browser on the same machine can send requests to 127.0.0.1, so the API does not trust loopback alone.

  • A request with an Origin header is refused. Browsers send one on cross-site fetches and form posts; curl, scripts and the tool itself never do.
  • The Host header must be 127.0.0.1, localhost or [::1], with any port. A DNS rebinding page arrives with its own host name and is refused.
  • Routes that run commands, change files or settings, make bots type, or start a process need the token, as the X-ITT-Token header or token=.

The token

Config keyapi-token.txtThe token is made on the first start and kept in api-token.txt in the data folder. ITT_API_TOKEN in the environment replaces it, handy for CI jobs and scripts that start the tool themselves.

Routes that need it

/run, /start, /stop, /console, /shutdown, /quit, /chat, /act, /bulk, /packet, /packet/send, /rcon, /batch, /takeover, /scenario/save, /scenario/run, /server/exec, /server/entity/set, /server/restore, /server/snapshot, /server/dummy, /server/dummy/clear, /server/install-agent, /server/player/reset, /server/events/watch, /server/events/clear, /server/inspect, /server/invoke, /server/sql, /server/mongo, /server/redis, /deploy, /deploy/cancel, /workflow/set, /suite/run, /suite/cancel, /schedule/run, /load/start, /soak/start, /fuzz/start, /spark/start, /watch/start, /diff/snapshot, /visual/check, /record/scenario/start, /record/scenario/stop, /coverage/reset, /coverage/code/on, /coverage/code/off, /coverage/code/reset, /cache/clear, /usage/clear, /checkpoint/save, /checkpoint/restore, /checkpoint/drop, /panel, and the filming routes, which drive the client or start ffmpeg, node or the OBS script: /release, /film, /film/coverage, /shoot, /sequence, /autofilm, /produce, /render, /edl, /job/submit, /scene/stage, /scene/act and /scene/choreo.

Reads like /status, /bots, /win, /history or /coverage work without it, and so do /join, /swarm, /click, /crawl/start, /scan and /cine.

Token mode

Fileconfig.jsonapiTokenMode in config.json (Settings > API > Token needed for) picks where the token is needed.

apiTokenModeToken needed on
execThe routes listed above. The default
allEvery route
offNothing, for old scripts that cannot send it

Bots

EndpointParametersReturns
/joinname or account, optional host, port, version, reconnect=1, confirmHost=1{"ok":true} once the bot spawns, or {"ok":false,"error":...} after 10 s
/botsnames of the running bots
/swarmcount, pattern=Test_{n}, from, stagger, host, port, version, reconnect, or accounts=all / a,bthe names it started
/accountssaved accounts: name, uuid, token expiry, which bot uses it. Never tokens
/quitbot, or none to quit every bot{"bye":true}
/actbot, action, then the action's own parametersany action, e.g. goto, follow, sneak, craft, raw
/bulkbots=all / online / a,b / Test_* (default online), action, timeout=60 (s), ...one result per bot
/actionsevery action with its group and parameters

Action shortcuts

These call an action directly, with bot plus the action's parameters:

/chat /click /win /close /inv /equip /hotbar /swap /drop /clickItem /craft /place /activate /dig /use /look /poke /attack /entities /sign /dialog /log /pos /stats /server

The ones used most:

EndpointParametersReturns
/chatbot, c (text or /command), wait=1200chat lines seen in wait ms, and the window if one opened
/winbot, full=1 to include the player inventorythe open window, or null. With full=1 and no window open, the player inventory alone (minecraft:inventory, slots 0-45)
/clickbot, slot, button=0/1, mode=1 for shift, wait=1500chat and the window after the click
/closebot{"ok":true}
/dialogbotthe last dialog, or null once the server clears it

What a window and a dialog look like is on Windows, Dialogs & Packets.

More routes

Loading the index

Enter openUp Down moveEsc close