opschain api spec
Included from Basic tier
Prints the OpenAPI document describing the HTTP API. Against a server
(--server <url>, OPSCHAIN_SERVER or the active context) it downloads
that server's document from /api/openapi.yaml (or .json), stamped with
the server's version; with --local, or no server target at all, it prints
the document embedded in this binary, stamped with this binary's version —
so the output always describes the API you are actually talking to.
Flags
| Flag | Meaning |
|---|---|
--out <file> | Write the document to this file instead of stdout. Prints wrote the OpenAPI document to <file> unless --quiet. |
--format yaml|json | Document format (default yaml). |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Document printed or written. |
| 1 | The download failed (e.g. the OpenAPI document request answered <status>), or the file could not be written. |
| 2 | Usage error. |
Named errors
invalid --format "<value>" (must be yaml or json)— exits 2.the OpenAPI document request answered <status>— a non-200 server answer; exits 1.
Examples
Print the embedded document:
opschain api spec --local
Save a server's document as JSON:
opschain api spec --server https://opschain.example.com --format json --out openapi.json
See also
opschain docs cli/api-routes— the same document flattened into a route table.