PUT
/
api
/
v0
/
asks
/
{id}
/
create instance
curl --request PUT \
  --url https://console.vast.ai/api/v0/asks/{id}/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "template_id": 89,
  "template_hash_id": "abc123def456",
  "image": "tensorflow/tensorflow:latest-gpu",
  "disk": 32,
  "env": {
    "JUPYTER_TOKEN": "abc123",
    "PORTAL_CONFIG": "{\"ports\": [8080, 8081]}"
  },
  "runtype": "jupyter",
  "onstart": "pip install -r requirements.txt",
  "label": "training-job-1",
  "image_login": "-u username -p password docker.io",
  "price": 0.4,
  "target_state": "running",
  "cancel_unavail": true,
  "vm": false,
  "client_id": "me",
  "apikey_id": "<string>",
  "args": [
    "-c",
    "echo hello; sleep infinity;"
  ],
  "entrypoint": "bash",
  "use_ssh": true,
  "python_utf8": true,
  "lang_utf8": true,
  "use_jupyter_lab": true,
  "jupyter_dir": "<string>",
  "force": true,
  "user": "<string>",
  "volume_info": {
    "create_new": true,
    "volume_id": 123,
    "size": 123,
    "mount_path": "<string>",
    "name": "<string>"
  }
}'
{
  "success": true,
  "new_contract": 1234568
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
integer
required

ID of the offer to accept

Body

application/json
template_id
integer

Optional template ID to use for instance configuration

Example:

89

template_hash_id
string

Optional template hash ID to use for instance configuration

Example:

"abc123def456"

image
string

Docker image to use for the instance

Maximum length: 1024
Example:

"tensorflow/tensorflow:latest-gpu"

disk
number
default:10

Storage space in GB

Required range: x >= 8
Example:

32

env
object

Environment variables and port mappings

Example:
{
"JUPYTER_TOKEN": "abc123",
"PORTAL_CONFIG": "{\"ports\": [8080, 8081]}"
}
runtype
enum<string>

Instance run type

Available options:
ssh,
jupyter,
args,
ssh_proxy,
ssh_direct,
jupyter_proxy,
jupyter_direct
Example:

"jupyter"

onstart
string

Commands to run when instance starts

Maximum length: 4096
Example:

"pip install -r requirements.txt"

label
string

User-defined label for the instance

Maximum length: 256
Example:

"training-job-1"

image_login
string

Docker registry credentials if needed

Example:

"-u username -p password docker.io"

price
number

Bid price per hour for interruptible instances

Required range: 0.001 <= x <= 128
Example:

0.4

target_state
enum<string>
default:running

Desired initial state of the instance

Available options:
running,
stopped
Example:

"running"

cancel_unavail
boolean

Whether to cancel if instance cannot start immediately. Defaults to false for interruptibles, true for on-demand with target_state='running'

Example:

true

vm
boolean
default:false

Whether this is a VM instance

client_id
string

Client identifier (usually "me")

Example:

"me"

apikey_id
string

Optional API key identifier for audit logging

args
string[]

Arguments to pass to the container entrypoint

Example:
["-c", "echo hello; sleep infinity;"]
entrypoint
string

Override entrypoint for args launch instance

Example:

"bash"

use_ssh
boolean

Launch as an SSH instance type (deprecated, use runtype instead)

python_utf8
boolean

Set python's locale to C.UTF-8

lang_utf8
boolean

Install and generate locales before instance launch, set locale to C.UTF-8

use_jupyter_lab
boolean

Launch instance with jupyter lab instead of notebook

jupyter_dir
string

Directory in instance to use to launch jupyter

force
boolean

Skip sanity checks when creating from an existing instance

user
string

User to use with docker create (breaks some images, use with caution)

volume_info
object

Volume creation/linking information

Response

Instance created successfully

success
boolean
Example:

true

new_contract
integer

ID of the newly created instance contract

Example:

1234568