Skip to main content

Upload API

Three apis are available for uploading assets.

File size limit

The maximum upload file size is limited to 25MB on all the plans.

File Upload API

The following endpoint provides file upload functionality.

curl --request POST "https://api.pixelbin.io/service/platform/assets/v1.0/upload/direct" \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer BASE_64_ENCODED_API_TOKEN' \
--header 'x-ebg-param: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--header 'x-ebg-signature: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--form 'file=@"/Path/to/file.jpeg"'

Required Headers

All requests should contain the Authentication Signature

Request Body Schema

The body should be of type multipart/form-data.

  1. file: FileReadStream
  2. path: Path to upload folder on Pixelbin
  3. name: Name for the file to be uploaded
  4. tags: Array. Tags to be associated with the asset
  5. metadata: Object. Metadata to be stored with the asset
  6. overwrite: Boolean. If true, overwrites if file exists with the same name.
  7. filenameOverride: Boolean. If true, appends the name if filename already exists.

Response

200

On SUCCESS, api responds with details of the created file.

400

Bad Request, api responds with the reason for rejection.

Url Upload API

The following endpoint provides file upload functionality.

curl --request POST 'https://api.pixelbin.io/service/platform/assets/v1.0/upload/url' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: <REFER-AUTH-API-TOKEN-IN-INTRODUCTION>' \
--header 'x-ebg-param: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--header 'x-ebg-signature: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--data-raw '{ "url": "https://cdn.pixelbin.io/v2/old-scene-ccdc01/original/2-Figure2-1-(1)-transformed.webp", "filenameOverride": true}'

Required Headers

All requests to Pixelbin should contain the Pixelbin Signature

Request Body Schema

The body should be of type application/json.

  1. url: String. url of the asset to be uploaded.
  2. path: Path to upload folder on Pixelbin
  3. name: Name for the file to be uploaded
  4. tags: Array. Tags to be associated with the asset
  5. metadata: Object. Metadata to be stored with the asset
  6. overwrite: Boolean. If true, overwrites if file exists with the same name.
  7. filenameOverride: Boolean. If true, appends the name if filename already exists.

Response

200

On SUCCESS, api responds with details of the created file.

400

Bad Request, api responds with the reason for rejection.

Signed Url Upload API

The following endpoint provides file upload functionality.

curl --request POST 'https://api.pixelbin.io/service/platform/assets/v1.0/upload/signed-url' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: <REFER-AUTH-API-TOKEN-IN-INTRODUCTION>' \
--header 'x-ebg-param: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--header 'x-ebg-signature: <REFER-PIXELBIN-SIGNATURE-GENERATION>' \
--data-raw '{ "name": "asset"}'

Required Headers

All requests to Pixelbin should contain the Pixelbin Signature

Request Body Schema

The body should be of type application/json.

  1. path: Path to upload folder on Pixelbin
  2. name: Name for the file to be uploaded
  3. tags: Array. Tags to be associated with the asset
  4. metadata: Object. Metadata to be stored with the asset
  5. overwrite: Boolean. If true, overwrites if file exists with the same name.
  6. filenameOverride: Boolean. If true, appends the name if filename already exists.

Response

200

On SUCCESS, api responds with an s3PresignedUrl object. It has two parts, url and fields. s3PresignedUrl object can be used for uploading directly to the Pixelbin Storage directly from the frontend.

A POST request can be used with this url with a FormData Body. The first field has to be the File Object to be uploaded. Add the entries in the fields object in the same order to the Body.

400

Bad Request, api responds with the reason for rejection.

Is this page useful?