Skip to main content

Volumes

Volumes provide persistent storage that can be attached to workloads. Data stored in volumes persists across workload restarts and redeployments.

Authentication

All volume endpoints require authentication using a Bearer token. Include your API key in the Authorization header:

Authorization: Bearer <YOUR_API_KEY>

Create Volume

Create a new persistent volume.

Endpoint

POST /tha/v2/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/v2/volumes \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-volume",
"size_in_mb": 10240,
"resource_name": "h200-small"
}'

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": "PROVISIONING",
"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 for the authenticated user.

Endpoint

GET /tha/v2/volumes

Query Parameters

FieldTypeDescription
limitintegerMaximum number of items to return.
cursorstringPagination cursor.

Example Request

curl -X GET "https://api.targon.com/tha/v2/volumes?limit=10" \
-H "Authorization: Bearer <YOUR_API_KEY>"

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.
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": "READY",
"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/v2/volumes/{volume_uid}

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X GET https://api.targon.com/tha/v2/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>"

Response

Returns the full volume object.

Example Response

{
"uid": "vol-abc123def456",
"name": "my-volume",
"size": 10240,
"resource_name": "h200-small",
"state": {
"status": "READY",
"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/v2/volumes/{volume_uid}/state

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X GET https://api.targon.com/tha/v2/volumes/vol-abc123def456/state \
-H "Authorization: Bearer <YOUR_API_KEY>"

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": "READY",
"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/v2/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/v2/volumes/vol-abc123def456/events?limit=20" \
-H "Authorization: Bearer <YOUR_API_KEY>"

Response

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

Each item in items:

FieldTypeDescription
volume_uidstringUID of the volume.
event_typestringType of event.
old_statusstringPrevious status.
new_statusstringNew status.
reasonstringReason for the event.
resource_namestringCompute resource name.
pvc_namestringPVC name.
requested_sizestringRequested volume size.
created_atstringISO 8601 event timestamp.

Example Response

{
"items": [
{
"volume_uid": "vol-abc123def456",
"event_type": "STATUS_CHANGE",
"old_status": "PROVISIONING",
"new_status": "READY",
"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/v2/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/v2/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-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": "READY",
"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/v2/volumes/{volume_uid}

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X DELETE https://api.targon.com/tha/v2/volumes/vol-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>"

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.

Delete Volume Deployment

Delete deployed volume resources (the actual storage provisioned in the cluster) for a volume.

Endpoint

POST /tha/v2/volumes/{volume_uid}/delete

Path Parameters

FieldTypeDescription
volume_uidstringUnique identifier of the volume.

Example Request

curl -X POST https://api.targon.com/tha/v2/volumes/vol-abc123def456/delete \
-H "Authorization: Bearer <YOUR_API_KEY>"

Response

Returns 202 Accepted with an operation response.

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

Example Response

{
"uid": "vol-abc123def456",
"state": {
"status": "DELETING",
"message": "",
"updated_at": "2025-01-16T12:00:00Z"
}
}

Errors

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