Skip to main content
GET
/
preview
/
v2
/
instance_templates
/
{id}
Get instance template
curl --request GET \
  --url https://api.sfcompute.com/preview/v2/instance_templates/{id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.sfcompute.com/preview/v2/instance_templates/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.sfcompute.com/preview/v2/instance_templates/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.sfcompute.com/preview/v2/instance_templates/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sfcompute.com/preview/v2/instance_templates/{id}"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sfcompute.com/preview/v2/instance_templates/{id}")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.sfcompute.com/preview/v2/instance_templates/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "id": "itmpl_k3R-nX9vLm7Qp2Yw5Jd8F",
  "resource_path": "<string>",
  "owner": "<string>",
  "workspace": "<string>",
  "workspace_id": "<string>",
  "name": "<string>",
  "object": "instance_template",
  "image": {
    "id": "image_k3R-nX9vLm7Qp2Yw5Jd8F",
    "name": "<string>"
  },
  "cloud_init_user_data_used": true,
  "created_at": 1738972800,
  "tags": {
    "env": "prod",
    "team": "infra"
  },
  "cloud_init_user_data": "IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="
}
{
  "error": {
    "type": "authentication_error",
    "message": "<string>"
  }
}
{
  "error": {
    "type": "forbidden",
    "message": "<string>"
  }
}
{
  "error": {
    "type": "not_found",
    "message": "<string>"
  }
}
{
  "error": {
    "type": "api_error",
    "message": "<string>"
  }
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

A resource path like 'sfc:instance_template:acme:prod:my-instance_template' or an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.

Pattern: (itmpl_[0-9a-zA-Z_-]{1,21}|ntmpl_[0-9a-zA-Z_-]{1,21})|(sfc:instance_template:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F"

Response

Instance template details.

id
required

Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.

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

"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F"

resource_path
string
required

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

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

"sfc:instance_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"

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

"wksp_k3R-nX9vLm7Qp2Yw5Jd8F"

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:instance_template
required
read-only
Allowed value: "instance_template"
image
object
required

Machine image to use when starting instances with this template.

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

tags
null | object

Metadata tags attached to this instance template.

Example:
{ "env": "prod", "team": "infra" }
cloud_init_user_data
string<byte>

Base64-encoded cloud-init user data.

Example:

"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="