Docs menu

Removals API

NOTE

These are the internal routes the workspace window uses. They are not a public API and may change.

These routes sit under /api/workspaces/ in the workspace itself. They are not the /ox-api/ surface in the REST API. For the person-facing flow, see Removals; for every refusal and its sentence, see A removal was refused.

Overview

A removal is staged by a Save or an accepted proposal, waits on a list kept with the workspace, and runs only at Deploy. Deploy is bound to a plan hash: the plan you reviewed must still be the plan when you confirm.

Any workspace member can accept a proposal; some changes (access, licenses, connected-app requests) need a management right. The same holds for a Save.

WhoNeeded for
A workspace memberSaving, and accepting a proposal
An owner, or Workspace.Access.ManageSaving or accepting a change to access records or a connected-app request
An owner, or Workspace.ArchiveArchiving the workspace, reading its archive plan, and the wind-down notices
Licenses.ManageSaving or accepting a change to licenses
Workspace.DeployThe deploy plan, Deploy, and reading a deploy run

A workspace's owners hold Licenses.Manage and Workspace.Deploy with no access card. A call is still capped by the rights its token carries, so an API key scoped without them is refused.

Deploy plan

GET /api/workspaces/commit/deploy-plan

Returns what a Deploy would do now, including every staged removal and a PlanHash.

StatusCodeWhen
403DEPLOY_NOT_ALLOWEDThe caller lacks Workspace.Deploy
503CHECKS_UNAVAILABLEThe removal checks could not run, so no plan could be built

Deploy

POST /api/workspaces/commit/deploy

Body: ConfirmedPlanHash, the PlanHash of the plan the person confirmed.

StatusCodeWhen
403DEPLOY_NOT_ALLOWEDThe caller lacks Workspace.Deploy
409DEPLOY_PLAN_CHANGEDRemovals are waiting or records are moving to your private cloud, and the confirmed hash does not match the current plan (an older deletes body is refused the same way). The body carries the fresh Plan. Nothing was torn down
409DEPLOY_IN_PROGRESSAnother deploy holds this workspace
409MOVE_HELDA record would move to your private cloud and its kind cannot move yet. Nothing was deployed
503CHECKS_UNAVAILABLEThe removal checks could not run, so nothing was deployed

Deploying a staged removal of a workbench deletes its Container Apps, one for each mode it runs; an app that is already gone counts as removed. Removing a workbench from its surface stages the same whole-record removal as removing it from the workspace canvas, so it is a Workbenches/{lookup} entry on the list like any other record. A proposal cannot remove a workbench (REMOVER_NOT_ALLOWED).

A removal that keeps a copy of its data has the copy taken first, inside the Deploy, into the oi-data-archives container of the landing zone. A copy that cannot be taken is not refused by status: the removal comes back as an excluded entry in the response with the copy's code (listed under Data stores and data archives), nothing of it is torn down, and it stays on the list.

The body may also send AcceptsRunPoll: true, saying the caller will poll a run. The answer is a 202 with a runId only when the caller opted in and the work cannot finish inside the request. Today every Deploy answers inline, because the copy runs inside the request; read its progress from Deploy runs.

Save

POST /api/workspaces/commit

Body: eac (the workspace) and StageDeletes (removals to stage). Restoring a waiting removal is a Save that clears its entry.

StatusCodeWhen
400RECORD_STAGED_FOR_DELETEThe Save changes a record that is waiting to be removed
400STAGE_ON_ACTUATED_SAVEA removal was added to a setup-window Save that also builds in your cloud
400STAGE_DELETES_SHAPEA removal does not say what it removes
400any removal check codeA refusal from the removal checks
409TEARDOWN_STARTEDThe removal being restored has already started
409DEPLOY_IN_PROGRESSA deploy holds this workspace
503CHECKS_UNAVAILABLEThe checks could not load, so nothing was committed

Removal check

POST /api/workspaces/commit/removal-check

Body: Records, a list of { Kind, Lookup } (at most 50). Answers, for each record, whether a delete would remove it at once (GoesAway) or leave it waiting for Deploy, with the reason. The canvas asks this before a delete; the Save decides again on its own.

Accept a proposal

POST /api/workspaces/proposals/{group}/{bundle}/accept

Body: ConfirmDeletes, required when the bundle removes records.

StatusCodeWhen
400DELETE_CONFIRM_REQUIREDThe bundle removes records and ConfirmDeletes was not sent
403NOT_A_MEMBERThe caller is not a member of this workspace
403ACCESS_MANAGE_REQUIREDThe bundle changes access records and the caller is not an owner and lacks Workspace.Access.Manage
403ACCESS_RIGHT_REQUIREDThe bundle changes licenses and the caller lacks Licenses.Manage
400FROM_SURFACE_NOT_SUPPORTEDThe bundle removes a kind from one surface that is removed only as a whole record
409ALREADY_STAGEDThe record is already waiting for the next deploy
409TARGET_NOT_FOUNDThe record is no longer in this workspace
409any other removal check codeA refusal from the removal checks
409DEPLOY_IN_PROGRESSA deploy holds this workspace
503CHECKS_UNAVAILABLEThe checks could not run, so nothing was accepted

Accepting stages a removal that waits for Deploy; a record that runs nothing in Azure, or was never built, is removed at accept.

Archive a workspace

