Skip to main content
POST
/
v2
/
node_templates
Create node template
curl --request POST \
  --url https://api.sfcompute.com/v2/node_templates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace": "<string>",
  "image": "<string>",
  "name": "my-resource-name",
  "cloud_init_user_data": "IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="
}
'
{
  "id": "<string>",
  "resource_path": "<string>",
  "owner": "<string>",
  "workspace": "<string>",
  "name": "<string>",
  "object": "node_template",
  "image": "image_k3R-nX9vLm7Qp2Yw5Jd8F",
  "cloud_init_user_data_used": true,
  "created_at": 1738972800,
  "cloud_init_user_data": "IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="
}

Authorizations

Authorization
string
header
required

Create an API token using sf tokens create or at https://sfcompute.com/account/api-keys.

Body

application/json
workspace
string
required

Workspace to create this template in.

Pattern: (wksp_[0-9a-zA-Z_-]{1,21})|(sfc:workspace:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){1,3})
Example:

"wksp_k3R-nX9vLm7Qp2Yw5Jd8F"

image
string
required

Machine image to use when starting nodes with this template. Accepts name or ID.

Pattern: (image_[0-9a-zA-Z_-]{1,21})|(sfc:image:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){1,3})
Example:

"image_k3R-nX9vLm7Qp2Yw5Jd8F"

name
null | string
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

cloud_init_user_data
string<byte>

Base64-encoded cloud-init user data. Maximum 64KB.

Example:

"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="

Response

Node template created.

id
string
required
Pattern: ntmpl_[0-9a-zA-Z_-]{1,21}
Example:

"ntmpl_k3R-nX9vLm7Qp2Yw5Jd8F"

resource_path
string
required

A resource path for a node_template resource. Format: sfc:node_template:::.

Pattern: sfc:node_template:([a-zA-Z0-9._-]+:){2}[a-zA-Z0-9._-]+
Example:

"sfc:node_template:<account_id>:<workspace>:<name>"

owner
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

workspace
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

name
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

object
string
default:node_template
required
read-only
Allowed value: "node_template"
image
required

Machine image to use when starting nodes with this template.

Pattern: image_[0-9a-zA-Z_-]{1,21}
Example:

"image_k3R-nX9vLm7Qp2Yw5Jd8F"

cloud_init_user_data_used
boolean
required

Whether cloud-init user data is configured for this template.

created_at
integer<int64>
required

Unix timestamp.

Example:

1738972800

cloud_init_user_data
string<byte>

Base64-encoded cloud-init user data.

Example:

"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="