Skip to main content
PATCH
/
preview
/
v2
/
deployments
/
{id}
Update deployment
curl --request PATCH \
  --url https://api.sfcompute.com/preview/v2/deployments/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "my-resource-name",
  "instance_template": "itmpl_k3R-nX9vLm7Qp2Yw5Jd8F",
  "enabled": true,
  "target_instance_count": 123,
  "instance_name_template": "my-fleet-{{nanoid(9)}}"
}
'
import requests

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

payload = {
"name": "my-resource-name",
"instance_template": "itmpl_k3R-nX9vLm7Qp2Yw5Jd8F",
"enabled": True,
"target_instance_count": 123,
"instance_name_template": "my-fleet-{{nanoid(9)}}"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'my-resource-name',
instance_template: 'itmpl_k3R-nX9vLm7Qp2Yw5Jd8F',
enabled: true,
target_instance_count: 123,
instance_name_template: 'my-fleet-{{nanoid(9)}}'
})
};

fetch('https://api.sfcompute.com/preview/v2/deployments/{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/deployments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'my-resource-name',
'instance_template' => 'itmpl_k3R-nX9vLm7Qp2Yw5Jd8F',
'enabled' => true,
'target_instance_count' => 123,
'instance_name_template' => 'my-fleet-{{nanoid(9)}}'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

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

curl_close($curl);

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

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

func main() {

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

payload := strings.NewReader("{\n \"name\": \"my-resource-name\",\n \"instance_template\": \"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"enabled\": true,\n \"target_instance_count\": 123,\n \"instance_name_template\": \"my-fleet-{{nanoid(9)}}\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.sfcompute.com/preview/v2/deployments/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-resource-name\",\n \"instance_template\": \"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"enabled\": true,\n \"target_instance_count\": 123,\n \"instance_name_template\": \"my-fleet-{{nanoid(9)}}\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-resource-name\",\n \"instance_template\": \"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"enabled\": true,\n \"target_instance_count\": 123,\n \"instance_name_template\": \"my-fleet-{{nanoid(9)}}\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "resource_path": "<string>",
  "owner": "<string>",
  "workspace": "<string>",
  "workspace_id": "<string>",
  "name": "<string>",
  "object": "deployment",
  "capacity": {
    "id": "cap_k3R-nX9vLm7Qp2Yw5Jd8F",
    "name": "<string>"
  },
  "pool": {
    "id": "<string>",
    "name": "<string>"
  },
  "instance_template": {
    "id": "itmpl_k3R-nX9vLm7Qp2Yw5Jd8F",
    "name": "<string>"
  },
  "enabled": true,
  "target_instance_count": 123,
  "instance_name_template": "<string>",
  "status": {
    "message": "<string>"
  },
  "created_at": 1738972800,
  "updated_at": 1738972800
}
{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}
{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}
{
"error": {
"type": "forbidden",
"message": "<string>"
}
}
{
"error": {
"type": "not_found",
"message": "<string>"
}
}
{
"error": {
"type": "unprocessable_entity",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<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:deployment:acme:prod:my-deployment' 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: (depl_[0-9a-zA-Z_-]{1,21})|(sfc:deployment:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"depl_k3R-nX9vLm7Qp2Yw5Jd8F"

Body

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

"my-resource-name"

instance_template
null | string

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"

enabled
boolean | null
target_instance_count
integer<int32> | null
instance_name_template
null | string

A name template using {{variable}} syntax. Available variables: {{adjective}} (~128 random adjectives), {{noun}} (~128 random nouns), {{nanoid(N)}} (N-character alphanumeric identifier, 1 ≤ N ≤ 21). The template must produce enough unique combinations to avoid collisions — equivalent to at least the default template {{adjective}}-{{noun}}-{{nanoid(6)}} (~1 quadrillion possibilities). Must start with an alphanumeric character. Resolved names are limited to 255 characters.

Maximum string length: 512
Example:

"my-fleet-{{nanoid(9)}}"

Response

Deployment updated.

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

"depl_k3R-nX9vLm7Qp2Yw5Jd8F"

resource_path
string
required

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

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

"sfc:deployment:<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:deployment
required
read-only
Allowed value: "deployment"
capacity
object
required

Deprecated — use pool.

pool
object
required

A pool referenced by id and name.

instance_template
object
required
enabled
boolean
required
target_instance_count
integer<int32>
required
instance_name_template
string
required

A name template using {{variable}} syntax. Available variables: {{adjective}} (~128 random adjectives), {{noun}} (~128 random nouns), {{nanoid(N)}} (N-character alphanumeric identifier, 1 ≤ N ≤ 21). The template must produce enough unique combinations to avoid collisions — equivalent to at least the default template {{adjective}}-{{noun}}-{{nanoid(6)}} (~1 quadrillion possibilities). Must start with an alphanumeric character. Resolved names are limited to 255 characters.

Maximum string length: 512
Example:

"my-fleet-{{nanoid(9)}}"

status
object
required
created_at
integer<int64>
required

Unix timestamp.

Example:

1738972800

updated_at
integer<int64>
required

Unix timestamp.

Example:

1738972800