DELETE /api/workspaces/archive
StatusCodeWhen
403WORKSPACE_ARCHIVE_REQUIREDThe caller is not an owner and lacks Workspace.Archive (the plan read needs the same)
409WORKSPACE_ARCHIVE_BLOCKEDRemovals are still waiting for the next deploy
409DEPLOY_IN_PROGRESSA deploy holds this workspace
409PROVENANCE_WORM_ACTIVEThe workspace's Provenance is Locked (a person pressed Lock permanently)
409ARCHIVE_PLAN_CHANGEDThe archive plan changed since it was shown
409ARCHIVE_LICENSE_SUBSCRIPTIONS_UNREADA license's subscribers could not be read from Stripe, so nothing was torn down. The sentence names the read's reason (for example LICENSE_NOT_CONNECTED), and each such license in Resources carries it as Reason
409ARCHIVE_LICENSE_SUBSCRIPTIONS_LIVEA license gained a subscriber in Stripe while the archive ran, found at the read right before that license is retired, and nothing had been removed yet. The sentence names the license and its live subscriptions; cancel them in Stripe, then archive again. A stop after something was removed is not this refusal: it answers 500 ARCHIVE_STOPPED_PARTWAY and a second press finishes it

GET /api/workspaces/archive returns the archive plan.

A license that never had Stripe keys (no Stripe settings at all, or every key empty) is skipped: its Stripe step is not read, wound down or retired, and the archive's Resources note it as kept with the code ARCHIVE_LICENSE_NEVER_KEYED. A license with any key set is still read, and if that read fails (including a key reference that cannot be read) it blocks as ARCHIVE_LICENSE_SUBSCRIPTIONS_UNREAD with the real reason. GET /api/workspaces/archive/notices agrees: a skipped license is not in Unread, and UnreadReasons maps each license that is unread to the read's reason in words.

History

GET /api/workspaces/commit/statuses

The last 20 commits, each with the intent it was recorded with. The Deploy window's Deployments and Saves read this.

Deploy runs

GET /api/workspaces/commit/deploy-runs
GET /api/workspaces/commit/deploy-runs/{runId}

The first answers the deploy running now; the second answers one run, running or finished. Both need Workspace.Deploy and answer the same fields: RunID, State, StartedAt, CompletedAt and Outcome once it ends, Exclusions (each removal left waiting, with its code), the Plan it ran, SavedDuring and Removals.

StatusCodeWhen
403UNKNOWN_RUNThe caller lacks Workspace.Deploy
404UNKNOWN_RUNNothing is deploying in this workspace right now (or: This deploy run is not known here. If a deploy is still running, try again shortly.)

Data archives

The copies kept by removals, read from the oi-data-archives container of the workspace's landing zone. They are the Removed items list in the workspace (see Removed items and Recover). There is no MCP tool for them.

List

GET /api/workspaces/data-archives

Needs Workspace.DataStore.Table.Read, as reading a table's documents does. Answers the archives' manifests as a JSON array, with no envelope: each names its Kind, Lookup, EntryID, Attempt, CreatedAt and Parts. A copy whose manifest was never written is unfinished and is not listed. A landing zone with no copies answers [].

Download one file

GET /api/workspaces/data-archives/{kind}/{lookup}/{entryId}/parts?name=attempt-0001/part-0001.ndjson

Needs Workspace.DataStore.Table.Read. Streams one stored file of one copy (a part, or its manifest), byte for byte. name may only name a file directly inside one attempt of that entry.

Recover

POST /api/workspaces/data-archives/{kind}/{lookup}/{entryId}/recover

Body: ConfirmRecover: true. Needs Workspace.Deploy.

Writes the removed record back from the copy's own settings, unprovisioned: nothing is built in Azure until the next Deploy. A table and an IoT fabric can be recovered. Answers 202 with Recovering, Kind, Lookup and the queued CommitID; the record is back once that commit completes.

Refusals

StatusCodeWhen
403DATA_STORE_RIGHT_MISSINGList or download: the caller lacks Workspace.DataStore.Table.Read
403DEPLOY_NOT_ALLOWEDRecover: You do not have permission to recover records in this workspace.
400DATA_ARCHIVE_RECOVER_UNCONFIRMEDRecover writes the removed record back. Confirm it with ConfirmRecover: true.
400DATA_ARCHIVE_ADDRESS_INVALIDThe lookup and entry id must each be one path segment.
400DATA_ARCHIVE_KIND_UNKNOWNThere is no recoverable record at this address.
400DATA_ARCHIVE_PART_NAME_INVALIDname must be one file inside one attempt, as 'attempt-0001/part-0001.ndjson'.
404DATA_ARCHIVE_ENTRY_NOT_FOUNDThere is no data archive for this entry, so nothing was recovered.
404DATA_ARCHIVE_RECORD_MISSINGThis copy holds no settings, so nothing was recovered.
404DATA_ARCHIVE_PART_NOT_FOUNDThere is no such file in this archive.
409DATA_ARCHIVE_RECORD_EXISTSThis record is in the workspace already, so it was not overwritten.
409DATA_ARCHIVE_PARENT_MISSINGThis table's database or data store is no longer in the workspace, so it was not recovered. Recover or recreate them first.
409DATA_ARCHIVE_PARENT_STAGEDThis table's database or data store is staged for removal, so it was not recovered: the next Deploy would remove it again. Restore that removal first.
409DATA_ARCHIVE_TABLE_NAME_TAKENA table in this database already uses this container name, so it was not recovered.
409DEPLOY_IN_PROGRESSRecover: a Deploy is removing records in this workspace now
409CLOUD_NOT_CONNECTEDThis workspace has no cloud connection (or its connection is incomplete or unusable), so there are no data archives to read.
409ARCHIVE_DESTINATION_MISSINGThe workspace landing zone has no storage account recorded on it
422DATA_ARCHIVE_RECORD_MALFORMEDThis copy's settings could not be read, so nothing was recovered.
500DATA_ARCHIVE_RECOVER_CONTEXT_MISSINGRecover could not reach the workspace settings service, so nothing was recovered.
502ARCHIVE_DESTINATION_FORBIDDENThe landing zone refused the read, so nothing was listed, downloaded or recovered

On fathym.com: OpenX →

On this page