Launch and end GPUs with the API
The API follows the same rules as the console, including your contract, credit limit and budget.
Connect
The API is for customers with a contract. Create an API key in the console under Keys. Send it with every request in the Authorization header, as shown in the launch example. Set T42_URL to this site’s address. Anyone with the key can launch and terminate instances, so keep it out of your code.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /api/v1/catalog | The sizes, prices and GPU limits in your contract, with availability and when it was checked |
GET | /api/v1/ssh-keys | Your SSH keys |
GET | /api/v1/instances | Your 200 newest instances |
POST | /api/v1/instances | Launch an instance |
GET | /api/v1/instances/{id} | One instance |
POST | /api/v1/instances/{id}/restart | Restart a running instance |
DELETE | /api/v1/instances/{id} | Terminate an instance and stop billing |
GET | /api/v1/usage | Your usage this month, credit and budget, in cents |
Launch an instance
curl -X POST "$T42_URL/api/v1/instances" \
-H "Authorization: Bearer $T42_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: train-run-0001" \
-d '{
"name": "train-1",
"sku": "b300-8x",
"region": "us-central",
"image": "ubuntu-24-cuda",
"sshKeyId": "ssh_...",
"autoEnd": "24"
}'Idempotency-Key is required: 8 to 100 letters, numbers, hyphens or underscores. If a request times out, send it again with the same key. You’ll get the same instance back, not a second one.
autoEnd is required. Use 4, 24, 72 or 168 hours as text, or none. The time counts from your launch request.
Sizes: b300-1x, b300-2x, b300-4x, b300-8x, h200-1x, h200-2x, h200-4x, h200-8x, h100-1x, h100-2x, h100-4x, h100-8x. You can launch only the GPUs in your contract, up to its limits.
Regions: us-central, us-east
Images: ubuntu-24-cuda, ubuntu-24-pytorch
When something goes wrong
{
"error": {
"code": "credit_limit",
"message": "This launch needs ..."
}
}Use code in your software, because messages can change. A launch can be accepted and then fail, so check the instance’s status. A failed launch costs nothing.
Limits: 120 requests a minute for each key, including up to 10 launches. Over that, you’ll get status 429.