API Reference
Complete REST API reference for GPUWorker.
API Reference
All API endpoints are available at https://api.gpuworker.com. Authentication is required for all endpoints except /health, /auth/*, and /blog/*.
Authentication
POST /auth/signup
Create a new account.
{
"name": "Ada Lovelace",
"email": "ada@example.com",
"password": "min8chars"
}
Response: Returns access_token and refresh_token.
POST /auth/login
Authenticate with email and password.
{
"email": "ada@example.com",
"password": "min8chars"
}
POST /auth/refresh
Refresh an expired access token.
{
"refresh_token": "your-refresh-token"
}
GET /me
Returns the authenticated user’s profile. Requires Authorization: Bearer <token> header.
GPU Instances
GET /instances
List all GPU instances for the authenticated user.
POST /instances
Create a new GPU instance.
{
"name": "my-instance",
"gpuTypeId": "NVIDIA GeForce RTX 4090",
"cloudType": "SECURE",
"templateId": "pytorch-cuda12-2.1"
}
GET /instances/:id
Get details of a specific instance.
PATCH /instances/:id
Update an instance configuration.
DELETE /instances/:id
Terminate and delete an instance.
POST /instances/:id/start
Start a stopped instance.
POST /instances/:id/stop
Stop a running instance.
POST /instances/:id/restart
Restart a running instance.
Serverless Endpoints
GET /endpoints
List all serverless endpoints.
POST /endpoints
Create a new serverless endpoint.
{
"name": "llama-inference",
"templateId": "your-template-id",
"gpuIds": "NVIDIA GeForce RTX 4090",
"workersMin": 0,
"workersMax": 3
}
GET /endpoints/:id
Get endpoint details.
PATCH /endpoints/:id
Update endpoint configuration.
DELETE /endpoints/:id
Delete a serverless endpoint.
Storage Volumes
GET /volumes
List all network storage volumes.
POST /volumes
Create a new volume.
{
"name": "training-data",
"size": 100,
"dataCenterId": "US-TX-3"
}
GET /volumes/:id
Get volume details.
PATCH /volumes/:id
Update volume configuration.
DELETE /volumes/:id
Delete a volume (data is permanently lost).
Templates
GET /templates
List all container templates.
POST /templates
Create a new template.
{
"name": "pytorch-2.1",
"imageName": "nvcr.io/nvidia/pytorch:2.1.0-py3.10-cuda12.1",
"dockerStartCmd": "bash -c 'jupyter lab --ip=0.0.0.0'",
"containerDiskInGb": 20,
"volumeInGb": 50
}
GET /templates/:id | PATCH /templates/:id | DELETE /templates/:id
Standard CRUD operations for templates.
Container Registry
GET /registry-auth
List saved registry credentials.
POST /registry-auth
Add private registry credentials.
{
"name": "Docker Hub",
"username": "your-username",
"password": "your-access-token"
}
DELETE /registry-auth/:id
Remove registry credentials.
Billing
GET /billing/instances
Get GPU instance billing summary.
GET /billing/serverless
Get serverless endpoint billing summary.
GET /billing/volumes
Get storage volume billing summary.
Error Format
All errors follow a consistent format:
{
"error": {
"code": 400,
"type": "bad_request",
"message": "Description of the error"
}
}
Common status codes: 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 500 Internal Error.