HTTP API#

Every endpoint is under /api/neuralui/v1/ and needs a logged in session (the cookie set by POST login) or a Cortex API key in an X-API-KEY header, except login itself. Requests that change something must come from the UI’s own origin (see Deployment). Answers are JSON: {"status": "ok", "result": ...} or {"status": "err", "code": ..., "mesg": ...}.

Within v1 an endpoint can gain optional fields and new endpoints can be added; nothing is removed or changes meaning (Stability). The jobs endpoints and stix/config are experimental.

This page is made from the service’s code (its routes and their handlers’ descriptions).

login#

POST /api/neuralui/v1/login

Log in with Cortex credentials.

Unlike the Synapse login API, an unknown user, a wrong password and a locked account all get the same answer (no user name probing), and repeated failures are throttled (429 with Retry-After).

logout#

POST /api/neuralui/v1/logout

POST: log out (the session ends, and its WebSockets close). Only POST: a GET answers 405, so an image in a note or a link can not end someone’s session.

me#

GET /api/neuralui/v1/me

GET: the logged in user (their Cortex user definition), with what NeuralUI adds: its version and build, how the session logged in (password or API key), and whether the Cortex is connected.

sessions/revoke#

POST /api/neuralui/v1/sessions/revoke

POST {user?}: log a user out everywhere: every session they have ends (this one too, for your own), and their sockets close. Your own user by default; another user’s needs a Cortex admin (after setting their password, say).

model#

GET /api/neuralui/v1/model

Return a compact version of the Cortex data model for the UI.

extensions#

GET /api/neuralui/v1/extensions

GET: the right-click actions and note types for this user, from every Storm package in the Cortex: their neuralui: actions, the Optic actions of Rapid Power-Ups and the commands which take forms, as an admin’s settings and the user’s permissions allow. ?hash=<the last answer’s hash> answers {unchanged: true} when nothing changed. See the package format for what an action holds.

admin/actions#

GET PUT /api/neuralui/v1/admin/actions

Admin > Actions (Cortex admins only): every action of every package with no filtering, the entries which could not be used and why, and the admin’s settings (GET); PUT replaces the settings.

jobs#

GET POST /api/neuralui/v1/jobs

The user’s background jobs (right-click actions the service runs, in batches, as the user). Experimental. GET lists them, newest first. POST starts one: {label, query, idens, batch, secret, opts: {vars, view}}, where secret names the variables which must not be stored (password arguments); 429 when the user or the service runs as many as it may.

jobs/<iden>/resume#

POST /api/neuralui/v1/jobs/<iden>/resume

POST: run the rest of one of the session user’s interrupted or cancelled jobs.

jobs/<iden>#

GET DELETE /api/neuralui/v1/jobs/<iden>

One of the session user’s jobs: GET it in full (its messages and nodes), DELETE stops it or forgets it.

stix/config#

GET /api/neuralui/v1/stix/config

GET: StormLib++’s STIX ingest config ($lib.stix.import.config shaped: how each STIX object type and relationship becomes nodes), for STIX bundles on the Import page. The page runs $lib.stix.import.ingest with it, as the user. Experimental.

call#

POST /api/neuralui/v1/call

Run a Storm query which returns a value (callStorm) as the session user.

scrape#

POST /api/neuralui/v1/scrape

Scrape potential nodes from text and report whether they already exist.

storm/lint#

POST /api/neuralui/v1/storm/lint

Lint Storm text. This runs in the NeuralUI service against cached Cortex metadata and does not call the Cortex, so the editor can call it as the user types.

storm/docs#

GET /api/neuralui/v1/storm/docs

Commands and $lib docs for editor completion (from the linter’s cached metadata, so this does not call the Cortex).

history[/<id>]#

GET POST DELETE /api/neuralui/v1/history[/<id>]

The session user’s query history (kept by the NeuralUI service, not in the graph).

GET     /history?q=<text>&before=<id>&limit=<n>   newest first
POST    /history {query, mode, view, count, took, error}
DELETE  /history/<id>  or  /history  (all of it)

export#

POST /api/neuralui/v1/export

Export nodes from a query or a list of idens, optionally with related nodes.

POST /export {format, query | idens, mode, view, traverse, limit}

format: count {count, truncated}: how many nodes the export would hold (a preview) nodes a Synapse .nodes file (msgpack stream, see Cortex.exportStorm) stix a STIX 2.1 bundle (JSON); forms with no STIX mapping are listed in the X-NeuralUI-Skipped header

traverse: {refs_out, refs_in, edges_out, edges_in: bool, depth: 1-3}

share[/<id>]#

GET POST DELETE /api/neuralui/v1/share[/<id>]

Short share links. The link is /#s=; the UI resolves the id here.

POST    /share {kind: query, query, mode, view, title}  or  {kind: node, iden, view}
GET     /share/<id>
DELETE  /share/<id>    (only the user who made it)

storm#

WebSocket /api/neuralui/v1/storm

A WebSocket which streams Storm messages for multiple concurrent queries.

Client messages: {“type”: “storm:run”, “id”: , “query”: , “opts”: {…}, “window”: , “truncate”: } {“type”: “storm:ack”, “id”: , “count”: } {“type”: “storm:cancel”, “id”: }

window (optional) turns on flow control: no more than window messages are sent before the client acknowledges them with storm:ack. A client that stops acking pauses the query. truncate (optional) shortens prop values longer than that many characters in node messages (see truncPode).

Server messages: {“type”: “ready”, “data”: {“user”: , “username”: }} {“type”: “storm:mesg”, “data”: {“id”: , “mesg”: [, ]}} {“type”: “storm:done”, “data”: {“id”: }} {“type”: “storm:error”, “data”: {“id”: , “err”: {“code”, “mesg”}}}

axon/upload#

POST PUT /api/neuralui/v1/axon/upload

Stream an upload into the Axon (via the Cortex) and create a file:bytes node.

Query params: name The file name. view The view to create the file:bytes node in. tags A comma separated list of tags to add to the node.

axon/files/<id>/range#

GET /api/neuralui/v1/axon/files/<id>/range

Read part of a file in the Axon (for the hex and strings viewers).

Query params: offs The offset to start reading at (default 0). size The number of bytes to read (default and maximum 1 MiB).

The bytes are read with $lib.axon.read() as the session user, so the Cortex enforces axon.get. The total file size is returned in the X-NeuralUI-File-Size header.

axon/files/<id>#

GET /api/neuralui/v1/axon/files/<id>

Download a file from the Axon (via the Cortex) by SHA256.