---
title: "Create a custom template"
method: POST
path: "/custom_templates/create/file"
tags: ["custom_templates"]
---

# Create a custom template

`POST /custom_templates/create/file`

Create a custom template.
**Access policy**: authenticated

## Response `200`

OK

- PortainerCustomTemplate
  - `CreatedByUserId` integer — User identifier who created this template
  - `Description` string — Description of the template
  - `EdgeTemplate` boolean — EdgeTemplate indicates if this template purpose for Edge Stack
  - `EntryPoint` string — Path to the Stack file
  - `GitConfig` GittypesRepoConfig
    - `Authentication` GittypesGitAuthentication
      - `AuthorizationType` integer
      - `GitCredentialID` integer
      - `Password` string
      - `Provider` integer
      - `Username` string
    - `ConfigFilePath` string — ConfigFilePath is the path to the config file within the repository. NOTE: For stacks, this mirrors Stack.EntryPoint and the two are kept in sync by stackUpdateGit.
    - `ConfigHash` string — Repository hash
    - `ReferenceName` string — The reference name
    - `TLSSkipVerify` boolean — TLSSkipVerify skips SSL verification when cloning the Git repository
    - `URL` string — The repo url
  - `Id` integer — CustomTemplate Identifier
  - `IsComposeFormat` boolean — IsComposeFormat indicates if the Kubernetes template is created from a Docker Compose file
  - `Logo` string — URL of the template's logo
  - `Note` string — A note that will be displayed in the UI. Supports HTML content
  - `Platform` 0 | 1 | 2
  - `ProjectPath` string — Path on disk to the repository hosting the Stack file
  - `ResourceControl` PortainerResourceControl
    - `AccessLevel` 0 | 1
    - `AdministratorsOnly` boolean — Permit access to resource only to admins
    - `Id` integer — ResourceControl Identifier
    - `OwnerId` integer — Deprecated fields Deprecated in DBVersion == 2
    - `Public` boolean — Permit access to the associated resource to any user
    - `ResourceId` string — Docker resource identifier on which access control will be applied.\ In the case of a resource control applied to a stack, use the stack name as identifier
    - `SubResourceIds` string[] — List of Docker resources that will inherit this access control
    - `System` boolean
    - `TeamAccesses` PortainerTeamResourceAccess[]
      - `AccessLevel` 0 | 1
      - `TeamId` integer
    - `Type` 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    - `UserAccesses` PortainerUserResourceAccess[]
      - `AccessLevel` 0 | 1
      - `UserId` integer
  - `Title` string — Title of the template
  - `Type` 0 | 1 | 2 | 3
  - `Variables` PortainerCustomTemplateVariableDefinition[]
    - `defaultValue` string
    - `description` string
    - `label` string
    - `name` string
  - `artifact` PortainerArtifact
    - `edgeGroups` integer[]
    - `edgeStackId` integer
    - `envGroups` integer[]
    - `envIds` integer[]
    - `files` PortainerArtifactFile[]
      - `hash` string
      - `path` string
      - `pathError` string
      - `pathStatus` 0 | 1 | 2
      - `ref` string
      - `refError` string
      - `refStatus` 0 | 1 | 2
      - `sourceId` integer
    - `stackId` integer

## Other responses

- `400` — Invalid request
- `500` — Server error

---

[API](https://skmtc.net/portainer/apis/portainerce-api.md) · [All operations](https://skmtc.net/portainer/apis/portainerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portainer/portainerce-api/versions/c0b0975cd11b/schema)
