curl --request POST \
--url https://platformapi.comfy.org/builder/v1/blobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"sizeBytes": 123,
"sha256": "<string>",
"blake3": "<string>",
"reuse": false,
"parts": false
}
'import requests
url = "https://platformapi.comfy.org/builder/v1/blobs"
payload = {
"filename": "<string>",
"sizeBytes": 123,
"sha256": "<string>",
"blake3": "<string>",
"reuse": False,
"parts": False
}
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({
filename: '<string>',
sizeBytes: 123,
sha256: '<string>',
blake3: '<string>',
reuse: false,
parts: false
})
};
fetch('https://platformapi.comfy.org/builder/v1/blobs', 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://platformapi.comfy.org/builder/v1/blobs",
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([
'filename' => '<string>',
'sizeBytes' => 123,
'sha256' => '<string>',
'blake3' => '<string>',
'reuse' => false,
'parts' => false
]),
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://platformapi.comfy.org/builder/v1/blobs"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\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://platformapi.comfy.org/builder/v1/blobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platformapi.comfy.org/builder/v1/blobs")
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 \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\n}"
response = http.request(request)
puts response.read_body{
"blobId": "<string>",
"deduplicated": true,
"uploadUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"parts": [
{
"partNumber": 123,
"offsetBytes": 123,
"sizeBytes": 123,
"uploadUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>",
"message": "<string>"
}Get a scoped upload URL for private content
Private custom nodes and private models upload the same way: ask for a scoped upload URL, then PUT the bytes straight to GCS so the file never passes through Builder. The returned blobId is referenced from the definition.
A request with reuse: true may instead be answered with a blob the workspace already holds for these exact bytes and no upload URL; see BlobUpload.deduplicated. Without it every request mints a fresh upload, which is also how a client replaces a blob whose stored bytes turned out wrong: ask again without reuse and upload to the fresh address.
A request with parts: true is answered with one link per piece instead of one uploadUrl (see BlobUpload.parts). The client PUTs each piece, asks POST /v1/blobs//parts for fresh links to the pieces not landed when the first ones expire, and calls POST /v1/blobs//complete once every piece is in, which joins them into the one object a one-PUT upload leaves.
curl --request POST \
--url https://platformapi.comfy.org/builder/v1/blobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"sizeBytes": 123,
"sha256": "<string>",
"blake3": "<string>",
"reuse": false,
"parts": false
}
'import requests
url = "https://platformapi.comfy.org/builder/v1/blobs"
payload = {
"filename": "<string>",
"sizeBytes": 123,
"sha256": "<string>",
"blake3": "<string>",
"reuse": False,
"parts": False
}
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({
filename: '<string>',
sizeBytes: 123,
sha256: '<string>',
blake3: '<string>',
reuse: false,
parts: false
})
};
fetch('https://platformapi.comfy.org/builder/v1/blobs', 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://platformapi.comfy.org/builder/v1/blobs",
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([
'filename' => '<string>',
'sizeBytes' => 123,
'sha256' => '<string>',
'blake3' => '<string>',
'reuse' => false,
'parts' => false
]),
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://platformapi.comfy.org/builder/v1/blobs"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\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://platformapi.comfy.org/builder/v1/blobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platformapi.comfy.org/builder/v1/blobs")
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 \"filename\": \"<string>\",\n \"sizeBytes\": 123,\n \"sha256\": \"<string>\",\n \"blake3\": \"<string>\",\n \"reuse\": false,\n \"parts\": false\n}"
response = http.request(request)
puts response.read_body{
"blobId": "<string>",
"deduplicated": true,
"uploadUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"parts": [
{
"partNumber": 123,
"offsetBytes": 123,
"sizeBytes": 123,
"uploadUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>",
"message": "<string>"
}授权
请求体
True lets the answer be a blob the workspace already holds for these exact bytes, with deduplicated: true and no uploadUrl; a client that sends it must branch on deduplicated. Absent or false, the answer is always a fresh upload (one uploadUrl, or parts when parts is true), whatever the workspace holds, which is what a client written before this field expects and how a client replaces a held blob whose stored bytes are wrong.
True asks for the upload in pieces: the answer carries parts, one link per piece, and no uploadUrl. sizeBytes is split into at most 32 pieces of at least 64 MiB each (one piece below 128 MiB), and may be at most 128 GiB (137438953472 bytes); a larger one answers 400. Re-use applies first, as without it: a deduplicated answer has no pieces. Absent or false, the answer is one uploadUrl, as before this field.
响应
Created
True when the request said reuse: true and this workspace already held these exact bytes (same kind, filename, sha256, size and blake3): blobId names the blob it already has, uploadUrl and expiresAt are absent, and the client must transfer nothing. False on every fresh mint, and always false for a request that did not ask to reuse. A fresh mint carries uploadUrl and expiresAt, or parts in their place when the request said parts: true.
Branch on this rather than on uploadUrl being absent. A presigned PUT is signed create-only, so replaying an old one against content that already exists fails rather than harmlessly re-uploading.
Presigned PUT; size-locked and no-overwrite. The PUT must send the header x-goog-if-generation-match: 0. The link is signed with that header, so a PUT without it is refused. Present unless deduplicated is true, which only a request with reuse: true can get, or the request said parts: true.