Portainer Websocket API

Create exec sessions using websockets

Operations 4

GET /websocket/attach Attach a websocket #
GET /websocket/exec Execute a websocket #
GET /websocket/kubernetes-shell Execute a websocket on kubectl shell pod #
GET /websocket/pod Execute a websocket on pod #

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-websocket-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-websocket-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 WebSocket API
  version: 2.39.1
servers:
- url: /api
tags:
- description: Create exec sessions using websockets
  name: Websocket
paths:
  /websocket/attach:
    get:
      description: 'If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint).

        If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and

        an AttachStart operation HTTP request will be created and hijacked.

        **Access policy**: authenticated'
      parameters:
      - description: environment(endpoint) ID of the environment(endpoint) where the resource is located
        in: query
        name: endpointId
        required: true
        schema:
          type: integer
      - description: node name
        in: query
        name: nodeName
        schema:
          type: string
      - description: JWT token used for authentication against this environment(endpoint)
        in: query
        name: token
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: Attach a websocket
      tags:
      - Websocket
      operationId: getWebsocketAttach
      x-operation-id-source: derived
  /websocket/exec:
    get:
      description: 'If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint).

        If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and

        an ExecStart operation HTTP request will be created and hijacked.'
      parameters:
      - description: environment(endpoint) ID of the environment(endpoint) where the resource is located
        in: query
        name: endpointId
        required: true
        schema:
          type: integer
      - description: node name
        in: query
        name: nodeName
        schema:
          type: string
      - description: JWT token used for authentication against this environment(endpoint)
        in: query
        name: token
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '409':
          description: Conflict
        '500':
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: Execute a websocket
      tags:
      - Websocket
      operationId: getWebsocketExec
      x-operation-id-source: derived
  /websocket/kubernetes-shell:
    get:
      description: 'The request will be upgraded to the websocket protocol. The request will proxy input from the client to the pod via long-lived websocket connection.

        **Access policy**: authenticated'
      parameters:
      - description: environment(endpoint) ID of the environment(endpoint) where the resource is located
        in: query
        name: endpointId
        required: true
        schema:
          type: integer
      - description: JWT token used for authentication against this environment(endpoint)
        in: query
        name: token
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
        '400':
          description: Invalid request
        '403':
          description: Permission denied
        '500':
          description: Server error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: Execute a websocket on kubectl shell pod
      tags:
      - Websocket
      operationId: getWebsocketKubernetesShell
      x-operation-id-source: derived
  /websocket/pod:
    get:
      description: 'The request will be upgraded to the websocket protocol.

        **Access policy**: authenticated'
      parameters:
      - description: environment(endpoint) ID of the environment(endpoint) where the resource is located
        in: query
        name: endpointId
        required: true
        schema:
          type: integer
      - description: namespace where the container is located
        in: query
        name: namespace
        required: true
        schema:
          type: string
      - description: name of the pod containing the container
        in: query
        name: podName
        required: true
        schema:
          type: string
      - description: name of the container
        in: query
        name: containerName
        required: true
        schema:
          type: string
      - description: command to execute in the container
        in: query
        name: command
        required: true
        schema:
          type: string
      - description: JWT token used for authentication against this environment(endpoint)
        in: query
        name: token
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      - jwt: []
      summary: Execute a websocket on pod
      tags:
      - Websocket
      operationId: getWebsocketPod
      x-operation-id-source: derived
components:
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: X-API-KEY
      type: apiKey
    jwt:
      in: header
      name: Authorization
      type: apiKey