v1
Double column
API
CLI
JS Client

Templates /

Create template

Create a template

Required permission

Account > Templates > General > Create

Request body

  • {object}
    • name

      string required

      Name of the template.

      min length
      3
      max length
      20
      pattern
      ^[a-zA-Z]((-|\s)?[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
    • project

      required
    • spec

      required
    • options

      {object}

      Additional options for the template creation.

      • runOnCreation

        boolean

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

Response body

  • {object}

    Response object.

    • data

      {object} required

      Result data.

      • template

        {object} required

        Details about the newly created template.

        • id

          string required

          ID of the template.

        • createdAt

          date required

          Timestamp of when the template was created.

        • updatedAt

          date required

          Timestamp of when the template was last updated.

        • content

          {object}
          • name

            string required

            Name of the template.

            min length
            3
            max length
            20
            pattern
            ^[a-zA-Z]((-|\s)?[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
          • project

            required
          • spec

            required
      • templateRun

        {object}

        Details about the newly created template run.

        • id

          string required

          ID of the template run.

        • createdAt

          date required

          Timestamp of when the run was initiated.

        • updatedAt

          date required

          Timestamp of when the run was last updated.

        • template

          {object} required

          Details about the template being run.

          • id

            string required

            ID of the template

          • name

            string required

            The name of the template

        • status

          string required

          Status of the template run.

          one of
          waiting, failure, retrying, success, unknown
        • content

          {object} required

          Details about the template run.

          • name

            string required

            Name of the template.

            min length
            3
            max length
            20
            pattern
            ^[a-zA-Z]((-|\s)?[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
          • project

            required
          • spec

            required
API
CLI
JS Client

POST /v1/templates

Example request

Request body
curl
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","options":{"runOnCreation":true}}' \
  http://api.northflank.com/v1/templates

Example response

200 OK

Details about the newly created template.

JSON

{
  "data": {
    "template": {
      "id": "example-template",
      "createdAt": "2022-06-14 15:10:42.842Z",
      "updatedAt": "2022-06-14 15:10:42.842Z",
      "content": {
        "name": "Example Template",
        "description": "This is a sample template.",
        "apiVersion": "v1"
      }
    },
    "templateRun": {
      "id": "501c1e03-a021-4659-9048-85f8f6ee2bc7",
      "createdAt": "2022-06-14 15:10:42.842Z",
      "updatedAt": "2022-06-14 15:10:42.842Z",
      "template": {
        "id": "example-template",
        "name": "Example Template"
      },
      "status": "success",
      "content": {
        "name": "Example Template",
        "description": "This is a sample template.",
        "apiVersion": "v1"
      }
    }
  }
}

© 2022 Northflank Ltd. All rights reserved.