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. App restores replace the draft manifest and settings; publish separately to roll back the live site. Database restores change only the definition draft, never customer records or live tables. 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. Write-sync restore requires a paused sync and preserves current identity restrictions; it neither publishes nor sends records. Operation dependencies must match the current graph. 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
    }
  }
}