Lifecycle, Versions & Audit Log
Every API definition carries a status and moves through a small state machine — the same shape Agent Builder uses for its own workflows, with its own role vocabulary and its own tables for the audit trail and version history.
Statuses
draft ──(Submit for Review)──► staged ──(Approve & Publish)──► published
▲ │ │
│ └──(Reject)──► rejected │
└──────────────(Move to Draft / Pull Back to Draft)───────────────┘
There are exactly four statuses: draft, staged, published, rejected. There is no cancelled status — an unwanted API definition is deleted instead (only while draft or rejected; instance admins can delete one in any status, and a published one leaves the gateway first).
Who can move what, from where
| From status | Role | Can move to |
|---|---|---|
draft | api_developer, lifecycle_manager, space_admin | staged |
draft | admin | staged, published |
staged | api_developer | draft (Withdraw — only their own submission) |
staged | lifecycle_manager, space_admin | published, rejected, draft |
staged | admin | published, rejected, draft |
rejected | api_developer, lifecycle_manager, space_admin | draft |
rejected | admin | draft, staged |
published | lifecycle_manager, space_admin | draft (pull back: the API leaves the gateway) |
published | admin | draft, staged |
admin here means a global Hrida.ai instance admin — a distinct, wider-reaching role than space_admin, which only has authority within its own API Space. A role not listed for a given from status has no transition available from it at all (for example, api_developer cannot approve or reject a staged definition, and can't pull a published API back to draft).
On a rejected API, only an instance admin sees Submit for Review. Everyone else uses Move to Draft, makes the changes, and then submits again.
Whoever submitted an API for review can't also approve it: another lifecycle manager or space admin must. Instance admins are exempt (for example on a single-admin install), and the lifecycle log then shows the same user as submitter and reviewer.
Editing (PUT) is only allowed while a definition is draft or rejected — a staged or published definition must be moved back to draft first, exactly like an Agent Builder workflow.
Rejecting requires a reason
Rejecting a staged API definition requires notes explaining why — the request is rejected with a 400 if notes is omitted, empty or only whitespace. The reason is saved trimmed.
Spec checks
Spec checks under the spec editor list what's wrong with the spec while you edit it (POST /api/v1/api-definitions/lint):
| Level | Check | Why it matters |
|---|---|---|
| Error | An operation without an operationId | The gateway can't route it, and agents never see it |
| Error | An operationId used twice | One of the two operations is unreachable |
| Warning | A {param} in the path with no matching in: path parameter, or one declared that the path lacks | Agents won't know to fill it |
| Warning | No summary or description | Agents choose tools by these |
| Warning | An operationId that isn't a valid tool name (letters, digits, _ and -, up to 64) | It is the tool's name, and some model providers refuse other names |
| Warning | No request body schema on a POST, PUT or PATCH | Agents have to guess the body |
| Warning | No 2xx response, or none with a schema | Agents and response validation can't rely on its shape |
Errors stop Submit for Review and publishing with a 422 that names them; warnings never block. The AI Assistant sees the same checks when it reads an API.
Changes since the last version
Once an API has a saved version, its page shows Changes since v…: the operations added, removed and changed since that version (and which parts of each, such as parameters, requestBody or responses), a changed base URL, and mappers added, removed or changed. For a staged API it sits at the top of the page, so the reviewer sees exactly what they approve. The same comparison is available as GET /api/v1/api-definitions/{id}/changes (?version_id= compares with an older version).
What Happens on Publish (and Un-publish)
When a definition transitions to published:
- Its version number is bumped (minor version, e.g.
1.0.0→1.1.0). - An immutable version snapshot is taken automatically (see below).
- If it exposes at least one operation in its Agent tools section, it's registered as a Tool Server, and agents can call those operations at once. Publishing alone exposes nothing.
When the API stops being live (pulled back to draft without environments, or prod no longer serves a version), or no longer exposes any operation, its Tool Server registration is removed — an unsanctioned API is never left silently callable. See When the registration is removed or refreshed.
Immutable Audit Log
Two separate records are kept, for two different questions:
Lifecycle events — "what state changes has this API been through?"
Every stage / approve / reject / revise transition writes an immutable ApiLifecycleEvent row: from_status, to_status, actor_id, actor_role, optional notes, and a timestamp. Fetch the full history for a definition:
GET /api/v1/api-definitions/{id}/lifecycle
General audit log — "who changed what field, and when?"
Separately, every create, field update, publish, unpublish, and delete is recorded in Hrida.ai's general-purpose audit log (resource_type: "API_DEFINITION"), with before/after state snapshots. Fetch it with:
GET /api/v1/api-definitions/{id}/audit-log
The audit log stays readable after the API is deleted, so the DELETE entry can still be checked. For a deleted API it's available to instance admins, the API's owner, and members of its former space who aren't viewers. Anyone else gets 404.
Version Snapshots & Rollback
An immutable ApiDefinitionVersion snapshot (the OpenAPI spec, name, description, upstream base URL and the API's message and protocol mappers at that point in time) is created automatically every time a definition is published, and again automatically right before every rollback — so a rollback never destroys the state you're rolling back from. Each snapshot records what triggered it (publish or rollback).
List and inspect snapshots:
GET /api/v1/api-definitions/{id}/versions
GET /api/v1/api-definitions/{id}/versions/{version_id}
Roll back to a prior snapshot:
POST /api/v1/api-definitions/{id}/rollback
{ "version_id": "...", "notes": "optional", "republish": false }
Rolling back requires the lifecycle_manager, space_admin, or admin role. It restores the OpenAPI spec, upstream base URL, name, description and mappers from the chosen snapshot. Credentials and gateway policy aren't versioned, so they stay as they are.
No two entries in the version history share a number:
- Edited since the last publish. Edits don't change the version number, so the API is first saved as a
rollbacksnapshot under the next unused patch number. For example, after publishing 1.1.0 and editing, the edited copy is saved as 1.1.1. - Unchanged since a snapshot. No new snapshot is taken: the existing one already keeps that state.
- The restored API gets the next unused patch number after that. In the example above, that's 1.1.2.
There are two ways to restore:
| Mode | What happens | Use it when |
|---|---|---|
| Restore as draft (default) | Status becomes draft. If the API was published, it leaves the gateway until it's approved again | You want the old version reviewed before it goes live |
Restore live ("republish": true) | Status stays or becomes published, and agents use the restored spec and URL immediately | An incident: a bad publish needs undoing now. Only allowed for snapshots taken at a publish, i.e. versions that were already approved once |
In the builder
The Version history card on the API's page lists every snapshot with its version, what created it, when, and its notes. View spec shows the snapshot's OpenAPI document; Restore as draft and Restore live (on published snapshots) are shown to lifecycle managers, space admins and admins.
Related
- API Catalogs, Spaces & Roles — where the roles referenced above (
api_developer,lifecycle_manager,space_admin) come from - Tool Server Publishing — the registration/unregistration behavior triggered by these transitions