Add to a Brand Library
curl --request POST \
--url https://www.trybloom.ai/api/v1/brands/{id}/library \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"source": {
"type": "upload",
"uploadId": "3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d"
}
}
'import requests
url = "https://www.trybloom.ai/api/v1/brands/{id}/library"
payload = { "source": {
"type": "upload",
"uploadId": "3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d"
} }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({source: {type: 'upload', uploadId: '3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d'}})
};
fetch('https://www.trybloom.ai/api/v1/brands/{id}/library', 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://www.trybloom.ai/api/v1/brands/{id}/library",
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([
'source' => [
'type' => 'upload',
'uploadId' => '3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://www.trybloom.ai/api/v1/brands/{id}/library"
payload := strings.NewReader("{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://www.trybloom.ai/api/v1/brands/{id}/library")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.trybloom.ai/api/v1/brands/{id}/library")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"source": "<string>",
"brandSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaceId": "<string>",
"mimeType": "<string>",
"url": "<string>",
"fileSize": 4503599627370495,
"durationMs": 0,
"width": 0,
"height": 0,
"description": "<string>",
"inLibrary": true,
"addedToLibraryAt": "2023-11-07T05:31:56Z",
"generationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"existing": true
}
}{
"error": {
"code": "UPLOAD_UNAVAILABLE",
"status": 400,
"message": "Temporary upload is unavailable",
"data": "<unknown>"
}
}{
"error": {
"code": "UNAUTHORIZED",
"status": 401,
"message": "Invalid or missing API credentials",
"data": "<unknown>"
}
}{
"error": {
"code": "ACCOUNT_BANNED",
"status": 403,
"message": "This account has been suspended.",
"data": "<unknown>"
}
}{
"error": {
"code": "BRAND_NOT_FOUND",
"status": 404,
"message": "Brand not found",
"data": "<unknown>"
}
}{
"error": {
"code": "TOO_MANY_REQUESTS",
"status": 429,
"message": "Rate limit exceeded",
"data": "<unknown>"
}
}{
"error": {
"code": "LIBRARY_UNAVAILABLE",
"status": 503,
"message": "The Library cannot be changed right now",
"data": "<unknown>"
}
}Library
Add to a Brand Library
Add an image, video, or audio file from an upload, existing media, or a URL. Identical file contents return the existing item. Images are up to 10 MiB; video and audio (beta) up to 100 MiB.
POST
/
brands
/
{id}
/
library
Add to a Brand Library
curl --request POST \
--url https://www.trybloom.ai/api/v1/brands/{id}/library \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"source": {
"type": "upload",
"uploadId": "3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d"
}
}
'import requests
url = "https://www.trybloom.ai/api/v1/brands/{id}/library"
payload = { "source": {
"type": "upload",
"uploadId": "3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d"
} }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({source: {type: 'upload', uploadId: '3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d'}})
};
fetch('https://www.trybloom.ai/api/v1/brands/{id}/library', 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://www.trybloom.ai/api/v1/brands/{id}/library",
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([
'source' => [
'type' => 'upload',
'uploadId' => '3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://www.trybloom.ai/api/v1/brands/{id}/library"
payload := strings.NewReader("{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://www.trybloom.ai/api/v1/brands/{id}/library")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.trybloom.ai/api/v1/brands/{id}/library")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"type\": \"upload\",\n \"uploadId\": \"3f2b8c1e-9a4d-4e7b-8c2f-1d5e6a7b8c9d\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"source": "<string>",
"brandSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaceId": "<string>",
"mimeType": "<string>",
"url": "<string>",
"fileSize": 4503599627370495,
"durationMs": 0,
"width": 0,
"height": 0,
"description": "<string>",
"inLibrary": true,
"addedToLibraryAt": "2023-11-07T05:31:56Z",
"generationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"existing": true
}
}{
"error": {
"code": "UPLOAD_UNAVAILABLE",
"status": 400,
"message": "Temporary upload is unavailable",
"data": "<unknown>"
}
}{
"error": {
"code": "UNAUTHORIZED",
"status": 401,
"message": "Invalid or missing API credentials",
"data": "<unknown>"
}
}{
"error": {
"code": "ACCOUNT_BANNED",
"status": 403,
"message": "This account has been suspended.",
"data": "<unknown>"
}
}{
"error": {
"code": "BRAND_NOT_FOUND",
"status": 404,
"message": "Brand not found",
"data": "<unknown>"
}
}{
"error": {
"code": "TOO_MANY_REQUESTS",
"status": 429,
"message": "Rate limit exceeded",
"data": "<unknown>"
}
}{
"error": {
"code": "LIBRARY_UNAVAILABLE",
"status": 503,
"message": "The Library cannot be changed right now",
"data": "<unknown>"
}
}Authorizations
apiKeybearer
Bloom API key, for example x-api-key: bloom_sk_....
Path Parameters
Brand ID
Body
application/json
Where the file comes from.
- Upload
- Existing media
- URL
Show child attributes
Show child attributes
Response
OK
Show child attributes
Show child attributes
Was this page helpful?