PermuteDocs
Go to Permute

Actions · actionDefinitionGet

Get action definitions

Requires View code on the action. Returns draft and published code, contracts, policies, and pinned source bindings.

GET/v1/actions/{actionId}/definition
betaapiKeyworkspace

When to use

Read draft and published action code, contracts, and source bindings before editing.

For agents

Requires business_action.read_implementation (View code). Optional fields such as llm are omitted when not set. Pass the current draft revisionId and sequence as expectedDraft when saving; use null only when no draft exists.

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 result = await client.actions.definition('actn_abcdefghijklmnopqrstuvwx');

Response

json
{
  "data": {
    "draft": {
      "revisionId": "rvsn_action123",
      "sequence": 1,
      "definition": {
        "source": "exports.handler = ({ input, db }) => { db.insert('contacts', input); return input; };",
        "inputSchema": {
          "type": "object"
        },
        "outputSchema": {
          "type": "object"
        },
        "invokePermission": "write",
        "sources": [
          {
            "sourceId": "dbas_crm123",
            "revisionId": "rvsn_schema123",
            "readTables": [],
            "writeTables": [
              "contacts"
            ]
          }
        ]
      }
    },
    "published": null,
    "version": "b1946ac92492d2347c6235b4d2611184"
  }
}