POST
/
gpu-instance
/
openapi
/
v1
/
template
/
create
curl --request POST \
  --url https://api.novita.ai/gpu-instance/openapi/v1/template/create \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "template": {
    "name": "<string>",
    "readme": "<string>",
    "type": "<string>",
    "channel": "<string>",
    "image": "<string>",
    "startCommand": "<string>",
    "rootfsSize": 123,
    "localVolumeSize": 123,
    "localVolumeMount": "<string>",
    "ports": [
      {
        "type": "<string>",
        "ports": [
          "<string>"
        ]
      }
    ],
    "volumes": [
      {
        "type": "<string>",
        "size": 123,
        "mountPath": "<string>"
      }
    ],
    "envs": [
      {
        "key": "<string>",
        "value": "<string>"
      }
    ]
  }
}'
{
  "templateId": "<string>"
}

Request Headers

Content-Type
string
required

Enum: application/json

Authorization
string
required

Bearer authentication format, for example: Bearer {{API Key}}.

Request Body

template
object
required

Template settings.

Response

templateId
string

ID of the created template.

Example

Request


curl --request POST \
  --url 'https://api.novita.ai/gpu-instance/openapi/v1/template/create' \
  --header 'Authorization: Bearer {{API Key}}' \
  --header 'Content-Type: application/json' \
  --data '{
    "template": {
      "name": "test",
      "readme": "readme",
      "type": "instance",
      "channel": "private",
      "image": "redis",
      "startCommand": "",
      "rootfsSize": 10,
      "localVolumeSize": 20,
      "localVolumeMount": "/workspace",
      "ports": [
        {
          "type": "tcp",
          "ports": [
            "8080",
            "8090"
          ]
        },
        {
          "type": "http",
          "ports": [
            "6000",
            "60001"
          ]
        }
      ],
      "volumes": [
        {
          "type": "local",
          "size": 20,
          "mountPath": "/workspace"
        }
      ],
      "envs": [
        {
          "key": "testkey",
          "value": "123"
        }
      ]
    }
  }'

Response

{
  "templateId": "1"
}