REST API
JSON over HTTPS for scripts and AI agents. Every endpoint below is also described in the machine-readable OpenAPI 3.1 document.
Conventions
- Authenticate with
Authorization: Bearer gph_…. Keys are limited to their scopes. - Amounts are decimal strings in credits, e.g.
"1.725000"(1 credit = 1 USD). POST /api/instancesrequires anIdempotency-Keyheader. Retrying with the same key returns the same instance and never charges twice.- Requests are rate limited. A 429 response includes a Retry-After header.
Errors use one shape:
{ "error": { "code": "INSUFFICIENT_FUNDS", "message": "Insufficient credits to start this instance", "details": { ... } } }Example: rent and stop a GPU
# 1. Find the cheapest GPU with at least 24 GB VRAM
curl -s -H "Authorization: Bearer $TENSOR_API_KEY" \
"https://<host>/api/agent/compare?minVram=24&rankBy=price&limit=3"
# 2. Rent it (idempotent)
curl -s -X POST https://<host>/api/instances \
-H "Authorization: Bearer $TENSOR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"listingId":"<listingId>","name":"training-run"}'
# 3. Poll until status is RUNNING
curl -s -H "Authorization: Bearer $TENSOR_API_KEY" https://<host>/api/instances/<id>
# 4. Stop it (billing ends, unused hold released)
curl -s -X POST -H "Authorization: Bearer $TENSOR_API_KEY" https://<host>/api/instances/<id>/stopEndpoints
/api/gpusList rentable GPU listings with prices (credits/hour) and filter facets
gpus:read- ?type
- gpu|cpu (omit for both)
- ?minVcpu
- int
- ?brand
- NVIDIA|AMD
- ?model
- substring
- ?minVram
- int GB
- ?maxPrice
- credits/hour
- ?region
- string
- ?availability
- AVAILABLE|LIMITED|UNAVAILABLE
- ?provider
- provider slug
- ?sort
- price_asc|price_desc|vram_desc|perf_desc
/api/gpus/{id}Get one GPU listing
gpus:read/api/agent/compareRank available offers by price, price per VRAM-GB or price per FP16 TFLOP
gpus:read- ?minVram
- int
- ?maxPricePerHour
- number
- ?rankBy
- price|price_per_vram|price_per_tflop
- ?includeSimulated
- true|false
- ?limit
- 1-50
/api/instancesRent a GPU. Requires Idempotency-Key header. Reserves credits, then provisions.
instances:writeIdempotent- listingId
- string (required)
- name
- string
- image
- container image
/api/instancesList your instances
instances:read- ?status
- active|all
/api/instances/{id}Instance details, connection info (owner only) and billed usage
instances:read/api/instances/{id}/refreshReconcile instance state with the provider now
instances:read/api/instances/{id}/metricsLive GPU/CPU utilization from the provider
instances:read/api/instances/{id}/stopGracefully stop and release the instance (billing ends)
instances:writeIdempotent/api/instances/{id}/terminateTerminate immediately (billing ends)
instances:writeIdempotent/api/walletBalance, reserved credits, totals
billing:read/api/wallet/transactionsLedger entries (cursor paginated)
billing:read- ?type
- ledger type
- ?cursor
- id
- ?limit
- 1-200
/api/usageDaily spend series and billed usage records
billing:read- ?days
- 1-365
/api/wallet/depositVerify an on-chain deposit (if enabled) or claim dev test credits (development only)
- method
- CRYPTO|DEV_FAUCET
- txHash
- 0x… (CRYPTO)
- amount
- number (DEV_FAUCET)
/api/api-keysList API keys
/api/api-keysCreate an API key (secret shown once)
- name
- string
- scopes
- string[]
- dailySpendLimit
- credits|null (required for instances:write)
- maxConcurrentInstances
- int
- expiresInDays
- int|null
/api/api-keys/{id}Revoke an API key