Connect Retool to Backblaze B2 using a REST API Resource configured with B2's S3-compatible API endpoint. Authenticate with an application key ID and application key, configure the S3-compatible base URL for your region, then query B2 buckets and objects using the same patterns as AWS S3 — without needing Retool's native S3 connector.
| Fact | Value |
|---|---|
| Tool | Backblaze B2 |
| Category | Storage |
| Method | REST API Resource |
| Difficulty | Intermediate |
| Time required | 20 minutes |
| Last updated | April 2026 |
Why Build a Retool Backblaze B2 Dashboard?
Teams using Backblaze B2 as a cost-effective alternative to AWS S3 for backups, media storage, or large file archives often lack a centralized management interface beyond Backblaze's web console. A Retool B2 dashboard lets operations teams build a tailored storage management panel: browse bucket contents, monitor storage usage, generate download links, review object metadata, and manage lifecycle policies — all within a controlled internal tool that can be restricted to specific team members without giving them full Backblaze account access.
Backblaze B2's S3-compatible API makes the Retool integration straightforward for teams already familiar with S3 patterns. The endpoint format, bucket/object listing calls, and authentication structure all follow AWS S3 conventions, meaning transformers and query patterns developed for S3 work with minimal modification against B2. This is especially valuable for teams migrating from S3 to B2 for cost savings — your Retool dashboard can be adapted incrementally rather than rebuilt from scratch.
Retool's server-side request proxying keeps your B2 application key off the browser entirely. Unlike building a custom management interface in a web frontend where API credentials would be exposed in network requests, all B2 API calls in Retool flow through Retool's backend proxy. Storing your application key in Retool's configuration variables (marked as secret) ensures credentials are never accessible to end users of your dashboard.
Integration method
Backblaze B2 offers an S3-compatible API endpoint that accepts standard S3 request formats with AWS Signature V4 authentication. You configure a Retool REST API Resource pointing at B2's S3-compatible endpoint for your region, authenticate with your B2 application key credentials formatted as AWS-style access keys, and use standard S3 API paths to list buckets, list objects, and manage files. Retool proxies all requests server-side, keeping credentials secure.
Prerequisites
- A Retool account (Cloud or self-hosted) with permission to add Resources
- A Backblaze account with at least one B2 bucket created
- A B2 application key with Read and/or Write permissions — create in Backblaze Dashboard → App Keys → Add a New Application Key
- Your B2 application key ID and application key value (shown only once at creation time — save it immediately)
- Your B2 bucket's S3-compatible endpoint URL — found in Backblaze Dashboard under your bucket's Endpoint field (format: s3.REGION.backblazeb2.com)
Step-by-step guide
Create a B2 application key and identify your S3-compatible endpoint
Backblaze B2 application keys are the credential type used for API access. Navigate to the Backblaze web console (secure.backblaze.com) and go to App Keys in the left sidebar. Click Add a New Application Key. Configure the application key settings: - Name: 'retool-dashboard' (or a descriptive name) - Allow access to bucket(s): choose 'All' or select specific buckets if you want to restrict Retool to certain buckets only - Type of access: Read and Write (or Read Only if your dashboard is monitoring-only) - File name prefix: leave blank to allow access to all objects, or set a prefix to restrict to specific paths - Duration: leave blank for a non-expiring key, or set a duration in seconds (recommended for tighter security) Click Create New Key. You will see the applicationKeyId and applicationKey displayed together — this is the ONLY time the applicationKey will be visible. Copy both values to a secure location immediately. Next, identify your S3-compatible endpoint URL. Go to the Backblaze Dashboard → Buckets, click on your bucket name, and look for the Endpoint field. The format is s3.REGION.backblazeb2.com where REGION matches your bucket's region (e.g., us-west-004 gives s3.us-west-004.backblazeb2.com). Note this URL — it forms the base URL for your Retool resource. The applicationKeyId maps to the AWS Access Key ID field, and the applicationKey maps to the AWS Secret Access Key field in Retool's AWS Signature V4 authentication.
Pro tip: If you restrict the application key to specific buckets, Retool queries targeting other buckets will return 403 Forbidden. For a multi-bucket dashboard, create an 'All Buckets' application key with Read access, or create separate Retool resources for each bucket-specific key.
Expected result: You have both the applicationKeyId and applicationKey values saved, and you know the S3-compatible endpoint URL for your B2 bucket's region.
Configure the REST API Resource with AWS Signature V4 authentication
Open Retool and navigate to the Resources tab. Click Add Resource and select REST API from the list. Configure the resource: - Name: 'Backblaze B2' - Base URL: https://s3.YOUR_REGION.backblazeb2.com (replace with your actual S3-compatible endpoint URL) Scroll to the Authentication section and select AWS v4 from the dropdown. B2's S3-compatible API uses the same AWS Signature V4 signing process that AWS S3 uses. Fill in the fields: - AWS Region: your B2 bucket region (e.g., us-west-004 — use the region code from your endpoint URL, removing the 's3.' prefix) - AWS Access Key ID: your B2 applicationKeyId (not the application key itself — this is the ID that starts with a numeric prefix) - AWS Secret Access Key: your B2 applicationKey value - AWS Service: s3 Retool will use these credentials to sign requests with AWS Signature V4 — the same algorithm B2 expects for S3-compatible API calls. All requests are signed with the correct Authorization header and x-amz-date header automatically. Add a default header to ensure proper content negotiation: - Header name: Accept - Header value: application/xml B2's S3-compatible API returns XML responses by default (matching S3 behavior). Click Save Changes. Test the connection — a successful test will return a 200 response from B2's S3-compatible endpoint.
Pro tip: The AWS Region field for B2 should match the region identifier in your endpoint URL, not a standard AWS region name. For example, if your endpoint is s3.us-west-004.backblazeb2.com, enter 'us-west-004' as the region — not 'us-west-2'.
Expected result: The Backblaze B2 resource appears in the Resources list. Test Connection returns a successful response from B2's S3-compatible API.
Query bucket listings and build the bucket selector
Create a query to list all accessible B2 buckets. In your Retool app, go to the Code panel and create a new query. Select the Backblaze B2 resource. Configure: - Method: GET - Path: / (root path — this is the ListBuckets operation in S3-compatible API) - No additional headers or parameters needed B2's S3-compatible API returns an XML response for ListBuckets. Add a JavaScript transformer to parse the bucket list from the XML response and format it for display. Retool's query data will contain the raw XML string in the data property. Alternatively, create a query targeting a specific bucket's contents: - Method: GET - Path: /YOUR_BUCKET_NAME (replace with your actual bucket name) - URL parameter: list-type → 2 (enables the ListObjectsV2 format) - URL parameter: max-keys → 100 - URL parameter: prefix → {{ prefixInput.value || '' }} The ListObjectsV2 response includes object key, size, last modified, and ETag for each object. Add a JavaScript transformer to parse the XML and extract the Contents array into clean table rows. Drag a Table component onto the canvas and bind its data to {{ objectsQuery.data }}. Add a Text Input component for prefix filtering — wire it to the prefix URL parameter in the query. Enable 'Run this query automatically when inputs change' so the table updates as users type a prefix filter.
1// Transformer to parse B2 S3-compatible ListObjectsV2 XML response2// B2 returns XML; we parse it manually from the raw response string3// Note: data here is the raw text response from B24const parser = new DOMParser();5const xmlDoc = parser.parseFromString(data, 'application/xml');6const contents = xmlDoc.getElementsByTagName('Contents');7const objects = [];8for (let i = 0; i < contents.length; i++) {9 const item = contents[i];10 const key = item.getElementsByTagName('Key')[0]?.textContent || '';11 const sizeBytes = parseInt(item.getElementsByTagName('Size')[0]?.textContent || '0');12 const lastModified = item.getElementsByTagName('LastModified')[0]?.textContent || '';13 const etag = item.getElementsByTagName('ETag')[0]?.textContent || '';14 const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);15 objects.push({16 key,17 size_bytes: sizeBytes,18 size_display: sizeBytes > 1048576 ? sizeMB + ' MB' : (sizeBytes / 1024).toFixed(1) + ' KB',19 last_modified: lastModified ? new Date(lastModified).toLocaleString() : '',20 etag: etag.replace(/"/g, ''),21 file_type: key.split('.').pop()?.toLowerCase() || ''22 });23}24return objects;Pro tip: B2's ListObjectsV2 response includes an IsTruncated element indicating whether there are more results. Check this field in your transformer and add a 'Load more' button that uses the NextContinuationToken to fetch the next page of results for buckets with more than max-keys objects.
Expected result: The objects query returns a table of files in the specified B2 bucket, with key names, sizes, and last-modified dates. The prefix filter input narrows results in real time.
Add download link generation and object metadata viewing
Add the ability to generate download links for selected objects. B2 provides direct download URLs in the format: https://f002.backblazeb2.com/file/YOUR_BUCKET/YOUR_OBJECT_KEY (for public buckets), or signed download URLs (using the B2 native API's b2_get_download_authorization endpoint) for private buckets. For public bucket download links, create a JavaScript query (not a resource query) that constructs the download URL from the selected row: Create a new query, select 'Run JS Code' as the type: ``` const bucket = 'your-bucket-name'; const key = objectsTable.selectedRow?.key; if (!key) return ''; return `https://f002.backblazeb2.com/file/${bucket}/${encodeURIComponent(key)}`; ``` For object metadata, create a HEAD request query: - Method: HEAD - Path: /YOUR_BUCKET_NAME/{{ objectsTable.selectedRow?.key }} The HEAD response headers contain the object's content-type, content-length, last-modified, and any custom metadata stored as x-amz-meta- headers. Display these in a Container component on the right side of the canvas as a metadata panel. Drag a Button component labeled 'Copy Download URL' and wire its onClick event to copy the generated URL to the clipboard using Retool's built-in clipboard utility. Add a Text component that shows the URL as a clickable link when an object is selected.
1// JavaScript query to build B2 download URL for selected object2// For public buckets — use B2 native download URL format3const bucket = 'your-bucket-name'; // replace with your actual bucket name4const region = 'us-west-004'; // replace with your bucket region5const key = objectsTable.selectedRow?.key;6if (!key) {7 return { url: '', display: 'Select an object to generate a download URL' };8}9// B2 S3-compatible download URL format10const encodedKey = key.split('/').map(encodeURIComponent).join('/');11const downloadUrl = `https://s3.${region}.backblazeb2.com/${bucket}/${encodedKey}`;12return { url: downloadUrl, display: downloadUrl };Pro tip: For private B2 buckets, download links require an authorization token from Backblaze's native B2 API (b2_get_download_authorization). Consider creating a second Retool resource pointing at the B2 native API (api.backblazeb2.com) alongside the S3-compatible resource for operations that require B2-specific features.
Expected result: Selecting an object row in the table generates a download URL displayed in a text field. Clicking 'Copy Download URL' copies the URL to the clipboard. The metadata panel shows content-type, size, and modification date for the selected object.
Add a storage usage summary and connect multiple buckets
Build a storage summary view by aggregating object counts and sizes across buckets. Since B2's S3-compatible API requires per-bucket queries (there is no cross-bucket aggregate endpoint), create separate queries for each bucket you want to monitor, or use a dynamic approach with a bucket list. Create a JavaScript query that reads from multiple bucket queries and computes totals: - Total objects across all buckets - Total storage in GB - Largest bucket by object count - Estimated monthly cost at B2's $0.006/GB/month pricing For bucket selection, populate a Select component with a static list of your bucket names (or from the ListBuckets query). Create a single objects query parameterized by the selected bucket name: path /{{ bucketSelect.value }}. This one query handles all buckets by switching the path based on the selected bucket. Add a Chart component showing storage distribution: a Bar Chart where each bar represents a bucket and the height shows total storage in GB. Populate this chart from a Transformer that combines data from each per-bucket query. For Retool Cloud deployments: add a text note to the overview panel reminding operators to whitelist Retool's IP ranges in any B2 bucket firewall rules if bucket access restrictions are configured. Self-hosted Retool deployments use their own egress IPs, which may need to be added to B2 IP allow lists as well.
1// Summary transformer — aggregate object counts and sizes from objectsQuery2// Run after the main objects query, reads from objectsQuery.data3const objects = objectsQuery.data || [];4const totalObjects = objects.length;5const totalBytes = objects.reduce((sum, obj) => sum + (obj.size_bytes || 0), 0);6const totalGB = totalBytes / (1024 * 1024 * 1024);7const estimatedMonthlyCost = totalGB * 0.006; // B2 pricing: $0.006/GB/month8return {9 total_objects: totalObjects.toLocaleString(),10 total_size_gb: totalGB.toFixed(3) + ' GB',11 total_size_tb: (totalGB / 1024).toFixed(6) + ' TB',12 estimated_monthly_cost: '$' + estimatedMonthlyCost.toFixed(4),13 largest_file: objects.reduce((max, obj) => obj.size_bytes > (max?.size_bytes || 0) ? obj : max, null)?.key || 'N/A'14};Pro tip: B2's free download allowance (3x stored data per day as of 2024) makes it cost-effective for media workflows, but track your daily download volume if your Retool dashboard generates many download link requests for large files.
Expected result: A summary panel shows total object count, total storage size, and estimated monthly cost for the selected bucket. Switching buckets in the selector updates all metrics. A bar chart shows storage distribution for quick comparison.
Common use cases
Build a bucket inventory and object browser
Create a Retool panel where operations teams can list all B2 buckets, select a bucket to browse its contents, and view object metadata including size, last modified date, and content type. Add a search input to filter objects by prefix or filename pattern, and pagination controls for buckets with thousands of objects.
Build a B2 storage browser with a bucket selector dropdown populated from the ListBuckets API call. When a bucket is selected, display its objects in a table with columns for object key, size (formatted in KB/MB/GB), last modified date, and storage class. Add a text input to filter objects by prefix, a pagination selector for page size (100/500/1000 objects), and a Generate Download Link button that creates a pre-signed URL for the selected object.
Copy this prompt to try it in Retool
Build a storage usage monitoring dashboard
Create a Retool dashboard that aggregates storage usage across all B2 buckets, displaying total bytes stored, object counts, and per-bucket breakdown. Use Chart components to visualize storage growth over time by comparing object counts from historical snapshots stored in an internal database. Add alerts for buckets exceeding storage thresholds.
Create a storage monitoring panel that lists all buckets with their object count and total storage size. Use a Bar Chart to show storage distribution across buckets. Add a date-range selector to compare current storage against historical snapshots from the internal storage_snapshots table. Display a summary card showing total B2 storage cost estimate based on $0.006/GB pricing and the total bytes stored.
Copy this prompt to try it in Retool
Build a media asset management panel for B2-hosted files
Create a Retool asset management tool for teams storing images, videos, or documents in B2. Display objects with thumbnail previews for image files (using B2's CDN or friendly URLs), metadata tags, and download links. Add a tagging system that stores asset metadata in an internal database and cross-references B2 object keys.
Build a media asset browser connected to a specific B2 bucket used for image storage. Display objects in a grid view with object key, size, content type, and a preview URL for image files. Add a metadata panel when an asset is selected showing all S3-compatible object tags. Include a Copy Download URL button that generates the direct B2 download URL for sharing.
Copy this prompt to try it in Retool
Troubleshooting
Query returns 403 Forbidden when listing objects or buckets
Cause: The application key was created with restricted bucket access, or the application key does not have the listBuckets or listFiles capability required for the operation.
Solution: Go to Backblaze Dashboard → App Keys and check the capabilities assigned to your application key. For a full-access dashboard, ensure the key has at minimum: listBuckets, listFiles, readFiles capabilities. If the key was restricted to specific buckets, verify the bucket name in your query path matches the exact bucket name the key was restricted to. Create a new key with broader permissions if needed.
Signature mismatch error or 400 Bad Request when configuring the resource
Cause: The AWS region field in Retool's AWS v4 authentication does not exactly match B2's expected region identifier, or the Service field is not set to 's3'.
Solution: The region field must match the region code in your B2 endpoint URL exactly. For example, if your endpoint is s3.us-west-004.backblazeb2.com, the region must be 'us-west-004' — not 'us-west-2' or 'us-west'. The Service field must be exactly 's3' (lowercase). Verify the applicationKeyId is in the AWS Access Key ID field and the applicationKey is in the AWS Secret Access Key field — these are commonly swapped.
XML parse error in transformer or data property returns raw XML string
Cause: B2's S3-compatible API returns XML responses, but Retool may not automatically parse XML into a JavaScript object the way it does with JSON responses.
Solution: Use DOMParser in your transformer to parse the raw XML string manually, as shown in the objects transformer example. If data is undefined, check the query's Raw Response tab in Retool's query editor to see the actual response format. Some B2 responses may return as text — access the raw text via format.rawBody or data if the content-type is text/xml.
1// Handle raw XML in transformer2const raw = typeof data === 'string' ? data : JSON.stringify(data);3const parser = new DOMParser();4const xmlDoc = parser.parseFromString(raw, 'application/xml');5// Then extract elements as shown in the objects transformerDownload URLs return 401 or 403 when opened in a browser
Cause: The bucket is set to private (not public) in B2's bucket settings, so direct download URLs require authorization tokens.
Solution: For private buckets, generate authorized download URLs by calling B2's native API (not the S3-compatible API): POST to b2_get_download_authorization with the bucket ID, file name prefix, and token duration. Create a second Retool REST API Resource targeting api.backblazeb2.com with Basic Auth using accountId:applicationKey. Alternatively, change the bucket's visibility to 'Public' in Backblaze Dashboard → Buckets if your content is suitable for public access.
Best practices
- Create B2 application keys with the minimum required capabilities for your dashboard — read-only keys (listBuckets, listFiles, readFiles) for monitoring dashboards, add writeFiles/deleteFiles only if your panel includes upload or delete operations
- Store your B2 applicationKeyId and applicationKey as secret configuration variables in Retool Settings → Configuration Variables — never hardcode them in query parameters or headers
- Use prefix-based object filtering in ListObjectsV2 queries to limit response sizes for large buckets — always provide a sensible default prefix or max-keys limit rather than loading all objects at once
- Implement client-side pagination with B2's continuation tokens (NextContinuationToken) for buckets containing more than a few thousand objects to avoid slow query responses
- For Retool Cloud, ensure Retool's IP ranges are not blocked by any B2 bucket firewall or allowed IP rules you may have configured in Backblaze's bucket settings
- Use a bucket-per-environment strategy: create separate B2 buckets for production and development data, and configure separate Retool resources or resource environments for each to prevent accidental operations on production data
- Cache ListBuckets and ListObjectsV2 queries with a short cache duration (30-60 seconds) to reduce B2 API calls when team members navigate the dashboard frequently
Alternatives
AWS S3 has a native Retool connector with a dedicated S3 Uploader component and operation dropdowns, making setup faster than the manual S3-compatible API configuration required for B2.
Backblaze's native B2 API (not S3-compatible) offers more B2-specific features like lifecycle rules and server-side encryption configuration at the cost of a more complex multi-step authentication flow.
Dropbox uses OAuth 2.0 and has a more developer-friendly JSON API, making it easier to integrate with Retool for team file sharing workflows where S3-compatible storage isn't required.
Frequently asked questions
Is Backblaze B2's S3-compatible API fully compatible with S3 query patterns used in Retool?
B2's S3-compatible API covers the most common S3 operations: ListBuckets, ListObjectsV2, GetObject, PutObject, DeleteObject, and HeadObject. It does not support all advanced S3 features like S3 Transfer Acceleration, S3 Select (SQL queries on objects), or all S3 ACL types. For a Retool dashboard focused on browsing and monitoring, the supported operations are sufficient.
Can I upload files to B2 directly from a Retool form?
Retool supports file uploads through its File Input and S3 Uploader components, but the native S3 Uploader only works with AWS S3, not B2. To upload files to B2 from Retool, create a POST/PUT query targeting the B2 S3-compatible endpoint with the file content from a Retool File Input component. The uploaded file's binary content is accessible via fileInput.value[0].base64Data. Note that large file uploads may be better handled by a separate upload service rather than through Retool's query layer.
Does Retool's server-side proxying work correctly with B2's S3-compatible endpoint?
Yes. Retool proxies all REST API Resource queries through its backend, which means CORS is not an issue — B2's S3-compatible API is called from Retool's server, not from the user's browser. The AWS Signature V4 signing also happens server-side in Retool's backend, so your B2 credentials never appear in browser network traffic. This is one of the key security advantages of using Retool Resource Queries over direct fetch() calls in JavaScript queries.
What is the difference between connecting via the S3-compatible API versus B2's native API?
B2's S3-compatible API supports the same operations as AWS S3 using familiar request formats and AWS Signature V4 auth — ideal if you already know S3 patterns or are migrating from S3. B2's native API (b2_authorize_account, b2_list_buckets, etc.) offers additional B2-specific features like server-side encryption configuration, lifecycle rules, and download authorization tokens. The S3-compatible API is simpler to set up in Retool; the native API requires a two-step authentication flow but unlocks more advanced features.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation