Skip to content

The API

Built

The API is the only way in. The console, the CLI, the MCP server and your own scripts all call the same HTTP routes, so each passes the same permission and scope checks, and anything one can do another can.

The routes are Go structs (Huma). From them make gen writes an OpenAPI 3.1 document, and from that document the typed console client, the CLI commands, the MCP tools and the YAML JSONSchema. So there is no hand-kept list of routes to drift from the code: the API reference is the rendered document, and a new route shows up in every client on the next generation.

Send a bearer token in the Authorization header. Mint your own with the console’s Create token action or omniglass auth create-token; the CLI page covers the first owner, and agent tokens are a narrower kind for software acting on your behalf.

Terminal window
curl -H "Authorization: Bearer $OMNIGLASS_TOKEN" https://omniglass.example.com/api/v1/locations

Every route is gated by a <resource>:<action> permission, and every query a route runs is narrowed to the scope your grants reach, so a token sees exactly what its user does.

  • Resources and :verb methods. Routes are AIP-style: a collection (/locations), an item by name or id, and a custom method after a colon for an action that is not a plain update.
  • Batch creates. POST /locations:batchCreate, /systems:batchCreate and /components:batchCreate each take a list of up to 1000 of the single create’s own bodies under requests, run in order in one transaction, every row or none. validate_only: true runs the same transaction and rolls it back, answering 200 with what a write would create; a write answers 201 with a batch_id every audit row it wrote carries as from_batch. A refused row is answered as its single create answers it, led by requests[3]: . See creating in batches.
  • Names address. A resource you type the name of answers to it; the id it returns survives a rename.
  • Lists filter, order and page by cursor.
  • Errors are one problem+json envelope, with the field a 422 refused named.
  • Writes are audited, and long-running work returns an action you read back rather than holding the request open.

The full contract, with the reasoning behind each choice, is on the API architecture page.

  • The CLI for scripting without writing HTTP.
  • Agents and MCP to put an AI agent on the same API.
  • Contributing to change the API itself: a route starts as a test and a Huma struct, and make gen does the rest.