Workloads are compute jobs running on Targon infrastructure. There are two primary workload types:
- Rental — A dedicated GPU instance that runs continuously. Supports persistent storage via volumes and SSH access. Ideal for training, fine-tuning, or interactive development.
- Serverless — An auto-scaling endpoint that scales between zero and many replicas based on traffic. Does not support volumes, but provides fine-grained scaling, concurrency, and health probe configuration. Ideal for inference APIs and event-driven workloads.
Lifecycle
Workloads follow a register-then-deploy pattern:
- Register — Call Create Workload (
POST /tha/v2/workloads) to register the workload and its configuration. The workload is saved but not yet running.
- Deploy — Call Deploy Workload (
POST /tha/v2/workloads/{workload_uid}/deploy) to start the workload on the cluster.
This two-step flow lets you configure everything (attach volumes, SSH keys, update settings) before committing resources.
Authentication
All workload endpoints require authentication using a Bearer token. Include your API key in the Authorization header:
Authorization: Bearer <YOUR_API_KEY>
Create Workload
Register a new workload configuration. This does not start the workload — it only saves the configuration. To start running the workload on the cluster, follow up with Deploy Workload.
Endpoint
POST /tha/v2/workloads
Common Fields
These fields apply to both rental and serverless workloads:
| Field | Type | Description |
|---|
name | string | Required. Name for the workload. Lowercase alphanumeric and hyphens only. |
image | string | Required. Container image to run (e.g. pytorch/pytorch:latest). |
resource_name | string | Required. Compute resource to use (e.g. h200-small). |
type | string | Required. Workload type: RENTAL or SERVERLESS. |
project_id | string | UID of the project this workload belongs to. |
app_id | string | UID of the app this workload belongs to. |
ports | array | Port mappings for the workload. See Port object. |
envs | array | Environment variables. See Env object. |
commands | array | Container command override (string array). |
args | array | Container arguments (string array). |
registry_auth | object | Private registry credentials. See Registry auth object. |
Rental-Only Fields
| Field | Type | Description |
|---|
volumes | array | Volume mounts. See Volume mount object. |
ssh_keys | array | SSH key UIDs (string array) to attach for shell access. |
Rental workloads cannot include serverless_config.
Serverless-Only Fields
| Field | Type | Description |
|---|
serverless_config | object | Required. Scaling and runtime configuration. See Serverless config. |
Serverless workloads cannot include volumes.
Port Object
| Field | Type | Description |
|---|
port | integer | Required. Port number (1024–65535). |
protocol | string | Protocol: TCP, UDP, or SCTP. |
routing | string | Routing type: PROXIED or DIRECT. |
Env Object
| Field | Type | Description |
|---|
name | string | Environment variable name. |
value | string | Environment variable value. |
Registry Auth Object
| Field | Type | Description |
|---|
server | string | Registry server URL. |
username | string | Registry username. |
password | string | Registry password or token. |
Volume Mount Object
Used in rental workloads to attach persistent storage.
| Field | Type | Description |
|---|
uid | string | Required. UID of the volume to mount. |
mount_path | string | Required. Path inside the container to mount at. |
read_only | boolean | Mount as read-only. Defaults to false. |
Serverless Config
Controls auto-scaling behavior, health probes, and request handling for serverless workloads.
| Field | Type | Description |
|---|
min_replicas | integer | Minimum number of replicas. Set to 0 to allow scale-to-zero. |
max_replicas | integer | Maximum number of replicas. |
initial_replicas | integer | Number of replicas at initial deploy. |
container_concurrency | integer | Maximum concurrent requests a single replica handles before queuing. |
target_concurrency | integer | Target concurrent requests per replica for the autoscaler. |
scale_up_delay | string | Delay before scaling up (e.g. "0s"). |
scale_down_delay | string | Delay before scaling down (e.g. "300s"). |
zero_grace_period | string | Grace period before scaling to zero (e.g. "600s"). |
scaling_metric | string | Metric used for autoscaling (e.g. "concurrency", "rps"). |
target_value | number | Target value for the scaling metric. |
timeout_seconds | integer | Request timeout in seconds. |
startup_timeout | integer | Maximum time in seconds for the container to start. |
liveness_probe | object | Liveness probe configuration. See Probe config. |
readiness_probe | object | Readiness probe configuration. See Probe config. |
startup_probe | object | Startup probe configuration. See Probe config. |
custom_annotations | object | Key-value pairs of custom annotations. |
Probe Config
Used for liveness_probe, readiness_probe, and startup_probe.
| Field | Type | Description |
|---|
path | string | HTTP path to probe (e.g. "/healthz"). |
port | integer | Port to probe. |
initial_delay_seconds | integer | Seconds to wait before the first probe. |
period_seconds | integer | How often (in seconds) to run the probe. |
timeout_seconds | integer | Seconds before the probe times out. |
failure_threshold | integer | Consecutive failures before marking unhealthy. |
success_threshold | integer | Consecutive successes before marking healthy. |
Example: Create a Rental Workload
curl -X POST https://api.targon.com/tha/v2/workloads \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-training-job",
"image": "pytorch/pytorch:latest",
"resource_name": "h200-small",
"type": "RENTAL",
"project_id": "prj-abc123def456",
"ports": [
{"port": 8080, "protocol": "TCP", "routing": "PROXIED"},
{"port": 2222, "protocol": "TCP", "routing": "DIRECT"}
],
"envs": [
{"name": "MODEL_NAME", "value": "llama-3"}
],
"volumes": [
{"uid": "vol-xyz789abc123", "mount_path": "/data"}
],
"ssh_keys": ["shk-def456ghi789"]
}'
Example: Create a Serverless Workload
curl -X POST https://api.targon.com/tha/v2/workloads \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-inference-api",
"image": "my-model-server:latest",
"resource_name": "h200-small",
"type": "SERVERLESS",
"project_id": "prj-abc123def456",
"ports": [
{"port": 8080, "protocol": "TCP", "routing": "PROXIED"}
],
"envs": [
{"name": "MODEL_NAME", "value": "llama-3"}
],
"serverless_config": {
"min_replicas": 0,
"max_replicas": 5,
"initial_replicas": 1,
"target_concurrency": 10,
"scale_down_delay": "300s",
"zero_grace_period": "600s",
"timeout_seconds": 60,
"readiness_probe": {
"path": "/healthz",
"port": 8080,
"initial_delay_seconds": 10,
"period_seconds": 5
}
}
}'
Response
Returns the created workload object.
| Field | Type | Description |
|---|
uid | string | Unique identifier for the workload (e.g. wrk-...). |
name | string | Name of the workload. |
image | string | Container image. |
type | string | Workload type (RENTAL or SERVERLESS). |
resource_name | string | Compute resource. |
project_id | string | Project UID. |
app_id | string | App UID. |
ports | array | Port mappings. |
envs | array | Environment variables. |
commands | array | Container commands. |
args | array | Container arguments. |
volumes | array | Volume mounts (rental only). |
ssh_keys | array | Attached SSH keys (rental only). |
serverless_config | object | Serverless configuration (serverless only). |
state | object | Current workload state. |
resource | object | Compute resource details. |
cost_per_hour | number | Hourly cost. |
revision | string | Current revision. |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 8601 last update timestamp. |
The state object:
| Field | Type | Description |
|---|
status | string | Current status. |
message | string | Status message. |
ready_replicas | integer | Number of ready replicas. |
total_replicas | integer | Total number of replicas. |
urls | array | Access URLs for the workload. |
The resource object:
| Field | Type | Description |
|---|
name | string | Resource identifier. |
display_name | string | Human-readable name. |
gpu_type | string | GPU type (e.g. "H200"). |
gpu_count | integer | Number of GPUs. |
vcpu | integer | Virtual CPU cores. |
memory | integer | Memory in MB. |
Example Response (Rental)
{
"uid": "wrk-abc123def456",
"name": "my-training-job",
"image": "pytorch/pytorch:latest",
"type": "RENTAL",
"resource_name": "h200-small",
"project_id": "prj-abc123def456",
"ports": [
{"port": 8080, "protocol": "TCP", "routing": "PROXIED"},
{"port": 2222, "protocol": "TCP", "routing": "DIRECT"}
],
"envs": [
{"name": "MODEL_NAME", "value": "llama-3"}
],
"volumes": [
{"uid": "vol-xyz789abc123", "name": "my-data", "mount_path": "/data"}
],
"ssh_keys": [
{"uid": "shk-def456ghi789", "name": "my-laptop", "public_key_raw": "ssh-ed25519 AAAA..."}
],
"state": {
"status": "REGISTERED",
"message": "",
"ready_replicas": 0,
"total_replicas": 0,
"urls": []
},
"resource": {
"name": "h200-small",
"display_name": "NVIDIA H200 - Small",
"gpu_type": "H200",
"gpu_count": 1,
"vcpu": 12,
"memory": 115000
},
"cost_per_hour": 2.49,
"revision": "1",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
Example Response (Serverless)
{
"uid": "wrk-jkl012mno345",
"name": "my-inference-api",
"image": "my-model-server:latest",
"type": "SERVERLESS",
"resource_name": "h200-small",
"project_id": "prj-abc123def456",
"ports": [
{"port": 8080, "protocol": "TCP", "routing": "PROXIED"}
],
"envs": [
{"name": "MODEL_NAME", "value": "llama-3"}
],
"serverless_config": {
"min_replicas": 0,
"max_replicas": 5,
"initial_replicas": 1,
"target_concurrency": 10,
"scale_down_delay": "300s",
"zero_grace_period": "600s",
"timeout_seconds": 60,
"readiness_probe": {
"path": "/healthz",
"port": 8080,
"initial_delay_seconds": 10,
"period_seconds": 5
}
},
"state": {
"status": "REGISTERED",
"message": "",
"ready_replicas": 0,
"total_replicas": 0,
"urls": []
},
"resource": {
"name": "h200-small",
"display_name": "NVIDIA H200 - Small",
"gpu_type": "H200",
"gpu_count": 1,
"vcpu": 12,
"memory": 115000
},
"cost_per_hour": 2.49,
"revision": "1",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid request body or type-specific validation failed (e.g. serverless_config on a rental). |
| 401 - Unauthorized | Invalid or missing API key. |
| 500 - Internal Server Error | Server error. |
List Workloads
List workloads for the authenticated user, with optional filters.
Endpoint
GET /tha/v2/workloads
Query Parameters
| Field | Type | Description |
|---|
limit | integer | Maximum number of items to return. |
cursor | string | Pagination cursor from a previous response. |
type | string | Filter by workload type (RENTAL, SERVERLESS). |
status | string | Filter by workload status. |
project_id | string | Filter by project UID. |
app_id | string | Filter by app UID. |
name | string | Filter by workload name. |
Example Request
curl -X GET "https://api.targon.com/tha/v2/workloads?type=RENTAL&limit=10" \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
| Field | Type | Description |
|---|
items | array | List of workload summary objects. |
next_cursor | string | Cursor for the next page of results. |
Each item in items:
| Field | Type | Description |
|---|
uid | string | Unique identifier for the workload. |
name | string | Name of the workload. |
image | string | Container image. |
state | object | Current workload state. |
resource | object | Compute resource details. |
cost_per_hour | number | Hourly cost. |
revision | string | Current revision. |
volumes | array | Volume mounts. |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 8601 last update timestamp. |
Example Response
{
"items": [
{
"uid": "wrk-abc123def456",
"name": "my-training-job",
"image": "pytorch/pytorch:latest",
"state": {
"status": "RUNNING",
"message": "",
"ready_replicas": 1,
"total_replicas": 1,
"urls": [{"port": 8080, "url": "https://wrk-abc123def456.caas.targon.com"}]
},
"resource": {
"name": "h200-small",
"display_name": "NVIDIA H200 - Small",
"gpu_type": "H200",
"gpu_count": 1,
"vcpu": 12,
"memory": 115000
},
"cost_per_hour": 2.49,
"revision": "1",
"volumes": [],
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
],
"next_cursor": ""
}
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid query parameters. |
| 401 - Unauthorized | Invalid or missing API key. |
| 500 - Internal Server Error | Server error. |
Get Workload
Retrieve a workload by its UID.
Endpoint
GET /tha/v2/workloads/{workload_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Example Request
curl -X GET https://api.targon.com/tha/v2/workloads/wrk-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns the full workload object (same shape as the Create response).
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Update Workload
Update a workload's configuration. All fields are optional — only include the fields you want to change.
Endpoint
PATCH /tha/v2/workloads/{workload_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Request Body
| Field | Type | Description |
|---|
name | string | New name for the workload. |
image | string | Updated container image. |
project_id | string | Updated project UID. |
app_id | string | Updated app UID. |
ports | array | Updated port mappings. |
envs | array | Updated environment variables. |
commands | array | Updated container commands. |
args | array | Updated container arguments. |
volumes | array | Updated volume mounts. |
ssh_keys | array | Updated SSH key UIDs. |
registry_auth | object | Updated registry credentials. |
serverless_config | object | Updated serverless configuration. |
Example Request
curl -X PATCH https://api.targon.com/tha/v2/workloads/wrk-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"image": "pytorch/pytorch:2.0",
"envs": [
{"name": "MODEL_NAME", "value": "llama-3.1"}
]
}'
Response
Returns the updated workload object.
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid request body. |
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Delete Workload
Delete a workload.
Endpoint
DELETE /tha/v2/workloads/{workload_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Example Request
curl -X DELETE https://api.targon.com/tha/v2/workloads/wrk-abc123def456 \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns 204 No Content on success.
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Deploy Workload
Deploy a registered workload to start running it on the cluster.
Endpoint
POST /tha/v2/workloads/{workload_uid}/deploy
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Example Request
curl -X POST https://api.targon.com/tha/v2/workloads/wrk-abc123def456/deploy \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns 202 Accepted with the workload operation response.
| Field | Type | Description |
|---|
uid | string | Unique identifier of the workload. |
name | string | Name of the workload. |
image | string | Container image. |
state | object | Current workload state. |
resource | object | Compute resource details. |
cost_per_hour | number | Hourly cost. |
revision | string | Current revision. |
volumes | array | Volume mounts. |
created_at | string | ISO 8601 creation timestamp. |
updated_at | string | ISO 8601 last update timestamp. |
Example Response
{
"uid": "wrk-abc123def456",
"name": "my-training-job",
"image": "pytorch/pytorch:latest",
"state": {
"status": "DEPLOYING",
"message": "",
"ready_replicas": 0,
"total_replicas": 1,
"urls": []
},
"resource": {
"name": "h200-small",
"display_name": "NVIDIA H200 - Small",
"gpu_type": "H200",
"gpu_count": 1,
"vcpu": 12,
"memory": 115000
},
"cost_per_hour": 2.49,
"revision": "1",
"volumes": [],
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:36:00Z"
}
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Get Workload State
Get the current state of a workload.
Endpoint
GET /tha/v2/workloads/{workload_uid}/state
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Example Request
curl -X GET https://api.targon.com/tha/v2/workloads/wrk-abc123def456/state \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
| Field | Type | Description |
|---|
uid | string | Unique identifier of the workload. |
workload_type | string | Type of the workload. |
status | string | Current status. |
message | string | Status message. |
ready_replicas | integer | Number of ready replicas. |
total_replicas | integer | Total number of replicas. |
urls | array | Access URLs for the workload. |
updated_at | string | ISO 8601 timestamp of last update. |
Each item in urls:
| Field | Type | Description |
|---|
port | integer | The exposed port. |
url | string | The access URL. |
Example Response
{
"uid": "wrk-abc123def456",
"workload_type": "RENTAL",
"status": "RUNNING",
"message": "",
"ready_replicas": 1,
"total_replicas": 1,
"urls": [
{"port": 8080, "url": "https://wrk-abc123def456.caas.targon.com"}
],
"updated_at": "2025-01-15T10:40:00Z"
}
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload or workload state not found. |
| 500 - Internal Server Error | Server error. |
List Workload Events
List lifecycle events for a workload (status changes, scaling events, errors).
Endpoint
GET /tha/v2/workloads/{workload_uid}/events
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Query Parameters
| Field | Type | Description |
|---|
limit | integer | Maximum number of items to return. |
cursor | string | Pagination cursor. |
Example Request
curl -X GET "https://api.targon.com/tha/v2/workloads/wrk-abc123def456/events?limit=20" \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
| Field | Type | Description |
|---|
items | array | List of workload event objects. |
next_cursor | string | Cursor for the next page of results. |
Each item in items:
| Field | Type | Description |
|---|
workload_uid | string | UID of the workload. |
workload_type | string | Workload type. |
event_type | string | Type of event. |
new_status | string | New workload status. |
message | string | Event message. |
display_message | string | Human-readable message. |
reason | string | Reason for the event. |
pod_name | string | Pod name. |
container_name | string | Container name. |
container_image | string | Container image. |
exit_code | integer | Container exit code. |
replica_count | integer | Current replica count. |
resource_name | string | Compute resource name. |
created_at | string | ISO 8601 event timestamp. |
Example Response
{
"items": [
{
"workload_uid": "wrk-abc123def456",
"workload_type": "RENTAL",
"event_type": "STATUS_CHANGE",
"new_status": "RUNNING",
"message": "All replicas ready",
"display_message": "Workload is now running",
"reason": "",
"pod_name": "wrk-abc123def456-0",
"container_name": "main",
"container_image": "pytorch/pytorch:latest",
"exit_code": 0,
"replica_count": 1,
"resource_name": "h200-small",
"created_at": "2025-01-15T10:35:00Z"
}
],
"next_cursor": ""
}
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid query parameters. |
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Get Workload Logs
Retrieve container logs for a workload.
Endpoint
GET /tha/v2/workloads/{workload_uid}/logs
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
Query Parameters
| Field | Type | Description |
|---|
since | string | Return logs after this timestamp (RFC 3339 format). |
tail | integer | Number of most recent log lines to return. |
follow | boolean | Stream logs in real time. Defaults to false. |
Example Request
curl -X GET "https://api.targon.com/tha/v2/workloads/wrk-abc123def456/logs?tail=100" \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns plain text log output. When follow=true, the response is a streaming text/plain connection.
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid query parameters. |
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload not found. |
| 500 - Internal Server Error | Server error. |
Verify Workload Digest
Verify a workload's container image digest.
Endpoint
POST /tha/v2/workloads/verify
Request Body
| Field | Type | Description |
|---|
uid | string | Required. Workload UID to verify. |
digest | string | Required. Image digest to verify (sha256). |
Example Request
curl -X POST https://api.targon.com/tha/v2/workloads/verify \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"uid": "wrk-abc123def456",
"digest": "5a1b2c3..."
}'
Response
| Field | Type | Description |
|---|
verified | boolean | Whether the digest matches the workload. |
Example Response
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Missing uid or digest. |
| 401 - Unauthorized | Invalid or missing API key. |
| 500 - Internal Server Error | Server error. |
Attach Volume to Workload
Attach a volume to a running rental workload. Rental workloads only.
You can also attach volumes at creation time by including the volumes array in the Create Workload request body before deploying.
Endpoint
PUT /tha/v2/workloads/{workload_uid}/volumes/{volume_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
volume_uid | string | Unique identifier of the volume. |
Request Body
| Field | Type | Description |
|---|
mount_path | string | Required. Path inside the container to mount the volume. |
read_only | boolean | Mount as read-only. Defaults to false. |
Example Request
curl -X PUT https://api.targon.com/tha/v2/workloads/wrk-abc123def456/volumes/vol-xyz789abc123 \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"mount_path": "/data",
"read_only": false
}'
Response
| Field | Type | Description |
|---|
workload_uid | string | Workload UID. |
uid | string | Volume UID. |
mount_path | string | Mount path in the container. |
read_only | boolean | Whether mounted as read-only. |
Example Response
{
"workload_uid": "wrk-abc123def456",
"uid": "vol-xyz789abc123",
"mount_path": "/data",
"read_only": false
}
Errors
| Status Code | Description |
|---|
| 400 - Bad Request | Invalid request body. |
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload or volume not found. |
| 500 - Internal Server Error | Server error. |
Detach Volume from Workload
Detach a volume from a workload. Rental workloads only.
Endpoint
DELETE /tha/v2/workloads/{workload_uid}/volumes/{volume_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
volume_uid | string | Unique identifier of the volume. |
Example Request
curl -X DELETE https://api.targon.com/tha/v2/workloads/wrk-abc123def456/volumes/vol-xyz789abc123 \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns 204 No Content on success.
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 403 - Forbidden | Not allowed. |
| 404 - Not Found | Workload or volume not found. |
| 500 - Internal Server Error | Server error. |
Attach SSH Key to Workload
Attach an SSH key to a workload for secure shell access.
Endpoint
PUT /tha/v2/workloads/{workload_uid}/ssh-keys/{ssh_key_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
ssh_key_uid | string | Unique identifier of the SSH key. |
Example Request
curl -X PUT https://api.targon.com/tha/v2/workloads/wrk-abc123def456/ssh-keys/shk-def456ghi789 \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
| Field | Type | Description |
|---|
workload_uid | string | Workload UID. |
ssh_key_uid | string | SSH key UID. |
Example Response
{
"workload_uid": "wrk-abc123def456",
"ssh_key_uid": "shk-def456ghi789"
}
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 404 - Not Found | Workload or SSH key not found. |
| 409 - Conflict | SSH key is already attached to this workload. |
| 500 - Internal Server Error | Server error. |
Detach SSH Key from Workload
Detach an SSH key from a workload.
Endpoint
DELETE /tha/v2/workloads/{workload_uid}/ssh-keys/{ssh_key_uid}
Path Parameters
| Field | Type | Description |
|---|
workload_uid | string | Unique identifier of the workload. |
ssh_key_uid | string | Unique identifier of the SSH key. |
Example Request
curl -X DELETE https://api.targon.com/tha/v2/workloads/wrk-abc123def456/ssh-keys/shk-def456ghi789 \
-H "Authorization: Bearer <YOUR_API_KEY>"
Response
Returns 204 No Content on success.
Errors
| Status Code | Description |
|---|
| 401 - Unauthorized | Invalid or missing API key. |
| 404 - Not Found | Workload or SSH key attachment not found. |
| 500 - Internal Server Error | Server error. |