Skip to content

OpenAPI contract

Every flow an HTTP door delivers to has an OpenAPI 3.1.1 contract. The engine generates it from the published artifact and the tenant’s gate; nobody writes it by hand, and it changes when you publish a new version.

GET /flows/{tenant}/{name}/openapi.json
HEAD /flows/{tenant}/{name}/openapi.json

The answer is 200, Content-Type: application/json. HEAD gives the same headers without the body.

Terminal window
$ curl http://localhost:9090/flows/acme/order-intake/openapi.json

Who can read it

The flow Who gets the document
Without routes:, or with routes: and serve_by_name: true Anyone, with no credential, as its WSDL
With routes: and without serve_by_name: true A caller whose key or token the gate admits for that flow, with the flow’s required_scope

A tenant that was never registered, or that is disabled, and a name nothing is published under get the same 404 the WSDL route gives them. For a routed flow without serve_by_name: true, every other caller gets that same 404 too: no credential, an invalid or expired one, a key outside its allowlist or without the scope, a caller over its rate. Every refusal is written to the log as an access_denied event with its real reason. The audit chain records only a refusal that names a valid credential: a key outside its allowlist or without the scope. It records nothing for a missing, invalid or expired credential, or for a caller over its rate. See Served by name.

Under nexus serve --no-auth the document is served to anyone whose tenant is visible, as the routes themselves are.

What it contains

Paths: exactly the doors that deliver to the flow.

  • A flow served by name: post on /flows/{tenant}/{name}/run and on /flows/{tenant}/{name}/enqueue.
  • Each declared route: its method on /t/{tenant}<template>, and head beside each get. Each {name} of the template is a required path parameter of type string. options is not listed.
  • Nothing else: not the metadata route, not /wsdl, not this route, no gRPC.

Bodies: no shape is claimed. post, put and patch, and both name doors, carry a requestBody with one entry per media type the door reads, each with the empty schema {}:

Door Media types
/run, a declared route application/json, application/xml, application/soap+xml, text/xml
/enqueue the four above and text/*
a flow with body: opaque */*

get, head and delete carry no body. No response carries content. A flow declares no message schema, so a client generator gets paths, methods, parameters and authentication, and untyped bodies; document your payloads alongside the contract.

Responses: each code is one the platform returns.

Code Listed on When
each literal response_status: the flow declares /run, declared routes always
200 /run, declared routes the main sequence declares no literal 2xx status
202 /enqueue always
400 every operation always
401, 429 every operation the document has security schemes
403 every operation security schemes and the flow declares required_scope
404 every operation always
413 operations with a body always
422 /run, declared routes the flow has a validate rule of kind semantic
default every operation always: any other status, server errors included

Security: the methods the tenant’s gate accepts. One scheme per method, and any one of them suffices:

Tenant method Scheme
api_key http, bearer, bearerFormat: nxk API key
oidc http, bearer, bearerFormat: JWT
client_cert mutualTLS

When the flow declares required_scope, each security requirement names that scope. Under --no-auth the document has no components, no security, and no 401, 403 or 429.

The server address

servers has one entry, <scheme>://<host>: the request’s Host header, with https when the request comes from a peer named by nexus serve --trusted-proxy and carries one X-Forwarded-Proto: https, and http otherwise. It is the rule the WSDL address follows; X-Forwarded-Host and Forwarded are not read. Behind a proxy that terminates TLS, see Gateway boundary.

Exporting it as a file

Terminal window
$ nexus openapi --tenant acme --flow order-intake \
--server-url https://api.acme.example --out order-intake.openapi.json
Flag Required Meaning
--tenant yes
--flow yes The published flow’s name
--server-url yes The address partners call: http:// or https://, a host, an optional port, and nothing after it
--out <file> no Written whole or not at all; an existing file is replaced. Without it, standard output
--db no

The file holds the bytes the route serves under a closed gate for the same <scheme>://<host>. Routed flows export too: the command reads the registry on the host. It writes no audit record.

It exits non-zero, names the cause and writes nothing for an unknown or disabled tenant, a name nothing is published under, or a --server-url with a path, a query, a fragment, user info or a scheme other than http and https.