Everything in Neural Inverse Govern (Keystone) is available over its HTTP API: the console and the Neural Inverse apps use the same API you do. Requests and responses are JSON.
Base URL
The API lives under /api/v1 on your installation's API origin:
https://<your-govern-api-host>/api/v1
By default the API origin is the server's public URL (NI_AUTH_PUBLIC_URL). An installation can serve the API on its own host with NI_AUTH_API_PUBLIC_URL; sign-in paths (/oauth2/*, /saml/*, /.well-known/* and the issuer) stay on the public URL.
Region discovery
GET /.well-known/keystone-region is public and tells a client where everything is:
| Field | Meaning |
|---|---|
region_id | The installation's region (cell) id; local on a self-hosted installation unless the operator set another |
issuer | The token issuer to sign in against |
api_url | The API origin. Clients append /api/v1/... to it. |
console_url | The console |
bridge_url, ingest_url | The data and telemetry planes, when they are published |
global_url | Empty on a self-hosted installation |
kind, jurisdiction, aws_region, dr_aws_region | Where the installation runs |
Clients pin the region they discovered: the Neural Inverse endpoint agent refuses to talk to a server that reports another region, and tokens issued by one region are refused by another with wrong_region.
Authentication
Send a credential as a bearer token:
Authorization: Bearer <token>
| Credential | How you get it | Use it for |
|---|---|---|
| OAuth 2.0 access token | Authorization code with PKCE S256, or the device authorisation grant (POST /oauth2/device, then the device_code grant at /oauth2/token); refresh at /oauth2/token | People, through apps and scripts |
| API key | Created in the console or the API; the secret is shown once, in the form nia_<prefix>.<secret> | Services and automation, within the key's scopes |
| Agent token | POST /api/v1/agents/token with the agent's client credentials | AI agents calling the gateways; Govern's own management API refuses agent tokens |
| Model gateway token | keystone-cli token models or POST /api/v1/models/gateway/tokens | Coding tools calling the model gateway; refused everywhere else |
OpenID Connect discovery is at /.well-known/openid-configuration and the signing keys at /.well-known/jwks.json. Access tokens last 15 minutes by default.
Every request is authorised by permission. Permissions use a resource:verb grammar such as models:admin or audit:read, granted through roles; see Identity and access. A request for another organisation's object answers as if the object did not exist.
Requests
- Send
Content-Type: application/jsonon requests with a body. - First-party apps identify themselves with
X-Keystone-Client: <name>/<version>. It is recorded in the audit trail and is advisory: it never grants anything. - Many list routes take
limitandcursorand answer anext_cursorwhen more results may follow.
Errors
The current error envelope is:
{"error": {"code": "not_found", "message": "...", "request_id": "..."}}
codeis a stable, machine-readable string;messageis for people and may change.request_idmatches theX-Request-Idresponse header. Quote it when you report a problem.- Some routes add
details. - Actions under
/api/v1/svc/use PascalCase JSON and addReasonandFieldErrorsto the envelope. - The model gateway answers in each wire format's own error shape (OpenAI or Anthropic), so existing SDKs handle its errors, and adds
X-Keystone-Request-Id. - Some older routes still answer
{"error": "<message>"}. Clients should accept both shapes.
429 responses carry Retry-After in seconds. A 503 from a fail-closed check (for example dlp_unavailable) is safe to retry with backoff.
Versioning
The API version is the /api/v1 prefix of the path. The v1 changelog policy, applied with an automated compatibility check to the workspace API, allows new endpoints and fields and rejects removed endpoints or fields, incompatible type or requiredness changes and removed enum values. A breaking change needs a prior deprecation entry with migration guidance and a v2 path.
OpenAPI document
Your installation serves its own API reference, generated from the code it runs:
| Route | Content |
|---|---|
GET /docs/ | API reference portal (signed-in) |
GET /docs/openapi.yaml | The OpenAPI document |
GET /docs/redoc | ReDoc view |
GET /api/v1/docs/openapi.json | The OpenAPI document as JSON |
Because it is generated from your running version, it is the reference to build against.
Main route families
| Prefix | Area |
|---|---|
/api/v1/access/*, /api/v1/svc/iam/* | Roles, bindings, deny policies, just-in-time access, access reviews, IAM policies |
/api/v1/svc/sso/*, /scim/v2/* | Single sign-on connections, domains, provisioning |
/api/v1/models/* | Model access configuration and the model gateway |
/api/v1/orgs/{orgID}/agent-policy/*, /api/v1/agent-policy/* | Agent policy, approvals, decisions |
/api/v1/approvals/* | The shared approvals inbox |
/api/v1/agents/* | Agent identities and the agent gateway |
/api/v1/audit-logs/*, /api/v1/audit/client-events | Audit log, exports, client events |
/api/v1/vendor-audit/* | Third-party vendor audit connectors and events |