PermuteDocs
Go to Permute

Versioning · resourcesPublish

Publish the current resource draft

Pass the version token from the latest history read. Database publication applies additive managed tables before moving the published ref; existing tables cannot be changed. Business actions publish independently after validating code, contracts, and selected sources against published schemas. Operation publication requires a successful run, or a completed Data Flow through its existing graph checks, and enables delivery and its configured schedule without starting a run. Publish Data Flow children through their parent. For write syncs, also pass runId for a completed preview of the current definition captured by the same API key; publication starts external delivery and new captures every 24 hours under that key. For apps, publication atomically makes the current draft live at its existing URL; no build or CloudFront rollout occurs. Dashboard source has no separate publication step.

POST/v1/resources/{resourceId}/publish
betaapiKeyworkspace

When to use

Publish a tested operation, Data Flow or write-sync definition.

For agents

Read the version token after testing. For write syncs, include runId from a completed preview of the exact draft, captured by the same API key: publication starts external delivery immediately and enables captures every 24 hours. Operation and Data Flow publication enables the configured schedule without starting a run; publish children through their parent flow. Dashboard source has no separate publish action.

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.publish('oper_revenue123', { 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": {
      "revisionId": "rvsn_code123",
      "sequence": 1
    },
    "capabilities": {
      "history": true,
      "restore": true,
      "publish": true
    }
  }
}