Create an attachment upload URL
curl --request POST \
--url https://api.buildpass.global/builders/{builderId}/attachments/presign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contentType": "image/jpeg",
"fileName": "site-photo.jpg",
"size": 20971520,
"type": "attachment"
}
'import requests
url = "https://api.buildpass.global/builders/{builderId}/attachments/presign"
payload = {
"contentType": "image/jpeg",
"fileName": "site-photo.jpg",
"size": 20971520,
"type": "attachment"
}
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({
contentType: 'image/jpeg',
fileName: 'site-photo.jpg',
size: 20971520,
type: 'attachment'
})
};
fetch('https://api.buildpass.global/builders/{builderId}/attachments/presign', 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.buildpass.global/builders/{builderId}/attachments/presign",
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([
'contentType' => 'image/jpeg',
'fileName' => 'site-photo.jpg',
'size' => 20971520,
'type' => 'attachment'
]),
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.buildpass.global/builders/{builderId}/attachments/presign"
payload := strings.NewReader("{\n \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\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.buildpass.global/builders/{builderId}/attachments/presign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildpass.global/builders/{builderId}/attachments/presign")
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 \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\n}"
response = http.request(request)
puts response.read_body{
"key": "external-uploads/ckbuilder123456789012345678/photo.jpg",
"type": "attachment",
"contentType": "<string>",
"fileName": "<string>",
"maxSize": 41943040,
"uploadHeaders": {
"Content-Length": "41943040",
"Content-Type": "image/jpeg"
},
"uploadUrl": "<string>",
"regionId": "au1"
}Attachments
Create an attachment upload URL
Create a short-lived, builder-scoped S3 PUT URL for an image up to 40 MiB. Upload the bytes directly with the declared Content-Type, then use the returned attachment reference when creating or bulk-upserting photos.
POST
/
builders
/
{builderId}
/
attachments
/
presign
Create an attachment upload URL
curl --request POST \
--url https://api.buildpass.global/builders/{builderId}/attachments/presign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contentType": "image/jpeg",
"fileName": "site-photo.jpg",
"size": 20971520,
"type": "attachment"
}
'import requests
url = "https://api.buildpass.global/builders/{builderId}/attachments/presign"
payload = {
"contentType": "image/jpeg",
"fileName": "site-photo.jpg",
"size": 20971520,
"type": "attachment"
}
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({
contentType: 'image/jpeg',
fileName: 'site-photo.jpg',
size: 20971520,
type: 'attachment'
})
};
fetch('https://api.buildpass.global/builders/{builderId}/attachments/presign', 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.buildpass.global/builders/{builderId}/attachments/presign",
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([
'contentType' => 'image/jpeg',
'fileName' => 'site-photo.jpg',
'size' => 20971520,
'type' => 'attachment'
]),
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.buildpass.global/builders/{builderId}/attachments/presign"
payload := strings.NewReader("{\n \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\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.buildpass.global/builders/{builderId}/attachments/presign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buildpass.global/builders/{builderId}/attachments/presign")
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 \"contentType\": \"image/jpeg\",\n \"fileName\": \"site-photo.jpg\",\n \"size\": 20971520,\n \"type\": \"attachment\"\n}"
response = http.request(request)
puts response.read_body{
"key": "external-uploads/ckbuilder123456789012345678/photo.jpg",
"type": "attachment",
"contentType": "<string>",
"fileName": "<string>",
"maxSize": 41943040,
"uploadHeaders": {
"Content-Length": "41943040",
"Content-Type": "image/jpeg"
},
"uploadUrl": "<string>",
"regionId": "au1"
}Requires a valid authenticated request for the builder. No resource-specific
scope is required.
Creates a short-lived, builder-scoped S3 upload URL for an image up to 40 MiB.
The endpoint returns
Do not append parameters such as
200 OK because it creates an upload intent rather than a
persisted BuildPass resource.
Send the image bytes directly to the returned uploadUrl with PUT and the
exact returned uploadHeaders. Then use the returned
{ key, regionId, type } attachment reference when creating or bulk-upserting
photos.
The External API validates the image bytes, type, and final size when the
attachment reference is consumed.
Sending the upload
Server-side clients should send every returneduploadHeaders value verbatim:
await fetch(uploadUrl, {
method: "PUT",
headers: uploadHeaders,
body: imageBytes,
});
charset to Content-Type, because changing
a signed header makes S3 reject the request. Browser Fetch APIs do not allow
JavaScript to set Content-Length; in a browser, send the returned
Content-Type, use the original File as the body, and ensure File.size
exactly matches the size used to create the upload URL. The browser will
derive the matching content length.Authorizations
Body
application/json
Response
200 - application/json
Attachment upload URL created