curl --request POST \
--url https://api.bachs.io/v1/utilities/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form scope=generalconst form = new FormData();
form.append('file', '<string>');
form.append('scope', 'general');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.bachs.io/v1/utilities/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/utilities/uploads"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "scope": "general" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/utilities/uploads"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"scope\"\r\n\r\ngeneral\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"upload_id": "upl_4f3e2d1c",
"file_name": "product-hero.png",
"mime_type": "image/png",
"file_size_bytes": 204800,
"url": "https://cdn.bachs.io/uploads/upl_4f3e2d1c/product-hero.png",
"linked_resource_type": null,
"linked_resource_id": null,
"created_at": "2026-01-24T12:00:00.000Z",
"updated_at": "2026-01-24T12:00:00.000Z"
}{
"detail": "Validation failed for one or more fields",
"error_code": "VALIDATION_ERROR",
"doc_url": "https://docs.bachs.io/api-reference/error-reference#general",
"errors": [
{
"field": "name",
"message": "This field is required",
"type": "missing"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}Upload a file
Upload a file and receive an upload_id. Pass this ID in the media array when creating or updating a product.
Files must be sent as multipart/form-data. Maximum size is 20 MB.
curl --request POST \
--url https://api.bachs.io/v1/utilities/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form scope=generalconst form = new FormData();
form.append('file', '<string>');
form.append('scope', 'general');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.bachs.io/v1/utilities/uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/utilities/uploads"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "scope": "general" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/utilities/uploads"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"scope\"\r\n\r\ngeneral\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"upload_id": "upl_4f3e2d1c",
"file_name": "product-hero.png",
"mime_type": "image/png",
"file_size_bytes": 204800,
"url": "https://cdn.bachs.io/uploads/upl_4f3e2d1c/product-hero.png",
"linked_resource_type": null,
"linked_resource_id": null,
"created_at": "2026-01-24T12:00:00.000Z",
"updated_at": "2026-01-24T12:00:00.000Z"
}{
"detail": "Validation failed for one or more fields",
"error_code": "VALIDATION_ERROR",
"doc_url": "https://docs.bachs.io/api-reference/error-reference#general",
"errors": [
{
"field": "name",
"message": "This field is required",
"type": "missing"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}Authorizations
Bearer token authentication. Pass your API key as Authorization: Bearer sk_.... See Authentication for keys, scopes, and sandbox vs production.
Body
Response
Upload created
A stored file and its metadata.
Unique identifier for this upload. Pass it wherever an endpoint accepts a file reference.
"upl_4f3e2d1c"
The file name you uploaded, preserved unchanged.
"product-hero.png"
The media type detected from the file's contents, which may differ from what its extension suggests.
"image/png"
Size of the stored file in bytes.
204800
ISO 8601 timestamp of when the file was uploaded.
"2026-02-22T12:00:00.000Z"
ISO 8601 timestamp of when the upload was last changed, which includes being attached to a resource.
"2026-02-22T12:01:30.000Z"
URL the file can be fetched from. null for a private upload, which is served only through the API.
"https://cdn.bachs.io/uploads/upl_4f3e2d1c/product-hero.png"
The kind of resource this upload is attached to, for example product. null while the upload is unattached.
"product"
ID of the resource this upload is attached to. null while the upload is unattached.
"prod_abc123"

