Make a workflow from a template
POST/
Makes a new workflow in this workspace from a template.
Needs an API token with the Write permission for workflows (workflow:write).
Parameters
Path
idRequired · UUIDThe template’s ID.
Headers
Idempotency-KeyOptional · stringUp to 255 characters. The same request with the same key within 24 hours answers the first result again, instead of making a second workflow.
Body
Optional. Nothing makes a draft named after the template.
nameOptional · stringUp to 255 characters, trimmed. Blank: the template’s name.
connectionsOptional · objectA connection of this workspace for each slot:
{"c1": "…"}. It must be for the slot’s service.valuesOptional · objectFill-ins, by step name and field:
{"step": {"field": value}}. A step or field the template lacks is refused.publishOptional · booleantrueturns the workflow on when it can run, as Publish a workflow does. Needs the Publish permission.folderIdOptional · UUID or nullA folder of this workspace to file it in.
Connections, by slot
A template needs one connection for each service account its steps use: its slots, c1, c2… Preview using it lists them with the connections that could fill each.
A slot you don’t name keeps the template’s own connection where it exists here. Otherwise its steps arrive without one, and install.missing lists the slot.
When publish is refused
A refused turn-on is not an error. The draft is made, the answer is still 201, and install.publishRefusal says why: CONNECTION_NOT_WORKING when a chosen connection isn’t working, or what Publish a workflow would answer.
A value tied to the account the template was saved with, such as a choice filled from it, arrives blank outside the workspace it was saved in. An expression never does.
Responses
- 201Created
The new workflow, a draft or live, and
install: what was done. The body isn’t JSON, the name is over 255 characters,
connectionsnames a slot the template lacks or a connection outside the workspace,folderIdisn’t a folder here,valuesnames a step or field the template lacks, the template holds a condition operator that doesn’t exist or a step name or display name over 255 characters, orIdempotency-Keyis over 255 characters.- 403
FORBIDDENThe token lacks the Write permission for workflows, or
publishistruewithout Publish. Nothing is made. - 403
FEATURE_OFFA token made inside a partner’s product, with the
publishorfoldersswitch off (details.switch). The workspace’s account is suspended. Nothing is made.
- 404
NOT_FOUNDNo template with this ID that this workspace may use. An ID that isn’t a UUID answers this too.
- 409
CONFLICTA request with this
Idempotency-Keyis still in progress, or its answer was too large to keep. The workspace’s account was deleted.
The template uses an app, or an app version, this installation can’t run.
This
Idempotency-Keywas already used with a different request.A step uses an app this workspace may not use.
A connection named for a slot is for another service (
details.slot).The template or the workspace’s connections couldn’t be read, or the workflow couldn’t be made.
The account’s state couldn’t be read. Nothing was made.
GoRunner couldn’t check which apps this workspace may use. Nothing was made.
Any call can also answer: 401 UNAUTHORIZED · 401 TOKEN_ENDED · 403 TOKEN_SURFACE_OFF · 403 EMBED_NOT_ALLOWED · 403 EMBED_NOT_AVAILABLE · 413 PAYLOAD_TOO_LARGE · 415 INVALID_CONTENT_TYPE · 429 RATE_LIMITED · 503 BUSY · 503 PAUSED · 503 SERVICE_UNAVAILABLE. See Errors.
Request
GORUNNER="https://api.gorunner.io"
GORUNNER_TOKEN="grt_…" # needs Write for workflows
TEMPLATE_ID="your-template-id"
curl -X POST "$GORUNNER/api/templates/$TEMPLATE_ID/use" \
-H "Authorization: Bearer $GORUNNER_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "Order intake — EU",
"connections": {
"c1": "0f8b2c7e-4a51-4d3e-9b2a-6c1d2e3f4a5b"
},
"publish": true
}'const GORUNNER = "https://api.gorunner.io";
const TOKEN = process.env.GORUNNER_TOKEN;
const TEMPLATE_ID = process.env.TEMPLATE_ID;
const res = await fetch(
`${GORUNNER}/api/templates/${TEMPLATE_ID}/use`,
{
method: "POST",
headers: {
Authorization: `Bearer ${TOKEN}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Order intake — EU",
connections: {
c1: "0f8b2c7e-4a51-4d3e-9b2a-6c1d2e3f4a5b",
},
publish: true,
}),
},
);
const { data } = await res.json();import os, uuid, requests
GORUNNER = "https://api.gorunner.io"
TOKEN = os.environ["GORUNNER_TOKEN"]
TEMPLATE_ID = os.environ["TEMPLATE_ID"]
res = requests.post(
f"{GORUNNER}/api/templates/{TEMPLATE_ID}/use",
headers={
"Authorization": f"Bearer {TOKEN}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"name": "Order intake — EU",
"connections": {
"c1": "0f8b2c7e-4a51-4d3e-9b2a-6c1d2e3f4a5b",
},
"publish": True,
},
)
data = res.json()["data"]Response · 201 Created, shortened
{
"data": {
"id": "6e9a1c3f-8b2d-4a57-9e0c-3f7b5d1a8c42",
"name": "Order intake — EU",
"status": "active",
"triggerType": "webhook",
"webhookToken": "2f4c8e1a-6b3d-4f7e-9a05-c1d2e3f4a5b6",
"install": {
"published": true,
"publishRefusal": null,
"missing": []
}
}
}Every field
Body
nameOptional · stringOptional name for the new workflow; trimmed. Blank or absent uses the template’s name. Max 255 characters.
connectionsOptional · objectSlot key → a connection of this workspace made for the slot’s service.
{key}UUIDEach key’s value.
publishOptional · booleanTurn the new workflow on when it can run. Needs
workflow:publish. A refused turn-on keeps the draft and is reported ininstall.publishRefusal.Default
false.folderIdOptional · UUID or nullA folder of this workspace to file the new workflow in.
valuesOptional · objectThe person’s fill-ins: step name → input key → value, written over the template’s values. A blank value (
"", null,[]) leaves the field blank. A step or input the template does not have is refused 400 (details.field: values,details.step,details.input).{key}objectEach key’s value.
Response · 201 Created
dataobjectThe workflow created from a template — the same shape the workflows API returns — and what the install did.
idUUIDnamestringdescriptionstringCopied from the template.
definitionobjectThe template’s snapshot with its connection slots filled (steps of a slot left empty, and any other connection this workspace cannot resolve, carry no connection), and previously-unpinned steps on the fleet’s current app versions.
A workflow definition: its fields are in Workflow definition.
statusstringdraft, oractivewhenpublishturned it on.One of
draft,active,paused.triggerTypestringCopied from the template.
webhookTokenstringPresent for a webhook workflow that
publishturned on: the secret segment of the public webhook URL. Treat it as a credential.folderIdUUIDThe folder it was filed in, when
folderIdwas sent.tagsarray of stringshasUnpublishedChangesbooleanworkspaceIdUUIDorgIdUUIDcreatedByUUIDcreatedAttimeupdatedAttimeinstallobjectWhat using the template did, beside the workflow it made.
publishedbooleanThe new workflow was turned on.
publishRefusalobject or nullWhy
publishdid not publish it:CONNECTION_NOT_WORKINGwhen a chosen connection iserror,expiredorpending(the workflow is made as a draft), else the{code, message}POST /api/workflows/{id}/publishanswers (VALIDATION_ERROR,PIECE_NOT_ALLOWED,PIECES_UNAVAILABLE). null when it did, or was not asked.codestringmessagestringmissingarray of objectsSlots left without a connection.
keystringThe slot’s name in this template (
c1,c2, … in the order the steps first use it).pieceIdstringThe service a connection for this slot must be for.
stepsarray of stringsThe steps that use it;
triggerfor the trigger.latestVersionIdUUID or nullPresent when
publishturned it on: the published version.definitionRevintegerPresent when
publishturned it on.testPayloadsobject or nullPresent, null, when
publishturned it on.