Portainer Templates API

Manage App Templates

Operations 2

GET /templates List available templates #
POST /templates/{id}/file Get a template's file #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/portainer-templates-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

portainer-templates-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: info@portainer.io
  description: Portainer API is an HTTP API served by Portainer.
  license:
    name: zlib
    url: https://github.com/portainer/portainer/blob/develop/LICENSE
  title: PortainerCE Templates API
  version: 2.39.1
servers:
- url: /api
tags:
- description: Manage App Templates
  name: Templates
paths:
  /templates:
    get:
      description: 'List available templates.

        **Access policy**: authenticated'
      operationId: TemplateList
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/templates.listResponse'
        '500':
          description: Server error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: List available templates
      tags:
      - Templates
  /templates/{id}/file:
    post:
      description: 'Get a template''s file

        **Access policy**: authenticated'
      operationId: TemplateFile
      parameters:
      - description: Template identifier
        in: path
        name: id
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/templates.fileResponse'
        '400':
          description: Invalid request
        '500':
          description: Server error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: Get a template's file
      tags:
      - Templates
components:
  schemas:
    portainer.TemplateEnv:
      properties:
        default:
          description: Default value that will be set for the variable
          example: default_value
          type: string
        description:
          description: Content of the tooltip that will be generated in the UI
          example: MySQL root account password
          type: string
        label:
          description: Text for the label that will be generated in the UI
          example: Root password
          type: string
        name:
          description: name of the environment(endpoint) variable
          example: MYSQL_ROOT_PASSWORD
          type: string
        preset:
          description: If set to true, will not generate any input for this variable in the UI
          example: false
          type: boolean
        select:
          description: A list of name/value that will be used to generate a dropdown in the UI
          items:
            $ref: '#/components/schemas/portainer.TemplateEnvSelect'
          type: array
      type: object
    portainer.TemplateType:
      enum:
      - 0
      - 1
      - 2
      - 3
      type: integer
      x-enum-varnames:
      - _
      - ContainerTemplate
      - SwarmStackTemplate
      - ComposeStackTemplate
    portainer.Pair:
      properties:
        name:
          example: name
          type: string
        value:
          example: value
          type: string
      type: object
    templates.fileResponse:
      properties:
        FileContent:
          description: The requested file content
          example: version:2
          type: string
      type: object
    templates.listResponse:
      properties:
        templates:
          items:
            $ref: '#/components/schemas/portainer.Template'
          type: array
        version:
          type: string
      type: object
    portainer.TemplateEnvSelect:
      properties:
        default:
          description: Will set this choice as the default choice
          example: false
          type: boolean
        text:
          description: Some text that will displayed as a choice
          example: text value
          type: string
        value:
          description: A value that will be associated to the choice
          example: value
          type: string
      type: object
    portainer.TemplateVolume:
      properties:
        bind:
          description: Path on the host
          example: /tmp
          type: string
        container:
          description: Path inside the container
          example: /data
          type: string
        readonly:
          description: Whether the volume used should be readonly
          example: true
          type: boolean
      type: object
    portainer.TemplateRepository:
      properties:
        stackfile:
          description: Path to the stack file inside the git repository
          example: ./subfolder/docker-compose.yml
          type: string
        url:
          description: URL of a git repository used to deploy a stack template. Mandatory for a Swarm/Compose stack template
          example: https://github.com/portainer/portainer-compose
          type: string
      type: object
    portainer.Template:
      properties:
        administrator_only:
          description: Whether the template should be available to administrators only
          example: true
          type: boolean
        categories:
          description: A list of categories associated to the template
          example:
          - database
          items:
            type: string
          type: array
        command:
          description: The command that will be executed in a container template
          example: ls -lah
          type: string
        description:
          description: Description of the template
          example: High performance web server
          type: string
        env:
          description: A list of environment(endpoint) variables used during the template deployment
          items:
            $ref: '#/components/schemas/portainer.TemplateEnv'
          type: array
        hostname:
          description: Container hostname
          example: mycontainer
          type: string
        id:
          description: 'Mandatory container/stack fields

            Template Identifier'
          example: 1
          type: integer
        image:
          description: 'Mandatory container fields

            Image associated to a container template. Mandatory for a container template'
          example: nginx:latest
          type: string
        interactive:
          description: 'Whether the container should be started in

            interactive mode (-i -t equivalent on the CLI)'
          example: true
          type: boolean
        labels:
          description: Container labels
          items:
            $ref: '#/components/schemas/portainer.Pair'
          type: array
        logo:
          description: URL of the template's logo
          example: https://portainer.io/img/logo.svg
          type: string
        name:
          description: 'Optional stack/container fields

            Default name for the stack/container to be used on deployment'
          example: mystackname
          type: string
        network:
          description: Name of a network that will be used on container deployment if it exists inside the environment(endpoint)
          example: mynet
          type: string
        note:
          description: A note that will be displayed in the UI. Supports HTML content
          example: This is my <b>custom</b> template
          type: string
        platform:
          description: 'Platform associated to the template.

            Valid values are: ''linux'', ''windows'' or leave empty for multi-platform'
          example: linux
          type: string
        ports:
          description: A list of ports exposed by the container
          example:
          - 8080:80/tcp
          items:
            type: string
          type: array
        privileged:
          description: Whether the container should be started in privileged mode
          example: true
          type: boolean
        registry:
          description: 'Optional container fields

            The URL of a registry associated to the image for a container template'
          example: quay.io
          type: string
        repository:
          allOf:
          - $ref: '#/components/schemas/portainer.TemplateRepository'
          description: Mandatory stack fields
        restart_policy:
          description: Container restart policy
          example: on-failure
          type: string
        stackFile:
          description: 'Mandatory Edge stack fields

            Stack file used for this template'
          type: string
        title:
          description: Title of the template
          example: Nginx
          type: string
        type:
          allOf:
          - $ref: '#/components/schemas/portainer.TemplateType'
          description: 'Template type. Valid values are: 1 (container), 2 (Swarm stack), 3 (Compose stack), 4 (Compose edge stack)'
          example: 1
        volumes:
          description: A list of volumes used during the container template deployment
          items:
            $ref: '#/components/schemas/portainer.TemplateVolume'
          type: array
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: X-API-KEY
      type: apiKey
    jwt:
      in: header
      name: Authorization
      type: apiKey