Hydra Engine

API Reference

Protocol version 2: JSON lines over loopback.

One JSON object per line, UTF-8, ending in \n, at most 64 MiB. On a socket the first request is hello with the token; on stdio it isn't needed. Fields marked ? are optional and default to the client's active project or program.

Requests and responses

json
{"id": 7, "cmd": "decompile", "program": "p1:/game.exe", "address": "rva:0x5d53a0", "wait": 10000}{"id": 7, "ok": true, "result": {"c": "...", "signature": "..."}, "ms": 12}{"id": 7, "ok": false, "error": {"code": "busy", "message": "...", "details": {...}}, "ms": 500}
Request fieldMeaning
idAny JSON value, echoed in the response. Unique among your unanswered requests.
cmdThe command.
waitMilliseconds the request may wait for a slot or lock before busy. Default 10000.
paralleltrue runs it at once on its own thread instead of after your earlier requests.
client, harnessLabels for this request alone (at most 128 characters each).

A response may also carry stale (read-only views whose project changed on disk) and refreshed (projects another client refreshed). Events have no ok: ready on stdio, and progress for long requests, at most one a second.

Session

cmdFieldsDoes
helloclient, harness, clientVersion, tokenNames the client; answers protocol, minClient, hydraVersion, ghidraVersion, installId.
ping{"pong": true}
statusEverything: projects, programs, clients and their requests, lanes, imports, overlays, memory.
canceltarget | all | cacheBuildCancels requests, running or queued.
shutdownforceStops the daemon; refused while other clients are connected, unless force.

Projects

cmdFieldsDoes
open_projectpath, writable, discardJoins the project, opening it if needed; makes it active.
close_projectproject?, discardLeaves it, closing your programs there.
projectsOpen projects, which you joined, your active one.
projectproject?Paths, users, programs, revision, stale, fork.
listfolder, recursive, programsOnly, sha256, offset, limitFolders and programs with keys and hashes, paged.
refresh / reopenproject?, forceReopens a read-only view on what's saved now, for all its clients.
fork_projectproject, path, name?, writable, mode, maxCopyMb?Makes and opens a working copy.
importfile, folder, name, language, compiler, analyze, duplicateImports into a writable project, once per SHA-256.

Programs

cmdFieldsDoes
open_program / switchpath, writable, share, overlay?, upgrade, checkout, waitOpens or joins a program and makes it active.
programsYour programs in all projects.
infoprogram?, overlay?Language, image base, hashes, function count, mode, users, revision.
functionscontains, regex, offset, limit (max 10000), overlay?Functions by name, paged.
decompileaddress | name, timeout, maxChars, overlay?C text and signature, from a pooled decompiler.
close_programprogram?, discardDrops your use; an owner with changes must save or discard.

Changing programs

cmdFieldsDoes
renameaddress, name, kind, expect?, overlay?Renames a function or creates/renames a label.
commentaddress, text, type, expect?, overlay?Sets or clears (null) a comment.
editopsSeveral operations in one transaction, all or none.
analyzeoptions, ranges, timeoutAuto-analysis, as analyzeHeadless runs it.
savecommentSaves; answers the new revision.
journalsince, author, limitWho changed what, in commit order.
discard_editsauthorReverts one author's unsaved renames, labels and comments.
scriptscript, args, exclusive, save, timeout, maxChars, artifactRuns a GhidraScript; contained unless you may write.

Overlays

cmdFieldsDoes
apply_overlayoverlay, opsApplies rename, label, comment, signature, data_type operations, all or none.
promote_overlayoverlay, project | fork, saveReplays the overlay into a writable copy and saves it.
drop_overlayoverlayDrops it.
overlaysYour overlays.

Error codes

CodeMeansDo
busyA slot or lock didn't come free within wait.Retry, or raise wait.
not_ownerAnother client owns the program for writing.Use the overlaySuggestion, join with share, or fork.
conflictThe project or value can't be had as asked: another process's lock, a changed value, an upgrade not allowed.Act on details.reason; retrying won't help.
read_onlyThe project or program is open read-only.Open it writable, or fork.
unsaved_changesClosing would lose changes.save, or pass discard.
no_project, no_programNothing active, or nothing by that name.Open one first.
not_foundNo such address, function or file.
cancelledCancelled, or timed out.
failedGhidra raised an error; its message and a short trace are attached.
bad_request, unknown_command, unauthorizedThe request itself is wrong.

busy, conflict, not_owner and read_only carry details.holderInfo (who: client, name, harness, command, how long) and details.suggest: retry, fork_project, open_read_only, share or reread. With fork_project, details.suggestion is a ready request.