Skills
Log in

Create template

Create a template

Required permission

Account > Templates > General > Create

Request body

  • {object}
    Create a new template
    • name

      string required
      Name of the template.
      min length
      3
      max length
      100
      pattern
      ^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$
    • description

      string
      Description of the template.
      max length
      200
      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
    • apiVersion

      string required
      The version of the Northflank API to run the template against.
      one of
      v1.2
    • arguments

      {object}
      A set of arguments that can be referenced in a template using '${args.argumentName}'.
      • gitops

        {object}
        • vcsService

          string required
          The VCS provider to use.
          one of
          bitbucket, gitlab, github, self-hosted, azure, origin
        • selfHostedVcsId

          string
          If projectType is self-hosted, the ID of the self-hosted vcs to use.
          pattern
          ^([A-Za-z0-9-]+)|([0-9a-f]{24})$
        • accountLogin

          string
          By 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

          string
          Legacy key. Please used accountLogin instead.
        • repoUrl

          string required
          URL 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 required
          The name of the branch to use.
        • filePath

          string required
          The 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) required
        A node representing an action to be performed as part of the template.
      • teardownSpec

        {object} | null
        Optional spec to run when the template is deleted.
        • spec

          (multiple options: oneOf) required
          A node representing an action to be performed as part of the teardown spec.
        • failurePolicy

          string
          Controls 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 of
          ignore, block
      • argumentOverrides

        {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

            boolean
            If true, the template will run automatically whenever a change is made to it.
          • concurrencyPolicy

            string
            Defines the concurrency behaviour of the template with respect to parallel runs.
            one of
            allow, queue, forbid, latest, replace
          • runOnCreation

            boolean
            If true, the template will be ran immediately after creation.
          • runOnCreationArgumentOverrides

            {object}
            Argument overrides for the initial run. Valid only if `runOnCreation` is `true`.
        OR
        • {object}
          Create a new template with GitOps enabled (use an existing git template)
          • name

            string required
            Name of the template.
            min length
            3
            max length
            100
            pattern
            ^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$
          • description

            string
            Description of the template.
            max length
            200
            pattern
            ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
          • arguments

            {object}
            A set of arguments that can be referenced in a template using '${args.argumentName}'.
            • teardownSpec

              {object} | null
              Optional spec to run when the template is deleted.
              • spec

                (multiple options: oneOf) required
                A node representing an action to be performed as part of the teardown spec.
              • failurePolicy

                string
                Controls 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 of
                ignore, block
            • argumentOverrides

              {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

                  boolean
                  If true, the template will run automatically whenever a change is made to it.
                • concurrencyPolicy

                  string
                  Defines the concurrency behaviour of the template with respect to parallel runs.
                  one of
                  allow, queue, forbid, latest, replace
                • runOnCreation

                  boolean
                  If 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} required
                  GitOps data for syncing this template with a file in version control.
                  • vcsService

                    string required
                    The VCS provider to use.
                    one of
                    bitbucket, gitlab, github, self-hosted, azure, origin
                  • selfHostedVcsId

                    string
                    If projectType is self-hosted, the ID of the self-hosted vcs to use.
                    pattern
                    ^([A-Za-z0-9-]+)|([0-9a-f]{24})$
                  • accountLogin

                    string
                    By 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

                    string
                    Legacy key. Please used accountLogin instead.
                  • repoUrl

                    string required
                    URL 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 required
                    The name of the branch to use.
                  • filePath

                    string required
                    The 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} required
                    Result data.
                    • template

                      {object} required
                      Details about the newly created template.
                      • name

                        string required
                        Name of the template.
                        min length
                        3
                        max length
                        100
                        pattern
                        ^[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*$
                      • description

                        string
                        Description of the template.
                        max length
                        200
                        pattern
                        ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
                      • apiVersion

                        string required
                        The version of the Northflank API to run the template against.
                        one of
                        v1.2
                      • arguments

                        {object}
                        A set of arguments that can be referenced in a template using '${args.argumentName}'.
                        • $schema

                          string
                        • spec

                          (multiple options: oneOf) required
                          A node representing an action to be performed as part of the template.
                        • teardownSpec

                          {object} | null
                          Optional spec to run when the template is deleted.
                            • spec

                              (multiple options: oneOf) required
                              A node representing an action to be performed as part of the teardown spec.
                          • failurePolicy

                            string
                            Controls 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 of
                            ignore, block
                        • id

                          string required
                          Identifier for the template
                          min length
                          3
                          max length
                          100
                          pattern
                          ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$
                        • gitops

                          {object}
                          • vcsService

                            string required
                            The VCS provider to use.
                            one of
                            bitbucket, gitlab, github, self-hosted, azure, origin
                          • selfHostedVcsId

                            string
                            If projectType is self-hosted, the ID of the self-hosted vcs to use.
                            pattern
                            ^([A-Za-z0-9-]+)|([0-9a-f]{24})$
                          • accountLogin

                            string
                            By 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

                            string
                            Legacy key. Please used accountLogin instead.
                          • repoUrl

                            string required
                            URL 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 required
                            The name of the branch to use.
                          • filePath

                            string required
                            The 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

                            string
                            The SHA of the current commit that is being used for the template.
                        • concurrencyPolicy

                          string
                          Defines the concurrency behaviour of the template with respect to parallel runs.
                          one of
                          allow, queue, forbid, latest, replace
                        • options

                          {object} required
                          • autorun

                            boolean required
                            Whether autorun is enabled
                        • createdAt

                          string
                          time of creation
                        • updatedAt

                          string
                          time of update
                      • templateRun

                        {object}
                        Run metadata, execution status, graph structure, public results and approval attribution. Sensitive node inputs and results require verified UI reveal.
                        • name

                          string
                          Optional name of the run.
                        • description

                          string
                          Optional description of the run.
                        • apiVersion

                          string
                          Template API version.
                        • spec

                          (multiple options: anyOf)
                        • project

                          {object}
                          • ref

                            string
                          • skipNodeExecution

                            (multiple options: anyOf)
                            • boolean
                            • OR

                            • string
                              one of
                              true, false
                          • detailsHidden

                            boolean required
                          • kind

                            string required
                          • spec

                            {object} required
                            • response

                              {object}
                              • status

                                string
                              • startTime

                                number
                              • endTime

                                number
                              • duration

                                number
                              • attempts

                                number
                              • data

                                {object}
                                • id

                                  string
                                • name

                                  string
                                • _id

                                  string
                            • _id

                              string
                            • id

                              string
                            • internalId

                              string
                            • type

                              string
                            • name

                              string
                            • pipelineId

                              string
                          • id

                            string
                            Identifier of the run.
                          • templateId

                            string
                            Identifier of the template, when available.
                          • environmentId

                            string
                            Identifier of the preview environment, when available.
                          • status

                            string required
                            Status of the template run
                            one of
                            pending, running, success, failure, aborted, aborting, queued, unknown, skipped, waiting, retrying, async_wait, approval_wait
                          • concluded

                            boolean required
                            Whether execution has concluded.
                          • startedAt

                            string
                            When execution started.
                          • concludedAt

                            string
                            When execution concluded.
                          • createdAt

                            string required
                            When the run was created.
                          • updatedAt

                            string required
                            When the run was last updated.
                          • detailsHidden

                            boolean required
                            Run details include available public results. Sensitive inputs and results are omitted.
                          • _id

                            string
                          • internalId

                            string
                          • entityId

                            string
                          • entityType

                            string
                          • projectId

                            string
                          • pipelineId

                            string
                          • userId

                            string
                          • environmentName

                            string
                          • expiresAt

                            string
                          • deleted

                            boolean
                          • phase

                            string
                          • templateVersionSha

                            string
                          • commitSHA

                            string
                          • hasDiff

                            boolean
                          • content

                            {object}
                            • name

                              string
                            • description

                              string
                            • apiVersion

                              string
                              • spec

                                (multiple options: anyOf)
                            • project

                              {object}
                              • ref

                                string
                              • skipNodeExecution

                                (multiple options: anyOf)
                                • boolean
                                • OR

                                • string
                                  one of
                                  true, false
                              • detailsHidden

                                boolean required
                              • kind

                                string required
                              • spec

                                {object} required
                                • response

                                  {object}
                                  • status

                                    string
                                  • startTime

                                    number
                                  • endTime

                                    number
                                  • duration

                                    number
                                  • attempts

                                    number
                                  • data

                                    {object}
                                    • id

                                      string
                                    • name

                                      string
                                    • _id

                                      string
                                • _id

                                  string
                                • id

                                  string
                                • internalId

                                  string
                                • type

                                  string
                                • name

                                  string
                                • pipelineId

                                  string
                            • template

                              {object}
                              • _id

                                string
                              • id

                                string
                              • internalId

                                string
                              • type

                                string
                              • name

                                string
                              • pipelineId

                                string
                            • pipeline

                              {object}
                              • _id

                                string
                              • id

                                string
                              • internalId

                                string
                              • type

                                string
                              • name

                                string
                              • pipelineId

                                string
                              • stage

                                string
                            • run

                              {object}
                              • _id

                                string
                              • id

                                string
                              • internalId

                                string
                              • type

                                string
                              • name

                                string
                              • pipelineId

                                string
                            • auditLog

                              {object}
                              • _id

                                string
                            • runContext

                              {object}
                              • origin

                                string
                              • userId

                                string
                              • user

                                {object}
                                • _id

                                  string
                              • sha

                                string
                              • branch

                                string
                              • pullRequestId

                                (multiple options: anyOf)
                                • string
                                • OR

                                • integer
                              • matchedFile

                                string
                              • trigger

                                {object}
                                • globalSecretInternalId

                                  string
                            • pendingApprovals

                              [array]
                              • {object}
                                • nodePath

                                  string required
                                • user

                                  string required

                      POST /v1/templates

                      POST /v1/teams/{teamId}/templates

                      Example request

                      Request body
                      Create a new template
                      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"
                      OR
                      Create a new template with GitOps enabled (use an existing git template)
                      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

                      Details about the newly created template.

                      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
                          }
                        }
                      }

                      © 2026 Northflank Ltd. All rights reserved.

                      northflank.com / Terms / Privacy / feedback@northflank.com