Media

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.

post/v1/utilities/uploads

Request

  • Base URL
    https://api.bachs.io
  • URL
    https://api.bachs.io/v1/utilities/uploads
  • Auth
    HTTP bearer

Request body multipart/form-data

filestring binary required

The file to upload. Maximum 20 MB.

scopestring

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

Response

Upload created

upload_idstring
providerstring
file_namestring
mime_typestring
file_size_bytesinteger
urlstring nullable
linked_resource_typestring nullable

Resource type this upload is attached to, e.g. product.

linked_resource_idstring nullable

ID of the resource this upload is attached to.

created_atstring date-time
updated_atstring date-time

Example response

{
  "upload_id": "upl_4f3e2d1c",
  "provider": "s3",
  "file_name": "product-hero.png",
  "mime_type": "image/png",
  "file_size_bytes": 204800,
  "url": "https://cdn.bachs.io/uploads/upl_4f3e2d1c/product-hero.png"
}

Changes

No recorded changes to this operation across all 1 revision of this API.