Create a template
Required permission
Account > Templates > General > Create
Request body
- {object}Create a new template
name
string requiredName of the template.min length3max length100pattern^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$description
stringDescription of the template.max length200pattern^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$apiVersion
string requiredThe version of the Northflank API to run the template against.one ofv1.2arguments
{object}A set of arguments that can be referenced in a template using '${args.argumentName}'.gitops
{object}vcsService
string requiredThe VCS provider to use.one ofbitbucket, gitlab, github, self-hosted, azure, originselfHostedVcsId
stringIf projectType is self-hosted, the ID of the self-hosted vcs to use.pattern^([A-Za-z0-9-]+)|([0-9a-f]{24})$accountLogin
stringBy default, if you have multiple version control accounts of the same provider linked, Northflank will pick a linked account that has access to the repository. If `accountLogin` is provided, Northflank will instead use your linked account with that login name.vcsLinkId
stringLegacy key. Please used accountLogin instead.repoUrl
string requiredURL of the Git repo to sync the file with.pattern^(https:\/\/)?((www(\.[a-zA-Z0-9-]{2,})+\.)?[a-zA-Z0-9-]{2,})(\.([a-zA-Z0-9-]{2,}))+(\/((?:[a-zA-Z0-9\-._]|%[a-fA-F0-9]{2}){2,}))+?$branch
string requiredThe name of the branch to use.filePath
string requiredThe file path in the repository. If using an existing file, it should be in JSON format.pattern^\/((?!\.\.?\/)[a-zA-Z0-9-._]+\/)*(?!\.\.?$)[a-zA-Z0-9-._]+$spec
(multiple options: oneOf) requiredA node representing an action to be performed as part of the template.teardownSpec
{object} | nullOptional spec to run when the template is deleted.spec
(multiple options: oneOf) requiredA node representing an action to be performed as part of the teardown spec.failurePolicy
stringControls what happens if the teardown spec fails or times out. `ignore` (default) — proceed with resource deletion regardless. `block` — halt deletion and set the environment to `teardown_failed`one ofignore, blockargumentOverrides
{object}Argument overrides stored outside of the template. If GitOps is enabled, these will not be saved in version control.options
{object}Options regarding how the template is run.autorun
booleanIf true, the template will run automatically whenever a change is made to it.concurrencyPolicy
stringDefines the concurrency behaviour of the template with respect to parallel runs.one ofallow, queue, forbid, latest, replacerunOnCreation
booleanIf true, the template will be ran immediately after creation.runOnCreationArgumentOverrides
{object}Argument overrides for the initial run. Valid only if `runOnCreation` is `true`.
- {object}Create a new template with GitOps enabled (use an existing git template)
name
string requiredName of the template.min length3max length100pattern^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$description
stringDescription of the template.max length200pattern^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$arguments
{object}A set of arguments that can be referenced in a template using '${args.argumentName}'.teardownSpec
{object} | nullOptional spec to run when the template is deleted.spec
(multiple options: oneOf) requiredA node representing an action to be performed as part of the teardown spec.failurePolicy
stringControls what happens if the teardown spec fails or times out. `ignore` (default) — proceed with resource deletion regardless. `block` — halt deletion and set the environment to `teardown_failed`one ofignore, blockargumentOverrides
{object}Argument overrides stored outside of the template. If GitOps is enabled, these will not be saved in version control.options
{object}Options regarding how the template is run.autorun
booleanIf true, the template will run automatically whenever a change is made to it.concurrencyPolicy
stringDefines the concurrency behaviour of the template with respect to parallel runs.one ofallow, queue, forbid, latest, replacerunOnCreation
booleanIf true, the template will be ran immediately after creation.runOnCreationArgumentOverrides
{object}Argument overrides for the initial run. Valid only if `runOnCreation` is `true`.gitops
{object} requiredGitOps data for syncing this template with a file in version control.vcsService
string requiredThe VCS provider to use.one ofbitbucket, gitlab, github, self-hosted, azure, originselfHostedVcsId
stringIf projectType is self-hosted, the ID of the self-hosted vcs to use.pattern^([A-Za-z0-9-]+)|([0-9a-f]{24})$accountLogin
stringBy default, if you have multiple version control accounts of the same provider linked, Northflank will pick a linked account that has access to the repository. If `accountLogin` is provided, Northflank will instead use your linked account with that login name.vcsLinkId
stringLegacy key. Please used accountLogin instead.repoUrl
string requiredURL of the Git repo to sync the file with.pattern^(https:\/\/)?((www(\.[a-zA-Z0-9-]{2,})+\.)?[a-zA-Z0-9-]{2,})(\.([a-zA-Z0-9-]{2,}))+(\/((?:[a-zA-Z0-9\-._]|%[a-fA-F0-9]{2}){2,}))+?$branch
string requiredThe name of the branch to use.filePath
string requiredThe file path in the repository. If using an existing file, it should be in JSON format.pattern^\/((?!\.\.?\/)[a-zA-Z0-9-._]+\/)*(?!\.\.?$)[a-zA-Z0-9-._]+$project
{object}
Response body
- {object}Response object.
data
{object} requiredResult data.template
{object} requiredDetails about the newly created template.name
string requiredName of the template.min length3max length100pattern^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$description
stringDescription of the template.max length200pattern^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$apiVersion
string requiredThe version of the Northflank API to run the template against.one ofv1.2arguments
{object}A set of arguments that can be referenced in a template using '${args.argumentName}'.$schema
stringspec
(multiple options: oneOf) requiredA node representing an action to be performed as part of the template.teardownSpec
{object} | nullOptional spec to run when the template is deleted.spec
(multiple options: oneOf) requiredA node representing an action to be performed as part of the teardown spec.failurePolicy
stringControls what happens if the teardown spec fails or times out. `ignore` (default) — proceed with resource deletion regardless. `block` — halt deletion and set the environment to `teardown_failed`one ofignore, blockid
string requiredIdentifier for the templatemin length3max length100pattern^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$gitops
{object}vcsService
string requiredThe VCS provider to use.one ofbitbucket, gitlab, github, self-hosted, azure, originselfHostedVcsId
stringIf projectType is self-hosted, the ID of the self-hosted vcs to use.pattern^([A-Za-z0-9-]+)|([0-9a-f]{24})$accountLogin
stringBy default, if you have multiple version control accounts of the same provider linked, Northflank will pick a linked account that has access to the repository. If `accountLogin` is provided, Northflank will instead use your linked account with that login name.vcsLinkId
stringLegacy key. Please used accountLogin instead.repoUrl
string requiredURL of the Git repo to sync the file with.pattern^(https:\/\/)?((www(\.[a-zA-Z0-9-]{2,})+\.)?[a-zA-Z0-9-]{2,})(\.([a-zA-Z0-9-]{2,}))+(\/((?:[a-zA-Z0-9\-._]|%[a-fA-F0-9]{2}){2,}))+?$branch
string requiredThe name of the branch to use.filePath
string requiredThe file path in the repository. If using an existing file, it should be in JSON format.pattern^\/((?!\.\.?\/)[a-zA-Z0-9-._]+\/)*(?!\.\.?$)[a-zA-Z0-9-._]+$templateSha
stringThe SHA of the current commit that is being used for the template.concurrencyPolicy
stringDefines the concurrency behaviour of the template with respect to parallel runs.one ofallow, queue, forbid, latest, replaceoptions
{object} requiredautorun
boolean requiredWhether autorun is enabledcreatedAt
stringtime of creationupdatedAt
stringtime of updatetemplateRun
{object}Run metadata, execution status, graph structure, public results and approval attribution. Sensitive node inputs and results require verified UI reveal.name
stringOptional name of the run.description
stringOptional description of the run.apiVersion
stringTemplate API version.spec
(multiple options: anyOf)project
{object}ref
stringskipNodeExecution
(multiple options: anyOf)- boolean
- stringone oftrue, false
detailsHidden
boolean requiredkind
string requiredspec
{object} requiredresponse
{object}status
stringstartTime
numberendTime
numberduration
numberattempts
numberdata
{object}id
stringname
string_id
string_id
stringid
stringinternalId
stringtype
stringname
stringpipelineId
stringid
stringIdentifier of the run.templateId
stringIdentifier of the template, when available.environmentId
stringIdentifier of the preview environment, when available.status
string requiredStatus of the template runone ofpending, running, success, failure, aborted, aborting, queued, unknown, skipped, waiting, retrying, async_wait, approval_waitconcluded
boolean requiredWhether execution has concluded.startedAt
stringWhen execution started.concludedAt
stringWhen execution concluded.createdAt
string requiredWhen the run was created.updatedAt
string requiredWhen the run was last updated.detailsHidden
boolean requiredRun details include available public results. Sensitive inputs and results are omitted._id
stringinternalId
stringentityId
stringentityType
stringprojectId
stringpipelineId
stringuserId
stringenvironmentName
stringexpiresAt
stringdeleted
booleanphase
stringtemplateVersionSha
stringcommitSHA
stringhasDiff
booleancontent
{object}name
stringdescription
stringapiVersion
stringspec
(multiple options: anyOf)project
{object}ref
stringskipNodeExecution
(multiple options: anyOf)- boolean
- stringone oftrue, false
detailsHidden
boolean requiredkind
string requiredspec
{object} requiredresponse
{object}status
stringstartTime
numberendTime
numberduration
numberattempts
numberdata
{object}id
stringname
string_id
string_id
stringid
stringinternalId
stringtype
stringname
stringpipelineId
stringtemplate
{object}_id
stringid
stringinternalId
stringtype
stringname
stringpipelineId
stringpipeline
{object}_id
stringid
stringinternalId
stringtype
stringname
stringpipelineId
stringstage
stringrun
{object}_id
stringid
stringinternalId
stringtype
stringname
stringpipelineId
stringauditLog
{object}_id
stringrunContext
{object}origin
stringuserId
stringuser
{object}_id
stringsha
stringbranch
stringpullRequestId
(multiple options: anyOf)- string
- integer
matchedFile
stringtrigger
{object}globalSecretInternalId
stringpendingApprovals
[array]- {object}
nodePath
string requireduser
string required
OR
OR
OR
POST /v1/templates
POST /v1/teams/{teamId}/templates
Example request
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
--request POST \
--data '{"name":"Example Template","description":"This is a sample template.","apiVersion":"v1.2","gitops":{"vcsService":"github","accountLogin":"github-user","repoUrl":"https://github.com/northflank-examples/remix-postgres-redis-demo","branch":"main","filePath":"/Dockerfile"},"spec":{"kind":"Workflow","spec":{"type":"sequential","steps":[{"kind":"Workflow","spec":{"type":"sequential","context":{"projectId":"example-project"},"steps":[]}}],"context":{"projectId":"example-project"}}},"teardownSpec":{"spec":{"kind":"Workflow","spec":{"type":"sequential","steps":[{"kind":"JobRun","spec":{"projectId":"example-project","runtimeFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"billing":{"deploymentPlan":"nf-compute-20"},"deployment":{"docker":{"configType":"default"},"storage":{"ephemeralStorage":{"storageSize":1024}},"internal":{"id":"example-build-service","branch":"master","buildSHA":"latest","buildId":"premium-guide-6393"}},"jobId":"example-job"}}]}}},"options":{"autorun":false,"concurrencyPolicy":"allow","runOnCreation":true}}' \
"https://api.northflank.com/v1/templates"curl --header "Content-Type: application/json" \
--header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
--request POST \
--data '{"name":"Example Template","description":"This is a sample template.","teardownSpec":{"spec":{"kind":"Workflow","spec":{"type":"sequential","steps":[{"kind":"JobRun","spec":{"projectId":"example-project","runtimeFiles":{"/dir/fileName":{"data":"VGhpcyBpcyBhbiBleGFtcGxlIHdpdGggYSB0ZW1wbGF0ZWQgJHtOT0RFX0VOVn0gdmFyaWFibGU=","encoding":"utf-8"}},"billing":{"deploymentPlan":"nf-compute-20"},"deployment":{"docker":{"configType":"default"},"storage":{"ephemeralStorage":{"storageSize":1024}},"internal":{"id":"example-build-service","branch":"master","buildSHA":"latest","buildId":"premium-guide-6393"}},"jobId":"example-job"}}]}}},"options":{"autorun":false,"concurrencyPolicy":"allow","runOnCreation":true},"gitops":{"vcsService":"github","accountLogin":"github-user","repoUrl":"https://github.com/northflank-examples/remix-postgres-redis-demo","branch":"main","filePath":"/Dockerfile"}}' \
"https://api.northflank.com/v1/templates"Example response
200 OK
JSON
{
"data": {
"template": {
"name": "Example Template",
"description": "This is a sample template.",
"apiVersion": "v1.2",
"spec": {
"kind": "Workflow",
"spec": {
"type": "sequential",
"context": {
"projectId": "example-project"
},
"steps": []
}
},
"id": "example-template",
"gitops": {
"vcsService": "github",
"accountLogin": "github-user",
"repoUrl": "https://github.com/northflank-examples/remix-postgres-redis-demo",
"branch": "main",
"filePath": "/Dockerfile",
"templateSha": "8c7e040ee3737ddc3a713363ae72bbe960e9fb16"
},
"concurrencyPolicy": "allow",
"options": {
"autorun": false
}
},
"templateRun": {
"name": "Production deployment",
"description": "Deploy the latest release.",
"id": "110ddb52-bdcd-482d-8ac2-05ba580afe2f",
"status": "success",
"concluded": true,
"startedAt": "2026-01-01T12:00:00.000Z",
"concludedAt": "2026-01-01T12:01:00.000Z",
"createdAt": "2026-01-01T12:00:00.000Z",
"updatedAt": "2026-01-01T12:01:00.000Z",
"detailsHidden": false
}
}
}