Skip to main content

Volumes

Volumes are provisioned when attached to a RENTAL workload at deploy time. There is no standalone volume deploy endpoint.

All volume endpoints are scoped to an organization. Replace {org_slug} with your organization slug.

Authentication

Volume endpoints require a personal access token or org service token:

Authorization: Bearer <YOUR_API_TOKEN>

Create Volume

Create a new persistent volume.

Endpoint

POST /tha/v3/orgs/{org_slug}/volumes

Request Body

FieldTypeDescription
namestringRequired. Name for the volume.
size_in_mbintegerRequired. Size of the volume in megabytes.
resource_namestringRequired. The compute resource to provision the volume on.

Example Request

curl -X POST https://api.targon.com/tha/v3/orgs/{org_slug}/volumes \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-volume",
"size_in_mb": 10240,
"resource_name": "storage-rentals"
}'

Response

FieldTypeDescription
uidstringUnique identifier for the volume.
stateobjectCurrent state of the volume.

The state object:

FieldTypeDescription
statusstringCurrent status of the volume.
messagestringStatus message.
updated_atstringISO 8601 timestamp.

Example Response

{
"uid": "vol-abc123def456",
"state": {
"status": "registered",
"message": "",
"updated_at": "2025-01-15T10:30:00Z"
}
}

Errors

Status CodeDescription
400 - Bad RequestInvalid request body.
401 - UnauthorizedInvalid or missing API key.
500 - Internal Server ErrorServer error.

List Volumes

List all volumes in the selected organization.

Endpoint

GET /tha/v3/orgs/{org_slug}/volumes

Query Parameters

FieldTypeDescription
limitintegerMaximum number of items to return.
cursorstringPagination cursor.
workload_uidstringFilter volumes attached to a workload.

Example Request

curl -X GET "https://api.targon.com/tha/v3/orgs/{org_slug}/volumes?limit=10" \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

FieldTypeDescription
itemsarrayList of volume objects.
next_cursorstringCursor for the next page of results.

Each item in items:

FieldTypeDescription
uidstringUnique identifier for the volume.
namestringName of the volume.
sizeintegerSize of the volume in megabytes.
resource_namestringCompute resource the volume is on.
stateobjectCurrent state of the volume.
cost_per_hournumberHourly cost of the volume.
mount_pathstringMount path if attached to a workload.
workload_uidstringUID of attached workload, if any.
pvc_namestringInternal PVC name.
last_backup_atstringISO 8601 timestamp of last backup, if any.
deleted_bystringDeletion reason (NEW_PVC, USER), if deleted.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.

Example Response

