Skip to main content
POST
Upload a file

Authorizations

Authorization
string
header
required

Bearer token authentication. Pass your API key as Authorization: Bearer sk_.... See Authentication for keys, scopes, and sandbox vs production.

Body

multipart/form-data
file
file
required

The file to upload. Maximum 20 MB.

scope
string
default:general

Logical grouping for the upload. Use product-media for product images. Defaults to general.

Pattern: ^[a-z0-9_-]{1,64}$

Response

Upload created

A stored file and its metadata.

upload_id
string
required

Unique identifier for this upload. Pass it wherever an endpoint accepts a file reference.

Example:

"upl_4f3e2d1c"

file_name
string
required

The file name you uploaded, preserved unchanged.

Example:

"product-hero.png"

mime_type
string
required

The media type detected from the file's contents, which may differ from what its extension suggests.

Example:

"image/png"

file_size_bytes
integer
required

Size of the stored file in bytes.

Example:

204800

created_at
string<date-time>
required

ISO 8601 timestamp of when the file was uploaded.

Example:

"2026-02-22T12:00:00.000Z"

updated_at
string<date-time>
required

ISO 8601 timestamp of when the upload was last changed, which includes being attached to a resource.

Example:

"2026-02-22T12:01:30.000Z"

url
string | null

URL the file can be fetched from. null for a private upload, which is served only through the API.

Example:

"https://cdn.bachs.io/uploads/upl_4f3e2d1c/product-hero.png"

linked_resource_type
string | null

The kind of resource this upload is attached to, for example product. null while the upload is unattached.

Example:

"product"

linked_resource_id
string | null

ID of the resource this upload is attached to. null while the upload is unattached.

Example:

"prod_abc123"