v13

latestOpenAPI 3.0.0zlibraw.githubusercontent.com2026-08-01265409652.5 KB
stacks

Update a stack

Update a stack, only for file based stacks. Access policy: authenticated

put/stacks/{id}

Path parameters

idinteger required

Stack identifier

Query parameters

endpointIdinteger required

Environment identifier

Request body

Pruneboolean

Prune services that are no longer referenced

PullImageboolean

Deprecated(2.36): use RepullImageAndRedeploy instead for cleaner responsibility Force a pulling to current image with the original tag though the image is already the latest

RepullImageAndRedeployboolean

RepullImageAndRedeploy indicates whether to force repulling images and redeploying the stack

StackFileContentstring

New content of the Stack file

Example request

{
  "Env": [
    {
      "name": "name",
      "value": "value"
    }
  ],
  "Prune": true,
  "StackFileContent": "version: 3\n services:\n web:\n image:nginx"
}

Response

Success

AdditionalFilesstring[]

Only applies when deploying stack with multiple files

CreatedBystring

The username which created this stack

CreationDateinteger

The date in unix time when stack was created

DeploymentStartStatus0 | 1 | 2 | 3 | 4
EndpointIdinteger

Environment(Endpoint) identifier. Reference the environment(endpoint) that will be used for deployment

EntryPointstring

EntryPoint is the path to the config file relative to the project root. NOTE: For git stacks this mirrors GitConfig.ConfigFilePath and the two are kept in sync by stackUpdateGit. The deploy command builder (compose_unpacker_cmd_builder) uses this field directly; Kubernetes deploy and git clone operations use GitConfig.ConfigFilePath.

FromAppTemplateboolean

Whether the stack is from a app template

Idinteger

Stack Identifier

Namestring

Stack name

Namespacestring

Kubernetes namespace if stack is a kube application

ProjectPathstring

Path on disk to the repository hosting the Stack file

Status0 | 1 | 2 | 3 | 4
SwarmIdstring

Cluster identifier of the Swarm cluster where the stack is deployed

Type0 | 1 | 2 | 3
UpdateDateinteger

The date in unix time when stack was last updated

UpdatedBystring

The username which last updated this stack

WorkflowIDinteger

WorkflowID is the ID of the Workflow that owns the Source for this stack.

Example response

{
  "AutoUpdate": {
    "Interval": "1m30s",
    "JobID": "15",
    "Webhook": "05de31a2-79fa-4644-9c12-faa67e5c49f0"
  },
  "CreatedBy": "admin",
  "CreationDate": 1587399600,
  "EndpointId": 1,
  "EntryPoint": "docker-compose.yml",
  "Env": [
    {
      "name": "name",
      "value": "value"
    }
  ],
  "GitConfig": {
    "ConfigFilePath": "docker-compose.yml",
    "ConfigHash": "bc4c183d756879ea4d173315338110b31004b8e0",
    "ReferenceName": "refs/heads/branch_name",
    "URL": "https://github.com/portainer/portainer.git"
  },
  "Id": 1,
  "Name": "myStack",
  "Namespace": "default",
  "ProjectPath": "/data/compose/myStack_jpofkc0i9uo9wtx1zesuk649w",
  "ResourceControl": {
    "AdministratorsOnly": true,
    "Id": 1,
    "Public": true,
    "ResourceId": "617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08",
    "SubResourceIds": [
      "617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08"
    ]
  },
  "SwarmId": "jpofkc0i9uo9wtx1zesuk649w",
  "UpdateDate": 1587399600,
  "UpdatedBy": "bob"
}