Get upload part URL
curl --request POST \
--url https://api.sfcompute.com/preview/v2/images/{id}/parts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"part_id": 2
}'import requests
url = "https://api.sfcompute.com/preview/v2/images/{id}/parts"
payload = { "part_id": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({part_id: 2})
};
fetch('https://api.sfcompute.com/preview/v2/images/{id}/parts', 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/images/{id}/parts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'part_id' => 2
]),
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/images/{id}/parts"
payload := strings.NewReader("{\n \"part_id\": 2\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sfcompute.com/preview/v2/images/{id}/parts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"part_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sfcompute.com/preview/v2/images/{id}/parts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"part_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>",
"expires_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": "api_error",
"message": "<string>"
}
}Images
Get upload part URL
⚠️ This endpoint is in public preview.
Get a presigned URL to upload one part of a multipart image upload.
POST
/
preview
/
v2
/
images
/
{id}
/
parts
Get upload part URL
curl --request POST \
--url https://api.sfcompute.com/preview/v2/images/{id}/parts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"part_id": 2
}'import requests
url = "https://api.sfcompute.com/preview/v2/images/{id}/parts"
payload = { "part_id": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({part_id: 2})
};
fetch('https://api.sfcompute.com/preview/v2/images/{id}/parts', 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/images/{id}/parts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'part_id' => 2
]),
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/images/{id}/parts"
payload := strings.NewReader("{\n \"part_id\": 2\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sfcompute.com/preview/v2/images/{id}/parts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"part_id\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sfcompute.com/preview/v2/images/{id}/parts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"part_id\": 2\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>",
"expires_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": "api_error",
"message": "<string>"
}
}Authorizations
Create an API token using sf tokens create or at https://sfcompute.com/account/api-keys.
Path Parameters
Image ID, name, or resource path A resource path like 'sfc:image:acme:prod:my-image' 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:
(image_[0-9a-zA-Z_-]{1,21}|vmi_[0-9a-zA-Z_-]{1,21})|(sfc:image:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})Example:
"image_k3R-nX9vLm7Qp2Yw5Jd8F"
Body
application/json
Caller-assigned part number, starting at 1.
Required range:
x >= 1⌘I