Portainer endpoints API
Manage Docker environments(endpoints)
Manage Docker environments(endpoints)
swagger: '2.0'
info:
contact:
email: info@portainer.io
description: 'Portainer API is an HTTP API served by Portainer. It is used by the Portainer UI and everything you can do with the UI can be done using the HTTP API.
Examples are available at https://documentation.portainer.io/api/api-examples/
You can find out more about Portainer at [http://portainer.io](http://portainer.io) and get some support on [Slack](http://portainer.io/slack/).
# Authentication
Most of the API environments(endpoints) require to be authenticated as well as some level of authorization to be used.
Portainer API uses JSON Web Token to manage authentication and thus requires you to provide a token in the **Authorization** header of each request
with the **Bearer** authentication mechanism.
Example:
```
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOjEsImV4cCI6MTQ5OTM3NjE1NH0.NJ6vE8FY1WG6jsRQzfMqeatJ4vh2TWAeeYfDhP71YEE
```
# Security
Each API environment(endpoint) has an associated access policy, it is documented in the description of each environment(endpoint).
Different access policies are available:
- Public access
- Authenticated access
- Restricted access
- Administrator access
### Public access
No authentication is required to access the environments(endpoints) with this access policy.
### Authenticated access
Authentication is required to access the environments(endpoints) with this access policy.
### Restricted access
Authentication is required to access the environments(endpoints) with this access policy.
Extra-checks might be added to ensure access to the resource is granted. Returned data might also be filtered.
### Administrator access
Authentication as well as an administrator role are required to access the environments(endpoints) with this access policy.
# Execute Docker requests
Portainer **DO NOT** expose specific environments(endpoints) to manage your Docker resources (create a container, remove a volume, etc...).
Instead, it acts as a reverse-proxy to the Docker HTTP API. This means that you can execute Docker requests **via** the Portainer HTTP API.
To do so, you can use the `/endpoints/{id}/docker` Portainer API environment(endpoint) (which is not documented below due to Swagger limitations). This environment(endpoint) has a restricted access policy so you still need to be authenticated to be able to query this environment(endpoint). Any query on this environment(endpoint) will be proxied to the Docker API of the associated environment(endpoint) (requests and responses objects are the same as documented in the Docker API).
# Private Registry
Using private registry, you will need to pass a based64 encoded JSON string ‘{"registryId":\<registryID value\>}’ inside the Request Header. The parameter name is "X-Registry-Auth".
\<registryID value\> - The registry ID where the repository was created.
Example:
```
eyJyZWdpc3RyeUlkIjoxfQ==
```
**NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://documentation.portainer.io/api/api-examples/).
'
license:
name: zlib
url: https://github.com/portainer/portainer/blob/develop/LICENSE
title: PortainerCE auth endpoints API
version: 2.39.1
basePath: /api
schemes:
- http
- https
tags:
- description: Manage Docker environments(endpoints)
name: endpoints
paths:
/endpoints:
delete:
consumes:
- application/json
deprecated: true
description: 'Deprecated: use the `POST` endpoint instead.
Remove multiple environments and optionally clean-up associated resources.
**Access policy**: Administrator only.'
operationId: EndpointDeleteBatchDeprecated
parameters:
- description: List of environments to delete, with optional deleteCluster flag to clean-up associated resources (cloud environments only)
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.endpointDeleteBatchPayload'
produces:
- application/json
responses:
'204':
description: Environment(s) successfully deleted.
'207':
description: Partial success. Some environments were deleted successfully, while others failed.
schema:
$ref: '#/definitions/endpoints.endpointDeleteBatchPartialResponse'
'400':
description: Invalid request payload, such as missing required fields or fields not meeting validation criteria.
'403':
description: Unauthorized access or operation not allowed.
'500':
description: Server error occurred while attempting to delete the specified environments.
security:
- ApiKeyAuth: []
jwt: []
summary: Remove multiple environments
tags:
- endpoints
get:
description: 'List all environments(endpoints) based on the current user authorizations. Will
return all environments(endpoints) if using an administrator or team leader account otherwise it will
only return authorized environments(endpoints).
**Access policy**: restricted'
operationId: EndpointList
parameters:
- description: Start searching from
in: query
name: start
type: integer
- description: Limit results to this value
in: query
name: limit
type: integer
- description: Sort results by this value
enum:
- Name
- Group
- Status
- LastCheckIn
- EdgeID
in: query
name: sort
type: string
- description: Order sorted results by desc/asc
in: query
name: order
type: integer
- description: Search query
in: query
name: search
type: string
- collectionFormat: csv
description: List environments(endpoints) of these groups
in: query
items:
type: integer
name: groupIds
type: array
- collectionFormat: csv
description: List environments(endpoints) by this status
in: query
items:
type: integer
name: status
type: array
- collectionFormat: csv
description: List environments(endpoints) of this type
in: query
items:
type: integer
name: types
type: array
- collectionFormat: csv
description: search environments(endpoints) with these tags (depends on tagsPartialMatch)
in: query
items:
type: integer
name: tagIds
type: array
- description: If true, will return environment(endpoint) which has one of tagIds, if false (or missing) will return only environments(endpoints) that has all the tags
in: query
name: tagsPartialMatch
type: boolean
- collectionFormat: csv
description: will return only these environments(endpoints)
in: query
items:
type: integer
name: endpointIds
type: array
- collectionFormat: csv
description: will exclude these environments(endpoints)
in: query
items:
type: integer
name: excludeIds
type: array
- collectionFormat: csv
description: will exclude environments(endpoints) belonging to these endpoint groups
in: query
items:
type: integer
name: excludeGroupIds
type: array
- description: If true, will return environment(endpoint) that were provisioned
in: query
name: provisioned
type: boolean
- collectionFormat: csv
description: will return only environments with on of these agent versions
in: query
items:
type: string
name: agentVersions
type: array
- description: if exists true show only edge async agents, false show only standard edge agents. if missing, will show both types (relevant only for edge agents)
in: query
name: edgeAsync
type: boolean
- description: if true, show only untrusted edge agents, if false show only trusted edge agents (relevant only for edge agents)
in: query
name: edgeDeviceUntrusted
type: boolean
- description: if bigger then zero, show only edge agents that checked-in in the last provided seconds (relevant only for edge agents)
in: query
name: edgeCheckInPassedSeconds
type: number
- description: if true, the snapshot data won't be retrieved
in: query
name: excludeSnapshots
type: boolean
- description: will return only environments(endpoints) with this name
in: query
name: name
type: string
- description: only applied when edgeStackId exists. Filter the returned environments based on their deployment status in the stack (not the environment status!)
in: query
name: edgeStackStatus
type: string
- collectionFormat: csv
description: List environments(endpoints) of these edge groups
in: query
items:
type: integer
name: edgeGroupIds
type: array
- collectionFormat: csv
description: Exclude environments(endpoints) of these edge groups
in: query
items:
type: integer
name: excludeEdgeGroupIds
type: array
produces:
- application/json
responses:
'200':
description: Endpoints
schema:
items:
$ref: '#/definitions/portainer.Endpoint'
type: array
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: List environments(endpoints)
tags:
- endpoints
post:
consumes:
- multipart/form-data
description: 'Create a new environment(endpoint) that will be used to manage an environment(endpoint).
**Access policy**: administrator'
operationId: EndpointCreate
parameters:
- description: 'Name that will be used to identify this environment(endpoint) (example: my-environment)'
in: formData
name: Name
required: true
type: string
- description: 'Environment(Endpoint) type. Value must be one of: 1 (Local Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge agent environment) or 5 (Local Kubernetes Environment)'
in: formData
name: EndpointCreationType
required: true
type: integer
- description: 'Container engine used by the environment(endpoint). Value must be one of: ''docker'' or ''podman'''
in: formData
name: ContainerEngine
type: string
- description: 'URL or IP address of a Docker host (example: docker.mydomain.tld:2375). Defaults to local if not specified (Linux: /var/run/docker.sock, Windows: //./pipe/docker_engine). Cannot be empty if EndpointCreationType is set to 4 (Edge agent environment)'
in: formData
name: URL
type: string
- description: 'URL or IP address where exposed containers will be reachable. Defaults to URL if not specified (example: docker.mydomain.tld:2375)'
in: formData
name: PublicURL
type: string
- description: Environment(Endpoint) group identifier. If not specified will default to 1 (unassigned).
in: formData
name: GroupID
type: integer
- description: Require TLS to connect against this environment(endpoint). Must be true if EndpointCreationType is set to 2 (Agent environment)
in: formData
name: TLS
type: boolean
- description: Skip server verification when using TLS. Must be true if EndpointCreationType is set to 2 (Agent environment)
in: formData
name: TLSSkipVerify
type: boolean
- description: Skip client verification when using TLS. Must be true if EndpointCreationType is set to 2 (Agent environment)
in: formData
name: TLSSkipClientVerify
type: boolean
- description: TLS CA certificate file
in: formData
name: TLSCACertFile
type: file
- description: TLS client certificate file
in: formData
name: TLSCertFile
type: file
- description: TLS client key file
in: formData
name: TLSKeyFile
type: file
- description: Azure application ID. Required if environment(endpoint) type is set to 3
in: formData
name: AzureApplicationID
type: string
- description: Azure tenant ID. Required if environment(endpoint) type is set to 3
in: formData
name: AzureTenantID
type: string
- description: Azure authentication key. Required if environment(endpoint) type is set to 3
in: formData
name: AzureAuthenticationKey
type: string
- collectionFormat: csv
description: List of tag identifiers to which this environment(endpoint) is associated
in: formData
items:
type: integer
name: TagIds
type: array
- description: The check in interval for edge agent (in seconds)
in: formData
name: EdgeCheckinInterval
type: integer
- description: URL or IP address that will be used to establish a reverse tunnel
in: formData
name: EdgeTunnelServerAddress
required: true
type: string
- description: List of GPUs - json stringified array of {name, value} structs
in: formData
name: Gpus
type: string
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/portainer.Endpoint'
'400':
description: Invalid request
'409':
description: Name is not unique
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Create a new environment(endpoint)
tags:
- endpoints
/endpoints/{id}:
delete:
description: 'Remove the environment associated to the specified identifier and optionally clean-up associated resources.
**Access policy**: Administrator only.'
operationId: EndpointDelete
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
responses:
'204':
description: Environment successfully deleted.
'400':
description: Invalid request payload, such as missing required fields or fields not meeting validation criteria.
'403':
description: Unauthorized access or operation not allowed.
'404':
description: Unable to find the environment with the specified identifier inside the database.
'500':
description: Server error occurred while attempting to delete the environment.
security:
- ApiKeyAuth: []
jwt: []
summary: Remove an environment
tags:
- endpoints
get:
description: 'Retrieve details about an environment(endpoint).
**Access policy**: restricted'
operationId: EndpointInspect
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
- description: if true, the snapshot data won't be retrieved
in: query
name: excludeSnapshot
type: boolean
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/portainer.Endpoint'
'400':
description: Invalid request
'404':
description: Environment(Endpoint) not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Inspect an environment(endpoint)
tags:
- endpoints
put:
consumes:
- application/json
description: 'Update an environment(endpoint).
**Access policy**: authenticated'
operationId: EndpointUpdate
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
- description: Environment(Endpoint) details
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.endpointUpdatePayload'
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/portainer.Endpoint'
'400':
description: Invalid request
'404':
description: Environment(Endpoint) not found
'409':
description: Name is not unique
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Update an environment(endpoint)
tags:
- endpoints
/endpoints/{id}/association:
put:
description: 'De-association an edge environment(endpoint).
**Access policy**: administrator'
operationId: EndpointAssociationDelete
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
'204':
description: Success
'400':
description: Invalid request
'404':
description: Environment(Endpoint) not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: De-association an edge environment(endpoint)
tags:
- endpoints
/endpoints/{id}/docker/v2/browse/put:
post:
consumes:
- multipart/form-data
description: 'Use this environment(endpoint) to upload TLS files.
**Access policy**: administrator'
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
- description: Optional volume identifier to upload the file
in: query
name: volumeID
type: string
- description: The destination path to upload the file to
in: formData
name: Path
required: true
type: string
- description: The file to upload
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
'204':
description: Success
'400':
description: Invalid request
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Upload a file under a specific path on the file system of an environment (endpoint)
tags:
- endpoints
/endpoints/{id}/dockerhub/{registryId}:
get:
description: 'get docker pull limits for a docker hub registry in the environment
**Access policy**:'
operationId: endpointDockerhubStatus
parameters:
- description: endpoint ID
in: path
name: id
required: true
type: integer
- description: registry ID
in: path
name: registryId
required: true
type: integer
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/endpoints.dockerhubStatusResponse'
'400':
description: Invalid request
'403':
description: Permission denied
'404':
description: registry or endpoint not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: fetch docker pull limits
tags:
- endpoints
/endpoints/{id}/edge/jobs/{jobID}/logs:
post:
consumes:
- application/json
description: Authorized only if the request is done by an Edge Environment(Endpoint)
parameters:
- description: environment(endpoint) Id
in: path
name: id
required: true
type: integer
- description: Job Id
in: path
name: jobID
required: true
type: integer
produces:
- application/json
responses:
'200':
description: OK
'400':
description: Bad Request
'403':
description: Forbidden
'500':
description: Internal Server Error
summary: Update the logs collected from an Edge Job
tags:
- endpoints
/endpoints/{id}/edge/stacks/{stackId}:
get:
consumes:
- application/json
description: '**Access policy**: public'
parameters:
- description: environment(endpoint) Id
in: path
name: id
required: true
type: integer
- description: EdgeStack Id
in: path
name: stackId
required: true
type: integer
produces:
- application/json
responses:
'200':
description: OK
schema:
$ref: '#/definitions/edge.StackPayload'
'400':
description: Bad Request
'404':
description: Not Found
'500':
description: Internal Server Error
summary: Inspect an Edge Stack for an Environment(Endpoint)
tags:
- endpoints
/endpoints/{id}/edge/status:
get:
description: 'environment(endpoint) for edge agent to check status of environment(endpoint)
**Access policy**: restricted only to Edge environments(endpoints)'
operationId: EndpointEdgeStatusInspect
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
responses:
'200':
description: Success
schema:
$ref: '#/definitions/endpointedge.endpointEdgeStatusInspectResponse'
'400':
description: Invalid request
'403':
description: Permission denied to access environment(endpoint)
'404':
description: Environment(Endpoint) not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Get environment(endpoint) status
tags:
- endpoints
/endpoints/{id}/forceupdateservice:
put:
consumes:
- application/json
description: 'force update a docker service
**Access policy**: authenticated'
operationId: endpointForceUpdateService
parameters:
- description: endpoint identifier
in: path
name: id
required: true
type: integer
- description: details
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.forceUpdateServicePayload'
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/swarm.ServiceUpdateResponse'
'400':
description: Invalid request
'403':
description: Permission denied
'404':
description: endpoint not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: force update a docker service
tags:
- endpoints
/endpoints/{id}/registries:
get:
description: 'List all registries based on the current user authorizations in current environment.
**Access policy**: authenticated'
operationId: endpointRegistriesList
parameters:
- description: required if kubernetes environment, will show registries by namespace
in: query
name: namespace
type: string
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
'200':
description: Success
schema:
items:
$ref: '#/definitions/portainer.Registry'
type: array
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: List Registries on environment
tags:
- endpoints
/endpoints/{id}/registries/{registryId}:
put:
consumes:
- application/json
description: '**Access policy**: authenticated'
operationId: endpointRegistryAccess
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
- description: Registry identifier
in: path
name: registryId
required: true
type: integer
- description: details
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.registryAccessPayload'
produces:
- application/json
responses:
'204':
description: Success
'400':
description: Invalid request
'403':
description: Permission denied
'404':
description: Endpoint not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: update registry access for environment
tags:
- endpoints
/endpoints/{id}/settings:
put:
consumes:
- application/json
description: 'Update settings for an environment(endpoint).
**Access policy**: authenticated'
operationId: EndpointSettingsUpdate
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
- description: Environment(Endpoint) details
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.endpointSettingsUpdatePayload'
produces:
- application/json
responses:
'200':
description: Success
schema:
$ref: '#/definitions/portainer.Endpoint'
'400':
description: Invalid request
'404':
description: Environment(Endpoint) not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Update settings for an environment(endpoint)
tags:
- endpoints
/endpoints/{id}/snapshot:
post:
description: 'Snapshots an environment(endpoint)
**Access policy**: administrator'
operationId: EndpointSnapshot
parameters:
- description: Environment(Endpoint) identifier
in: path
name: id
required: true
type: integer
responses:
'204':
description: Success
'400':
description: Invalid request
'404':
description: Environment(Endpoint) not found
'500':
description: Server error
security:
- ApiKeyAuth: []
- jwt: []
summary: Snapshots an environment(endpoint)
tags:
- endpoints
/endpoints/delete:
post:
consumes:
- application/json
description: 'Remove multiple environments and optionally clean-up associated resources.
**Access policy**: Administrator only.'
operationId: EndpointDeleteBatch
parameters:
- description: List of environments to delete, with optional deleteCluster flag to clean-up associated resources (cloud environments only)
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.endpointDeleteBatchPayload'
produces:
- application/json
responses:
'204':
description: Environment(s) successfully deleted.
'207':
description: Partial success. Some environments were deleted successfully, while others failed.
schema:
$ref: '#/definitions/endpoints.endpointDeleteBatchPartialResponse'
'400':
description: Invalid request payload, such as missing required fields or fields not meeting validation criteria.
'403':
description: Unauthorized access or operation not allowed.
'500':
description: Server error occurred while attempting to delete the specified environments.
security:
- ApiKeyAuth: []
jwt: []
summary: Remove multiple environments
tags:
- endpoints
/endpoints/global-key:
post:
operationId: EndpointCreateGlobalKey
responses:
'200':
description: Success
schema:
$ref: '#/definitions/endpoints.endpointCreateGlobalKeyResponse'
'400':
description: Invalid request
'500':
description: Server error
summary: Create or retrieve the endpoint for an EdgeID
tags:
- endpoints
/endpoints/relations:
put:
consumes:
- application/json
description: 'Update relations for a list of environments
Edge groups, tags and environment group can be updated.
**Access policy**: administrator'
operationId: EndpointUpdateRelations
parameters:
- description: Environment relations data
in: body
name: body
required: true
schema:
$ref: '#/definitions/endpoints.endpointUpdateRelationsPayload'
responses:
'204':
description: Success
'400':
description: Invalid request
'401':
description: Unauthorized
'404':
description: Not found
'500':
description: Server error
security:
- jwt: []
summary: Update relations for a list of environments
tags:
- endpoints
/endpoints/snapshot:
post:
description: 'Snapshot all environments(endpoints)
**Access policy**: administrator'
operationId: EndpointSnapshots
responses:
'204':
description: Success
'500':
description: Server Error
security:
- ApiKeyAuth: []
- jwt: []
summary: Snapshot all environments(endpoints)
tags:
- endpoints
definitions:
portainer.QuayRegistryData:
properties:
OrganisationName:
type: string
UseOrganisation:
type: boolean
type: object
endpointedge.edgeJobResponse:
properties:
CollectLogs:
description: Whether to collect logs
example: true
type: boolean
CronExpression:
description: A cron expression to schedule this job
example: '* * * * *'
type: string
Id:
description: EdgeJob Identifier
example: 2
type: integer
Script:
description: Script to run
example: echo hello
type: string
Version:
description: Version of this EdgeJob
example: 2
type: integer
type: object
portainer.Registry:
properties:
AccessToken:
description: Stores temporary access token
type: string
AccessTokenExpiry:
type: integer
Authentication:
description: Is authentication against this registry enabled
example: true
type: boolean
AuthorizedTeams:
description: Deprecated in DBVersion == 18
items:
type: integer
type: array
AuthorizedUsers:
description: Deprecated in DBVersion == 18
items:
type: integer
type: array
BaseURL:
description: Base URL, introduced for ProGet registry
example: registry.mydomain.tld:2375
type: string
Ecr:
$ref: '#/definitions/portainer.EcrData'
Github:
$ref: '#/definitions/portainer.GithubRegistryData'
Gitlab:
$ref: '#/definitions/portainer.GitlabRegistryData'
Id:
description: Registry Identifier
ex
# --- truncated at 32 KB (63 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/portainer/refs/heads/main/openapi/portainer-endpoints-api-openapi.yml