Skip to main content

Prerequisites

  • An API token (contact our sales team)
  • curl, Python with requests, or Node.js with node-fetch

Authentication

All API requests require a Bearer token in the Authorization header. Your token is non-transferable — all charges and resources are associated to your account through your token.
StatusMeaning
401 UnauthorizedMissing, invalid, or expired token
403 ForbiddenToken is valid but you don’t have access to the requested resource

Step 1: Check available GPUs

curl https://supply-api.compute-index.com/available_gpus \
  -H "Authorization: Bearer $TOKEN"
This returns GPU family names (like H100) and their canonical variants (like nvidia-h100-sxm5-80gb). You can use either format when requesting offers.

Step 2: Get offers

curl -X POST https://supply-api.compute-index.com/get_offers \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/yaml" \
  -d '
compute:
  gpu_type: H100
  gpu_count: 1
  max_price_per_gpu_hour: 5
  contract_type: ondemand
'
The response includes offers from all vendors, sorted by price. Each offer has an offer_id and expires after 30 minutes.

Step 3: Procure an offer

curl -X POST https://supply-api.compute-index.com/procure_offer \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "offer_id": "YOUR_OFFER_ID",
    "ssh_public_key": "ssh-ed25519 AAAA... your-key"
  }'
Provisioning is asynchronous. The response returns a status — poll until ready.

Step 4: Poll until ready

curl https://supply-api.compute-index.com/offers/YOUR_OFFER_ID/status \
  -H "Authorization: Bearer $TOKEN"
When procurement_status is "ready", you’ll see instances with external_ip and ssh_command.

Step 5: Connect

Use the private key that corresponds to the public key you provided in Step 3:
ssh -i ~/.ssh/your_private_key root@INSTANCE_IP

Step 6: Clean up

# List resources for this offer
curl "https://supply-api.compute-index.com/resources?offer_id=YOUR_OFFER_ID" \
  -H "Authorization: Bearer $TOKEN"

# Delete the resource
curl -X DELETE "https://supply-api.compute-index.com/resources/RESOURCE_ID?force=true" \
  -H "Authorization: Bearer $TOKEN"
For a complete, copy-paste-ready script that handles the full lifecycle, see the Full Example.