openapi: 3.1.0
info:
title: Longhorn Manager API
description: >-
The Longhorn Manager REST API provides programmatic access to all Longhorn
storage management operations. The API follows the Rancher REST API
specification and is served by the Longhorn Manager service, typically
accessible within a Kubernetes cluster at port 9500 or via the
longhorn-backend service. It provides full lifecycle management for volumes,
snapshots, backups, nodes, disks, engine images, recurring jobs, and system
settings. The API is used by the Longhorn UI and can be accessed directly
for automation and integration. The schema is discoverable at /v1/schemas.
version: '1.11'
contact:
name: Longhorn Community
url: https://longhorn.io/community/
externalDocs:
description: Longhorn Documentation
url: https://longhorn.io/docs/
servers:
- url: http://{longhornManagerHost}:{longhornManagerPort}
description: Longhorn Manager API server (in-cluster via service or port-forward)
variables:
longhornManagerHost:
default: longhorn-backend
description: Hostname or service name for the Longhorn Manager.
longhornManagerPort:
default: '9500'
description: Port on which Longhorn Manager serves the API.
tags:
- name: BackingImages
description: >-
Backing image management for volumes that use pre-populated disk images
as their base data. Backing images are immutable and can be shared across
multiple volumes in the same namespace.
- name: Backups
description: >-
Backup operations for storing volume snapshots to external storage targets
such as S3-compatible storage or NFS. Backups can be restored to new
volumes for disaster recovery.
- name: EngineImages
description: >-
Engine image management for the Longhorn storage engine. Engine images
are OCI images containing the Longhorn engine binary and are used to
upgrade or manage storage engine versions.
- name: Nodes
description: >-
Node management for the Longhorn storage cluster including listing nodes,
updating disk configurations, enabling or disabling scheduling, and
managing node tags for workload placement.
- name: RecurringJobs
description: >-
Recurring job management for scheduling automated snapshot and backup
operations on a cron-based schedule. Recurring jobs can be applied to
individual volumes or all volumes via groups.
- name: Settings
description: >-
System-wide Longhorn settings management including backup targets,
replica counts, node scheduling policies, data locality settings,
and storage over-provisioning configuration.
- name: Snapshots
description: >-
Snapshot operations for volumes including creating, listing, deleting,
reverting to, and purging snapshots. Snapshots capture the state of a
volume at a point in time and can be used as the basis for backups.
- name: SystemBackups
description: >-
System-level backup and restore operations for the entire Longhorn
configuration including all volumes, settings, and resource definitions.
- name: Volumes
description: >-
Volume lifecycle management including creating, attaching, detaching,
expanding, and deleting volumes. Also includes volume actions such as
activating, canceling expansion, and managing replicas.
security:
- bearerAuth: []
paths:
/v1/volumes:
get:
operationId: listVolumes
summary: Longhorn List volumes
description: >-
Returns a list of all Longhorn volumes in the cluster. Each volume
entry includes its name, size, replication configuration, state,
access mode, attached node, snapshot count, and associated recurring jobs.
tags:
- Volumes
responses:
'200':
description: Volume list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/VolumeCollection'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createVolume
summary: Longhorn Create a volume
description: >-
Creates a new Longhorn volume with the specified configuration. The
volume will be created in a detached state. It must be attached to a
node before data can be written. Longhorn creates the specified number
of replicas distributed across available nodes.
tags:
- Volumes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VolumeCreateInput'
responses:
'200':
description: Volume created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/volumes/{volumeName}:
get:
operationId: getVolume
summary: Longhorn Get a volume
description: >-
Returns detailed information about a specific volume including its
state, replicas, engine, size, access mode, recurring jobs, and
current operation status.
tags:
- Volumes
parameters:
- $ref: '#/components/parameters/volumeName'
responses:
'200':
description: Volume details retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deleteVolume
summary: Longhorn Delete a volume
description: >-
Deletes a Longhorn volume and all of its replicas. The volume must be
in a detached state before it can be deleted. All snapshots and backups
associated with the volume will also be deleted.
tags:
- Volumes
parameters:
- $ref: '#/components/parameters/volumeName'
responses:
'204':
description: Volume deleted successfully.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/volumes/{volumeName}?action=attach:
post:
operationId: attachVolume
summary: Longhorn Attach a volume to a node
description: >-
Attaches a Longhorn volume to the specified node, making it available
as a block device. The volume must be detached before it can be
attached to a different node.
tags:
- Volumes
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VolumeAttachInput'
responses:
'200':
description: Volume attachment initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/volumes/{volumeName}?action=detach:
post:
operationId: detachVolume
summary: Longhorn Detach a volume from its node
description: >-
Detaches a Longhorn volume from the node it is currently attached to.
The volume's data is preserved and it can be reattached to the same
or a different node afterward.
tags:
- Volumes
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
hostId:
type: string
description: Node ID to detach from. If omitted, detaches from the current node.
responses:
'200':
description: Volume detachment initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/volumes/{volumeName}?action=expand:
post:
operationId: expandVolume
summary: Longhorn Expand a volume
description: >-
Expands a Longhorn volume to a new, larger size. The size must be
greater than the current volume size. Online expansion is supported
for volumes attached to nodes; the file system may need to be
resized separately after the volume is expanded.
tags:
- Volumes
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- size
properties:
size:
type: string
description: New size for the volume in bytes as a string, e.g. "10737418240" for 10 GiB.
responses:
'200':
description: Volume expansion initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/volumes/{volumeName}?action=snapshotCreate:
post:
operationId: createSnapshot
summary: Longhorn Create a snapshot
description: >-
Creates a point-in-time snapshot of a Longhorn volume. The volume
must be attached when the snapshot is created. Snapshots are stored
in the volume's replica data directories and consume incremental
space for changed blocks.
tags:
- Snapshots
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SnapshotCreateInput'
responses:
'200':
description: Snapshot created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Snapshot'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/volumes/{volumeName}?action=snapshotList:
get:
operationId: listSnapshots
summary: Longhorn List snapshots for a volume
description: >-
Returns a list of all snapshots for the specified volume. Each entry
includes the snapshot name, creation time, size, parent, labels,
and whether it has been removed or backed up.
tags:
- Snapshots
parameters:
- $ref: '#/components/parameters/volumeName'
responses:
'200':
description: Snapshot list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SnapshotListOutput'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/volumes/{volumeName}?action=snapshotDelete:
post:
operationId: deleteSnapshot
summary: Longhorn Delete a snapshot
description: >-
Marks a snapshot for deletion. The snapshot data is reclaimed
asynchronously. Deleting a snapshot merges its changed blocks with
the next snapshot in the chain. The volume must be attached.
tags:
- Snapshots
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
type: string
description: Name of the snapshot to delete.
responses:
'200':
description: Snapshot deletion initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Snapshot'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/volumes/{volumeName}?action=snapshotRevert:
post:
operationId: revertSnapshot
summary: Longhorn Revert a volume to a snapshot
description: >-
Reverts the contents of a volume to the state captured in a specific
snapshot. The volume must be detached before a revert operation.
All data written after the snapshot was created will be lost.
tags:
- Snapshots
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
properties:
name:
type: string
description: Name of the snapshot to revert to.
responses:
'200':
description: Volume revert initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Snapshot'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/volumes/{volumeName}?action=snapshotBackup:
post:
operationId: backupSnapshot
summary: Longhorn Back up a snapshot
description: >-
Triggers a backup of a specific snapshot to the configured external
backup target (S3 or NFS). The backup is asynchronous; monitor the
backup resource to track progress.
tags:
- Backups
parameters:
- $ref: '#/components/parameters/volumeName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BackupInput'
responses:
'200':
description: Backup initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/Volume'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/backupvolumes:
get:
operationId: listBackupVolumes
summary: Longhorn List backup volumes
description: >-
Returns a list of all backup volumes in the configured backup target.
A backup volume contains one or more backups of a Longhorn volume.
This endpoint queries the external backup store.
tags:
- Backups
responses:
'200':
description: Backup volume list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/BackupVolumeCollection'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/backupvolumes/{backupVolumeName}:
get:
operationId: getBackupVolume
summary: Longhorn Get a backup volume
description: >-
Returns details of a specific backup volume from the backup store
including the list of available backups and their metadata.
tags:
- Backups
parameters:
- $ref: '#/components/parameters/backupVolumeName'
responses:
'200':
description: Backup volume details retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/BackupVolume'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/backupvolumes/{backupVolumeName}/backups:
get:
operationId: listBackups
summary: Longhorn List backups for a backup volume
description: >-
Returns a list of all backups stored for a specific backup volume.
Each backup corresponds to a snapshot of the source Longhorn volume
at the time the backup was created.
tags:
- Backups
parameters:
- $ref: '#/components/parameters/backupVolumeName'
responses:
'200':
description: Backup list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/BackupCollection'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/nodes:
get:
operationId: listNodes
summary: Longhorn List nodes
description: >-
Returns a list of all nodes in the Longhorn storage cluster. Each
node entry includes its scheduling eligibility, disk configurations,
conditions, tags, and current state.
tags:
- Nodes
responses:
'200':
description: Node list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/NodeCollection'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/nodes/{nodeId}:
get:
operationId: getNode
summary: Longhorn Get a node
description: >-
Returns detailed information about a specific node including all
configured disks, their storage capacity, scheduling status, tags,
and health conditions.
tags:
- Nodes
parameters:
- $ref: '#/components/parameters/nodeId'
responses:
'200':
description: Node details retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Node'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateNode
summary: Longhorn Update a node
description: >-
Updates a node's configuration including scheduling eligibility,
disk configurations, eviction status, and node tags for workload
placement affinity.
tags:
- Nodes
parameters:
- $ref: '#/components/parameters/nodeId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NodeUpdateInput'
responses:
'200':
description: Node updated successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Node'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/engineimages:
get:
operationId: listEngineImages
summary: Longhorn List engine images
description: >-
Returns a list of all Longhorn engine images installed in the cluster.
Engine images contain the Longhorn storage engine binary and are used
to manage volume upgrade and compatibility.
tags:
- EngineImages
responses:
'200':
description: Engine image list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/EngineImageCollection'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createEngineImage
summary: Longhorn Create an engine image
description: >-
Deploys a new Longhorn engine image to the cluster by specifying
an OCI image reference. Longhorn deploys the engine binary from this
image to all nodes via a DaemonSet.
tags:
- EngineImages
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- image
properties:
image:
type: string
description: OCI image reference for the Longhorn engine image.
responses:
'200':
description: Engine image deployment initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/EngineImage'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/engineimages/{engineImageName}:
get:
operationId: getEngineImage
summary: Longhorn Get an engine image
description: >-
Returns details of a specific engine image including its deployment
state, CLI API version, controller API version, and which nodes
have the image deployed.
tags:
- EngineImages
parameters:
- $ref: '#/components/parameters/engineImageName'
responses:
'200':
description: Engine image details retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/EngineImage'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: deleteEngineImage
summary: Longhorn Delete an engine image
description: >-
Removes an engine image from the cluster. The default engine image
and images currently in use by volumes cannot be deleted.
tags:
- EngineImages
parameters:
- $ref: '#/components/parameters/engineImageName'
responses:
'204':
description: Engine image deleted successfully.
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/recurringjobs:
get:
operationId: listRecurringJobs
summary: Longhorn List recurring jobs
description: >-
Returns a list of all recurring snapshot and backup jobs configured
in Longhorn. Recurring jobs can be assigned to individual volumes or
to groups that apply to multiple volumes.
tags:
- RecurringJobs
responses:
'200':
description: Recurring job list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJobCollection'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createRecurringJob
summary: Longhorn Create a recurring job
description: >-
Creates a new recurring job for automated snapshot or backup operations.
The job runs on the specified cron schedule and applies to all volumes
that have this job in their recurring job list or that belong to the
job's group.
tags:
- RecurringJobs
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJobCreateInput'
responses:
'200':
description: Recurring job created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJob'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/recurringjobs/{recurringJobName}:
get:
operationId: getRecurringJob
summary: Longhorn Get a recurring job
description: >-
Returns details of a specific recurring job including its schedule,
task type, retention policy, labels, and group assignments.
tags:
- RecurringJobs
parameters:
- $ref: '#/components/parameters/recurringJobName'
responses:
'200':
description: Recurring job details retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJob'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateRecurringJob
summary: Longhorn Update a recurring job
description: >-
Updates a recurring job's configuration including schedule, retention
count, concurrency, and group assignments.
tags:
- RecurringJobs
parameters:
- $ref: '#/components/parameters/recurringJobName'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJobCreateInput'
responses:
'200':
description: Recurring job updated successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RecurringJob'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
delete:
operationId: deleteRecurringJob
summary: Longhorn Delete a recurring job
description: >-
Deletes a recurring job. Volumes assigned to this job will no longer
have automated snapshots or backups created by this schedule.
tags:
- RecurringJobs
parameters:
- $ref: '#/components/parameters/recurringJobName'
responses:
'204':
description: Recurring job deleted successfully.
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/v1/settings:
get:
operationId: listSettings
summary: Longhorn List all settings
description: >-
Returns a list of all Longhorn system settings including backup target,
default replica count, data locality, storage over-provisioning
percentage, and all other configurable system parameters.
tags:
- Settings
responses:
'200':
description: Settings list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SettingCollection'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/settings/{settingName}:
get:
operationId: getSetting
summary: Longhorn Get a setting
description: >-
Returns the current value and metadata for a specific Longhorn setting.
Settings include backup targets, replica counts, CPU and memory limits,
node scheduling policies, and many other system parameters.
tags:
- Settings
parameters:
- $ref: '#/components/parameters/settingName'
responses:
'200':
description: Setting retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
put:
operationId: updateSetting
summary: Longhorn Update a setting
description: >-
Updates the value of a specific Longhorn system setting. Changes take
effect immediately without requiring a restart.
tags:
- Settings
parameters:
- $ref: '#/components/parameters/settingName'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- value
properties:
value:
type: string
description: New value for the setting.
responses:
'200':
description: Setting updated successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/backingimages:
get:
operationId: listBackingImages
summary: Longhorn List backing images
description: >-
Returns a list of all backing images available in the cluster. Backing
images are pre-populated disk images used as the base for new volumes.
tags:
- BackingImages
responses:
'200':
description: Backing image list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/BackingImageCollection'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createBackingImage
summary: Longhorn Create a backing image
description: >-
Creates a new backing image by uploading or downloading an image file.
The backing image is distributed to all nodes that need it for
volume creation.
tags:
- BackingImages
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BackingImageCreateInput'
responses:
'200':
description: Backing image created successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/BackingImage'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/systembackups:
get:
operationId: listSystemBackups
summary: Longhorn List system backups
description: >-
Returns a list of all system-level backups. System backups capture
the entire Longhorn configuration including all CRDs, settings, and
metadata to enable full cluster restoration.
tags:
- SystemBackups
responses:
'200':
description: System backup list retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SystemBackupCollection'
'401':
$ref: '#/components/responses/Unauthorized'
post:
operationId: createSystemBackup
summary: Longhorn Create a system backup
description: >-
Creates a new system-level backup of the Longhorn configuration.
The backup is stored in the configured backup target and can be used
to restore the entire Longhorn installation.
tags:
- SystemBackups
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Optional name for the system backup.
responses:
'200':
description: System backup initiated.
content:
application/json:
schema:
$ref: '#/components/schemas/SystemBackup'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: >-
Kubernetes service account token for authenticating with the Longhorn
Manager API. Typically passed via the Kubernetes API proxy.
parameters:
volumeName:
name: volumeName
in: path
required: true
description: Name of the Longhorn volume.
schema:
type: string
nodeId:
name: nodeId
in: path
required: true
description: Identifier of the Longhorn
# --- truncated at 32 KB (57 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/longhorn/refs/heads/main/openapi/longhorn-manager-api-openapi.yml