v15

latestOpenAPI 3.0.0zlibraw.githubusercontent.com2026-08-07281553905.2 KB
custom_templates

Create a custom template

Create a custom template. Access policy: authenticated

post/custom_templates/create/string

Request body

Descriptionstring required

Description of the template

EdgeTemplateboolean

EdgeTemplate indicates if this template purpose for Edge Stack

FileContentstring required

Content of stack file

Logostring

URL of the template's logo

Notestring

A note that will be displayed in the UI. Supports HTML content

Platform0 | 1 | 2
Titlestring required

Title of the template

Type0 | 1 | 2 | 3 required

Example request

{
  "Description": "High performance web server",
  "Logo": "https://portainer.io/img/logo.svg",
  "Note": "This is my <b>custom</b> template",
  "Title": "Nginx",
  "Variables": [
    {
      "defaultValue": "default value",
      "description": "Description",
      "label": "My Variable",
      "name": "MY_VAR"
    }
  ]
}

Response

OK

CreatedByUserIdinteger

User identifier who created this template

Descriptionstring

Description of the template

EdgeTemplateboolean

EdgeTemplate indicates if this template purpose for Edge Stack

EntryPointstring

Path to the Stack file

Idinteger

CustomTemplate Identifier

IsComposeFormatboolean

IsComposeFormat indicates if the Kubernetes template is created from a Docker Compose file

Logostring

URL of the template's logo

Notestring

A note that will be displayed in the UI. Supports HTML content

Platform0 | 1 | 2
ProjectPathstring

Path on disk to the repository hosting the Stack file

Titlestring

Title of the template

Type0 | 1 | 2 | 3

Example response

{
  "CreatedByUserId": 3,
  "Description": "High performance web server",
  "EntryPoint": "docker-compose.yml",
  "GitConfig": {
    "ConfigFilePath": "docker-compose.yml",
    "ConfigHash": "bc4c183d756879ea4d173315338110b31004b8e0",
    "ReferenceName": "refs/heads/branch_name",
    "URL": "https://github.com/portainer/portainer.git"
  },
  "Id": 1,
  "Logo": "https://portainer.io/img/logo.svg",
  "Note": "This is my <b>custom</b> template",
  "ProjectPath": "/data/custom_template/3",
  "ResourceControl": {
    "AdministratorsOnly": true,
    "Id": 1,
    "Public": true,
    "ResourceId": "617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08",
    "SubResourceIds": [
      "617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08"
    ]
  },
  "Title": "Nginx",
  "Variables": [
    {
      "defaultValue": "default value",
      "description": "Description",
      "label": "My Variable",
      "name": "MY_VAR"
    }
  ],
  "artifact": {
    "files": [
      {
        "hash": "abc123",
        "path": "portainer.yaml",
        "ref": "refs/heads/main"
      }
    ]
  }
}