Skip to main content
Backblaze B2 is an S3-compatible object storage service. Mixpeek auto-discovers your regional endpoint — you only need your application key ID and application key.

Overview

The Backblaze B2 integration lets Mixpeek sync objects from any B2 bucket into your Mixpeek buckets for processing. Each file becomes a bucket object with its metadata, ready for feature extraction in your collections. Mixpeek uses Backblaze’s S3-compatible API via the standard AWS SDK. On connection creation, it calls the B2 authorization API to discover your account’s correct regional endpoint (e.g., s3.us-east-005.backblazeb2.com) automatically.

Prerequisites

  • An active Backblaze account with B2 Cloud Storage enabled.
  • An application key with at minimum: listBuckets, listFiles, and readFiles capabilities.
  • The key ID and application key (shown once at creation — copy it immediately).

Configuration

Connection-Level Fields

FieldRequiredDescription
key_idYesBackblaze B2 application key ID
application_keyYesBackblaze B2 application key (secret) — encrypted at rest

Sync-Level Fields

FieldRequiredDescription
source_pathYesb2://bucket-name/optional/prefix or bucket-name/prefix
sync_modeNocontinuous, one_time, or scheduled
polling_interval_secondsNoSeconds between scheduled runs
include_patternsNoGlob patterns to include (e.g., ["*.mp4", "*.jpg"])
exclude_patternsNoGlob patterns to exclude (e.g., ["*.tmp"])
modified_sinceNoOnly sync files modified after this ISO 8601 timestamp

Setup

1

Create a Backblaze application key

  1. Log in to the Backblaze Console.
  2. Go to App Keys in the left sidebar.
  3. Click Add a New Application Key.
  4. Set a name (e.g., mixpeek-sync) and choose the buckets to grant access to.
  5. Enable: Read and Write Files, List Buckets, List Files, Read Files.
  6. Click Create New Key and copy both the keyID and applicationKey immediately — the key is shown only once.
The application key is shown only once at creation. If you lose it, you must create a new key.
2

Create the storage connection in Mixpeek

from mixpeek import Mixpeek

client = Mixpeek(api_key="your-mixpeek-api-key")

connection = client.organizations.connections.create(
    name="Backblaze B2 Production",
    provider_type="backblaze",
    provider_config={
        "credentials": {
            "type": "application_key",
            "key_id": "005870eff85b6c60000000001",
            "application_key": "K005...",
        },
    },
)
print(f"Created connection: {connection['connection_id']}")
3

Create a sync configuration on your bucket

sync = client.buckets.syncs.create(
    bucket_id="bkt_your_bucket_id",
    connection_id=connection["connection_id"],
    source_path="b2://my-backblaze-bucket/videos/",
    sync_mode="scheduled",
    polling_interval_seconds=3600,  # Hourly
)
print(f"Sync created: {sync['sync_config_id']}")
4

Trigger your first sync

curl -X POST https://api.mixpeek.com/v1/buckets/bkt_your_bucket_id/syncs/SYNC_CONFIG_ID/trigger \
  -H "Authorization: Bearer YOUR_MIXPEEK_API_KEY" \
  -H "X-Namespace: ns_your_namespace_id"

Advanced Configuration

For production, create a key scoped to a specific bucket:
  1. In Backblaze Console → App Keys → Add New Key
  2. Under Allow access to Bucket(s), select a single bucket
  3. This limits the key’s blast radius if it’s ever compromised

File Filtering

Filter which files are synced using glob patterns:
sync = client.buckets.syncs.create(
    bucket_id="bkt_your_bucket_id",
    connection_id=connection["connection_id"],
    source_path="b2://my-bucket/",
    sync_mode="scheduled",
    polling_interval_seconds=86400,
    include_patterns=["*.mp4", "*.mov", "*.jpg"],
    exclude_patterns=["*_thumbnail.*", "*.tmp"],
)

Incremental Sync

Only sync files added or modified after a specific date:
from datetime import datetime, timezone

sync = client.buckets.syncs.create(
    bucket_id="bkt_your_bucket_id",
    connection_id=connection["connection_id"],
    source_path="b2://my-bucket/",
    sync_mode="continuous",
    polling_interval_seconds=300,
    modified_since="2024-01-01T00:00:00Z",
)

Source Path Format

The source_path supports multiple formats:
FormatExampleDescription
b2://bucket/prefixb2://my-videos/2024/Preferred — explicit B2 scheme
s3://bucket/prefixs3://my-videos/2024/S3-style URI also accepted
bucket/prefixmy-videos/2024/Bare bucket + prefix
bucketmy-videosEntire bucket

Sync Modes

ModeDescriptionWhen to Use
continuousPolls every polling_interval_secondsReal-time monitoring, active uploads
one_timeSingle import, then completesHistorical backfills, migrations
scheduledRuns on a fixed intervalRegular batch processing

Troubleshooting

Your key ID or application key is incorrect:
  1. In the Backblaze Console → App Keys, verify the keyID column matches what you entered.
  2. The application key is only shown once — if you lost it, create a new key.
  3. Ensure the key has not expired or been deleted.
  • Verify the source_path matches the correct bucket name (case-sensitive).
  • Check that your application key has listFiles and readFiles capabilities.
  • If the key is scoped to a specific bucket, ensure the bucket name in source_path matches exactly.
  • Check include_patterns — make sure they match your file extensions.
Your application key may have listBuckets but not listFiles on a specific bucket:
  1. Create a new key with List Files and Read Files enabled for the target bucket.
  2. Update the connection with the new key.
Backblaze B2 uses flat key namespacing (like S3). Folders are just key prefixes.
  • Use b2://bucket/ (trailing slash) to sync all files recursively.
  • Use b2://bucket/subfolder/ to scope to a specific prefix.