Compressor APIStorageBackblaze B2

Storage - Backblaze B2

Integrate Backblaze B2 Cloud Storage with Compressor using our Secure Storage Connectors system. This approach keeps your Backblaze credentials secure within your Compressor Account, requiring only a connector reference ID in your API calls.

Authentication

Authentication is handled exclusively through Secure Storage Connectors. Create a connector in your Compressor Account dashboard by providing your Backblaze B2 access keys, then reference it using its unique identifier in your API requests.

Authentication Configuration

{
    "store": {
        "id": "your-connector-id"
    }
}

Configuration Options

ParameterTypeRequiredDetails
bucketStringYesTarget Backblaze B2 bucket name.
regionStringYesBackblaze region hosting your bucket: us-west-000, us-west-001, us-west-002, us-east-005, eu-central-003, ca-central-001.
pathStringNoObject destination path (omit leading slash). Defaults to root.
aclStringNoObject access permissions. Default: public-read.
metadataHashNoCustom Backblaze B2 metadata key-value pairs.
headersHashNoCustom HTTP Headers: Cache-Control, Content-Type, Content-Encoding, Content-Disposition.

Implementation Example

Below is a complete API request demonstrating Backblaze B2 integration:

curl https://api.compressor.app/1.0/fetch \
  -X POST \
  -u your-api-key: \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.website.com/image.jpg",
    "image": {
      "resize": {
        "width": 640,
        "height": 480,
        "mode": "fit"
      }
    },
    "store": {
      "id": "your-connector-id",
      "bucket": "my-bucket",
      "region": "eu-central-003",
      "path": "assets/image.jpg",
      "headers": {
        "Cache-Control": "max-age=2592000000"
      }
    }
  }'

API Response

Successful requests return the Backblaze B2 object URL in the response.

{
  "id": "38a8bb5e-7b50-4a22-a0a6-b9602fccb225",
  "url": "https://my-bucket.s3.eu-central-003.backblazeb2.com/image.jpg",
  "input": {
    "name": "image.jpg",
    "type": "image",
    ...
  },
  "output": {
    "name": "image.jpg",
    "type": "image",
    ...
  }
}

Permissions Requirements

When setting up your connector credentials, ensure that the Backblaze B2 application key you provide has appropriate permissions to write files to your target bucket. The application key must have writeFiles capability enabled to allow Compressor to upload and manage objects on your behalf.

On this page