curl --request POST \
--url https://brew.new/api/v1/content/image-uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"size": 10000000
}
'import requests
url = "https://brew.new/api/v1/content/image-uploads"
payload = {
"fileName": "<string>",
"size": 10000000
}
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>', size: 10000000})
};
fetch('https://brew.new/api/v1/content/image-uploads', 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://brew.new/api/v1/content/image-uploads",
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>',
'size' => 10000000
]),
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://brew.new/api/v1/content/image-uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"size\": 10000000\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://brew.new/api/v1/content/image-uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"size\": 10000000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/content/image-uploads")
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 \"size\": 10000000\n}"
response = http.request(request)
puts response.read_bodyCreate an image upload
Opens a single-use upload for one local image file. POST the file’s raw bytes to the returned uploadUrl, then call addImage with the uploadId to put it in the brand library. The bytes go straight to storage, so files up to 20 MB fit even though a JSON body is capped far lower. Free; no credits are charged.
Use when the image is a file on your machine rather than a public URL (a public URL goes straight to addImage as imageUrl).
Input fileName, contentType (image/png, image/jpeg, image/gif, image/webp, image/avif, image/tiff or image/svg+xml) and size in bytes (at most 20,000,000; 2,097,152 for SVG).
Returns 201 with { uploadId, uploadUrl, expiresAt, maxBytes }. Within 15 minutes, send the bytes: curl -X POST --data-binary @logo.png "<uploadUrl>" answers 200 with { uploadId, status: "uploaded", size, expiresAt }; call addImage before that expiresAt (15 minutes from when the bytes land) (404 UPLOAD_NOT_FOUND for an unknown or expired URL, 413 PAYLOAD_TOO_LARGE over maxBytes). The URL carries its own credential; keep it private. Sending again never replaces the first file.
Errors 400 INVALID_REQUEST for an unsupported contentType or a size over the cap; 429 RATE_LIMITED also when the brand already has 20 uploads open (its message says so, and Retry-After is when the oldest expires).
See also addImage, getBrandImages.
curl --request POST \
--url https://brew.new/api/v1/content/image-uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "<string>",
"size": 10000000
}
'import requests
url = "https://brew.new/api/v1/content/image-uploads"
payload = {
"fileName": "<string>",
"size": 10000000
}
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>', size: 10000000})
};
fetch('https://brew.new/api/v1/content/image-uploads', 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://brew.new/api/v1/content/image-uploads",
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>',
'size' => 10000000
]),
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://brew.new/api/v1/content/image-uploads"
payload := strings.NewReader("{\n \"fileName\": \"<string>\",\n \"size\": 10000000\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://brew.new/api/v1/content/image-uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\",\n \"size\": 10000000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/content/image-uploads")
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 \"size\": 10000000\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Send your Brew API key as Authorization: Bearer brew_xxx.
Headers
The brand this request acts on. REQUIRED for organization-scoped credentials (otherwise 400 BRAND_ID_REQUIRED — there is no default brand); list ids with GET /v1/brands. Brand-scoped credentials may omit it, and sending a different brand returns 403 BRAND_SCOPE_MISMATCH. A brand outside your organization returns 404 BRAND_NOT_FOUND.
1 - 64Body
The file to upload: its name, type and size in bytes.
The file name, for example logo.png. It names the converted file; the library description comes from the image caption.
1 - 255The file type: image/png, image/jpeg, image/gif, image/webp, image/avif, image/tiff or image/svg+xml. It sets the size cap (2 MB for SVG). The bytes decide what is converted: a declared type that differs is ignored, and bytes that are none of these formats are refused when the image is added.
image/jpeg, image/png, image/gif, image/webp, image/avif, image/tiff, image/svg+xml The file size in bytes: at most 20,000,000 (2,097,152 for SVG).
1 <= x <= 20000000Was this page helpful?