PermuteDocs
Go to Permute

Versioning · resourceRevisionsRestore

Restore a revision as the current draft

Pass the version token from the latest history read. Preserves history and does not execute or publish. Operation inputs must still be accessible and dependency connections must match the current graph. Data Flow child restores invalidate current-run eligibility. Dashboard restores validate source and restore its saved contract; dashboard source changes take effect immediately.

POST/v1/resources/{resourceId}/revisions/{revisionId}/restore
betaapiKeyworkspace

When to use

Recover a previous definition without running or publishing it.

For agents

Read history, inspect the target, then pass the returned version token. On 409, read again and reassess. Operation dependencies must match the current graph; restore connections through graph commands first. Dashboard source takes effect immediately and restores its saved contract, not old data.

Example

typescript
import { PermuteClient } from '@permute/sdk';

const orgClient = new PermuteClient({
  apiKey: process.env.PERMUTE_API_KEY!,
});

const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);

const history = await client.revisions.list('oper_revenue123');
const result = await client.revisions.restore('oper_revenue123', 'rvsn_code123', { expectedVersion: history.version });

Request body

json
{
  "expectedVersion": "opaque-version-token"
}

Response

json
{
  "data": {
    "resourceId": "oper_revenue123",
    "version": "opaque-version-token",
    "draft": {
      "revisionId": "rvsn_code123",
      "sequence": 1
    },
    "published": null,
    "capabilities": {
      "history": true,
      "restore": true,
      "publish": true
    }
  }
}