Save an existing workflow's draft as a template
workflow:write"Save as template". You do NOT submit a definition — you name an existing workflow (workflowId) and the server snapshots that workflow's CURRENT DRAFT definition. The published version is irrelevant; whatever is in the draft at this instant is captured.
The snapshot is a COPY and is IMMUTABLE: editing the source workflow afterwards never changes the template, deleting the source never affects it, and no endpoint can rewrite a template's definition (PUT changes name/description/category only).
WHAT TRAVELS: steps and their config, plain workflow variables, and sticky notes. What does NOT travel: SECRET variables — they are stored outside the definition by design, so a template structurally cannot carry one. Connection references DO travel as bare ids and are resolved (or cleared) at use time — see useTemplate.
DEFAULTS: an empty or whitespace-only name falls back to the source workflow's name; an empty description falls back to the source workflow's description. category is free text with no server-side vocabulary (only trimmed). triggerType is copied from the source workflow and is not settable.
The workflow must be in the caller's WORKSPACE (404 otherwise); the resulting template belongs to the ORG.
Does NOT accept Idempotency-Key, so a retried create makes a second template.
Authorization
bearerAuth An API token: Authorization: Bearer grt_…. Mint one in the app under Settings → Workspace → API tokens; the raw value is shown once. Scopes confine the token — see x-permission on each operation.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/templates" \ -H "Content-Type: application/json" \ -d '{ "workflowId": "9a2b7c10-11d2-4c33-8a44-55e6f7089a1b", "name": "Order intake", "description": "Webhook to parsed order, with a VIP branch", "category": "Sales" }'{ "data": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e", "name": "string", "description": "string", "category": "string", "triggerType": "string", "definition": { "schemaVersion": 2, "trigger": {}, "variables": {}, "settings": {} }, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }}