v13

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

Update a stack's Git configs

Update the Git settings in a stack, e.g., RepositoryReferenceName and AutoUpdate. When SourceID is set, URL/auth/TLS are taken from the referenced Source. Access policy: authenticated

post/stacks/{id}/git

Path parameters

idinteger required

Stack identifier

Query parameters

endpointIdinteger

Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack.

Request body

AdditionalFilesstring[]
ConfigFilePathstring
Pruneboolean
RepositoryAuthenticationboolean

Deprecated: use SourceID instead. Use basic authentication to clone the Git repository.

RepositoryPasswordstring

Deprecated: use SourceID instead. Password used in basic authentication.

RepositoryReferenceNamestring
RepositoryURLstring

Deprecated: use SourceID instead. URL of a Git repository hosting the Stack file.

RepositoryUsernamestring

Deprecated: use SourceID instead. Username used in basic authentication.

SourceIDinteger

SourceID references an existing Source for git credentials/URL. When set, the inline URL and authentication fields are ignored.

TLSSkipVerifyboolean

Deprecated: use SourceID instead. Skip TLS verification when cloning the Git repository.

Example request

{
  "AutoUpdate": {
    "Interval": "1m30s",
    "JobID": "15",
    "Webhook": "05de31a2-79fa-4644-9c12-faa67e5c49f0"
  },
  "Env": [
    {
      "name": "name",
      "value": "value"
    }
  ]
}

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

GitSourceIdinteger
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"
}