{
"items": [
{
"uid": "vol-abc123def456",
"name": "my-volume",
"size": 10240,
"resource_name": "h200-small",
"state": {
"status": "running",
"message": "",
"updated_at": "2025-01-15T10:35:00Z"
},
"cost_per_hour": 0.05,
"mount_path": "/data",
"workload_uid": "wrk-xyz789abc123",
"pvc_name": "pvc-vol-abc123",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
],
"next_cursor": ""
}

Errors

Status CodeDescription
400 - Bad RequestInvalid query parameters.
401 - UnauthorizedInvalid or missing API key.
500 - Internal Server ErrorServer error.

Get Volume

Retrieve a volume by its UID.

Endpoint

GET /tha/v3/orgs/{org_slug}/volumes/{volume_uid}

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X GET https://api.targon.com/tha/v3/orgs/{org_slug}/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

Returns the full volume object.

Example Response

{
"uid": "vol-abc123def456",
"name": "my-volume",
"size": 10240,
"resource_name": "h200-small",
"state": {
"status": "running",
"message": "",
"updated_at": "2025-01-15T10:35:00Z"
},
"cost_per_hour": 0.05,
"mount_path": "/data",
"workload_uid": "wrk-xyz789abc123",
"pvc_name": "pvc-vol-abc123",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}

Errors

Status CodeDescription
401 - UnauthorizedInvalid or missing API key.
403 - ForbiddenNot allowed.
404 - Not FoundVolume not found.
500 - Internal Server ErrorServer error.

Get Volume State

Get the current state of a volume.

Endpoint

GET /tha/v3/orgs/{org_slug}/volumes/{volume_uid}/state

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X GET https://api.targon.com/tha/v3/orgs/{org_slug}/volumes/vol-abc123def456/state \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

FieldTypeDescription
uidstringUnique identifier of the volume.
statusstringCurrent status of the volume.
messagestringStatus message.
updated_atstringISO 8601 timestamp of last update.

Example Response

{
"uid": "vol-abc123def456",
"status": "running",
"message": "",
"updated_at": "2025-01-15T10:35:00Z"
}

Errors

Status CodeDescription
401 - UnauthorizedInvalid or missing API key.
403 - ForbiddenNot allowed.
404 - Not FoundVolume not found.
500 - Internal Server ErrorServer error.

List Volume Events

List lifecycle events for a volume.

Endpoint

GET /tha/v3/orgs/{org_slug}/volumes/{volume_uid}/events

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Query Parameters

FieldTypeDescription
limitintegerMaximum number of items to return.
cursorstringPagination cursor.

Example Request

curl -X GET "https://api.targon.com/tha/v3/orgs/{org_slug}/volumes/vol-abc123def456/events?limit=20" \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

FieldTypeDescription
itemsarrayList of volume event objects.
next_cursorstringCursor for the next page of results.

Each item in items:

FieldTypeDescription
volume_uidstringVolume UID
cost_per_secondintegerBilling rate
resource_namestringResource name
event_typestringEvent type
namespacestringKubernetes namespace
pvc_namestringPVC name
storage_classstringStorage class
requested_sizestringRequested size
old_statusstringPrevious status
new_statusstringNew status
reasonstringEvent reason
k8s_resource_versionstringK8s resource version
billing_statusstringBilling status
billing_processed_atstringISO 8601 billing timestamp
created_atstringISO 8601 event timestamp

Example Response

{
"items": [
{
"volume_uid": "vol-abc123def456",
"event_type": "STATUS_CHANGE",
"old_status": "provisioning",
"new_status": "running",
"reason": "Volume bound",
"resource_name": "h200-small",
"pvc_name": "pvc-vol-abc123",
"requested_size": "10Gi",
"created_at": "2025-01-15T10:35:00Z"
}
],
"next_cursor": ""
}

Errors

Status CodeDescription
400 - Bad RequestInvalid query parameters.
401 - UnauthorizedInvalid or missing API key.
403 - ForbiddenNot allowed.
404 - Not FoundVolume not found.
500 - Internal Server ErrorServer error.

Update Volume

Update a volume's name.

Endpoint

PATCH /tha/v3/orgs/{org_slug}/volumes/{volume_uid}

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Request Body

FieldTypeDescription
namestringRequired. New name for the volume.

Example Request

curl -X PATCH https://api.targon.com/tha/v3/orgs/{org_slug}/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "renamed-volume"
}'

Response

Returns the updated volume object.

Example Response

{
"uid": "vol-abc123def456",
"name": "renamed-volume",
"size": 10240,
"resource_name": "h200-small",
"state": {
"status": "running",
"message": "",
"updated_at": "2025-01-15T10:35:00Z"
},
"cost_per_hour": 0.05,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-16T08:00:00Z"
}

Errors

Status CodeDescription
400 - Bad RequestInvalid request body.
401 - UnauthorizedInvalid or missing API key.
403 - ForbiddenNot allowed.
404 - Not FoundVolume not found.
500 - Internal Server ErrorServer error.

Delete Volume

Delete a volume record.

Endpoint

DELETE /tha/v3/orgs/{org_slug}/volumes/{volume_uid}

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X DELETE https://api.targon.com/tha/v3/orgs/{org_slug}/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Response

Returns 204 No Content on success.

Errors

Status CodeDescription
401 - UnauthorizedInvalid or missing API key.
403 - ForbiddenNot allowed.
404 - Not FoundVolume not found.
500 - Internal Server ErrorServer error.