What’s the Diff: Backblaze S3 Compatible API vs. B2 Native API

Developers use Backblaze B2 Cloud Storage to store and use data in the cloud for workloads such as video streaming and gaming. Those files are always available for download either through a browser-compatible URL or APIs.

Backblaze supports two different suites of APIs—the Backblaze B2 Native API and the Backblaze S3 Compatible API. Sometimes, folks come to our platform knowing exactly which API they need to use, but the differences between the two are not always immediately apparent. If you’re not sure which API is best for you and your project, we’re explaining the difference today.

Editor’s note: Technical Documentation Portal

In July 2023, Backblaze announced our new Technical Documentation Portal, designed to make the technical how-tos of Backblaze easy to use, easy to understand, and easy to share. If you’re looking for quickstart guides, SDKs, integrations, API documentation, or other technical support, head on over to the portal for more. If you want to learn more about Backblaze’s APIs in general, read on.

B2 Native API vs. S3 Compatible API: What’s the diff?

Put simply, an API is a set of protocols that lets one application or service talk to another. They typically include a list of operations or calls developers can use to interact with said application (inputs) and a description of what happens when those calls are used (outputs). Both the B2 Native and S3 Compatible APIs handle the same basic functions:

  • Authentication: Providing account/bucket/file access
  • Bucket Management: Creating and managing the buckets that hold files
  • Upload: Sending files to the cloud
  • Download: Retrieving files from the cloud
  • List: Data checking/selection/comparison

The main difference between the two APIs is that they use different syntax for the various calls. We’ll dig into other key differences in more detail below.

The Backblaze B2 Native API

The B2 Native API is Backblaze’s custom API that enables you to interact with Backblaze B2 Cloud Storage. We’ve written in detail about why we developed our own custom API instead of just implementing an S3 compatible interface from the beginning. In a nutshell, we developed it so our customers could easily interact with our cloud while enabling Backblaze to offer affordable cloud storage.

To get started, simply create a Backblaze account and enable Backblaze B2. You’ll then get access to your Application Key and Application Key ID. These let you call the B2 Native API.

The Backblaze S3 Compatible API

Over the years since we launched Backblaze B2 and the B2 Native API, S3 compatibility was one of our most requested features. When S3 launched in 2006, it solved a persistent problem for developers—provisioning and maintaining storage hardware. Prior to S3, developers had to estimate how much storage hardware they would need for their applications very accurately or risk crashes from having too little or, on the flip side, paying too much as a result of over-provisioning storage for their needs. S3 gave them unlimited, scalable storage that eliminated the need to provision and buy hardware. For developers, the service was a game-changer, and in the years that followed, the S3 API essentially became industry standard for object storage.

In those years as well, other brands (That’s us!) entered the market. AWS was no longer the only game in town. Many customers wanted to move from Amazon S3 to Backblaze B2, but didn’t want to rewrite code that already worked with the S3 API.

The Backblaze S3 Compatible API does the same thing as the B2 Native API—it allows you to interact with B2 Cloud Storage—but it follows the S3 syntax. With the S3 Compatible API, if your application is already written to use the S3 API, B2 Cloud Storage works with minimal code changes on your end, because the API implements the most commonly used S3 actions. The launch of the S3 Compatible API provides developers with a number of benefits:

  • You don’t have to learn a new API.
  • You can use your existing tools that are written to the S3 API.
  • Performance will be just as good and you’ll get all the benefits of B2 Cloud Storage.

To get started, sign in to your Backblaze account and select Application Keys. The Master Application Key will not work with the S3 Compatible API, so you’ll want to create a new key and key ID by selecting Add a New Application Key. Your new key and key ID will work with both the B2 Native API and S3 Compatible API. Just plug this information into your application to connect it to Backblaze B2.

Find the App Keys page in your Backblaze account to create your S3 compatible key and key ID.

If your existing tools are written to the S3 API—for example, tools like Cohesity, rclone, and Veeam—they’ll work automatically once you enter this information. Additionally, many tools—like Arq, Synology, and MSP360—were already integrated with Backblaze B2 via the B2 Native API, but now customers can choose to connect with them via either API suite.

B2 Native and S3 Compatible APIs: How do they compare?

Beyond the syntax, there are a few key differences between the B2 Native and Backblaze S3 Compatible APIs, including:

  • Key management
  • SDKs
  • Pre-signed URLs
  • File uploads
  • S3 features the S3 Compatible API doesn’t support

Key management

Key management is unique to the B2 Native API. The S3 Compatible API does not support key management. With key management, you can create, delete, and list keys using the following calls:

  • b2_create_key
  • b2_delete_key
  • b2_list_keys

To authenticate with the S3 Compatible API, you use an application key you’ve already created in the Backblaze web console or with b2_create_key. Your application key ID serves as the S3 access key, and your application key serves as the secret key. If you restrict a key to a single bucket, enable the listAllBucketNames capability so S3 compatible SDKs and integrations can list buckets.

SDKs

Some of our alliance partners asked us if we had an SDK they could use. To answer that request, we developed an official Java SDK and Python SDK on GitHub so you can manage and configure your cloud resources via the B2 Native API.

Meanwhile, you can use the long-standing, open source AWS SDKs with the S3 Compatible API in languages including Go, PHP, JavaScript, Ruby, Java, .NET, and Python. These SDKs make it easy to integrate your application no matter what language it’s written in.

Pre-signed URLs

By default, access to private buckets is restricted to the account owner. If you want to grant access to a specific object in that bucket to anyone else—for example, a user or a different application or service—they need proper authorization. The S3 Compatible API and the B2 Native API handle access to private buckets differently.

The S3 Compatible API handles authorization using pre-signed URLs. It requires the user to calculate a signature (code that says you are who you say you are) before sending the request. Using the URL, a user can either read an object, write an object, or update an existing object. The URL also contains specific parameters like limitations or expiration dates to manage their usage.

The S3 Compatible API supports pre-signed URLs for downloading and uploading. Pre-signed URLs are built into AWS SDKs. They can also be generated in a number of other ways, including the AWS CLI, AWS Tools for PowerShell, and s3cmd. The S3 Compatible API documentation links to guides for configuring those tools. Note that browser-based uploads to pre-signed URLs using POST are not supported. Many integrations, for example, Cyberduck, also offer a simple share functionality that makes providing temporary access possible utilizing the underlying pre-signed URL.

The B2 Native API figures out the signature for you. Instead of a pre-signed URL, the B2 Native API requires an authorization token to be part of the API request itself. The b2_authorize_account request gets the authorization token that you can then use for account-level operations. If you only want to authorize downloads instead of all account-level operations, you can use the request b2_get_download_authorization to generate an authorization token, which can then be used in the URL to authenticate the request.

Uploading files

With the S3 Compatible API, you upload files to a static URL that never changes. Our servers automatically pick the best route for you that delivers the best possible performance on our backend.

The B2 Native API requires a separate call to get an upload URL. This URL can be used until it goes stale (i.e. returns a 50X error), at which point another upload URL must be requested. In the event of a 50X error, you simply need to retry the request with the new URL. The S3 Compatible API does this for you in the background on our servers, which makes the experience of using the S3 Compatible API smoother.

This difference in the upload process is what enabled Backblaze B2 to offer affordable pricing at the expense of a little bit more complexity.

S3 features the S3 Compatible API doesn’t support

The S3 Compatible API implements the most commonly used S3 actions, not every AWS operation. Before you point an existing S3 application at Backblaze B2, check whether it depends on any of the following:

  • Object-level ACLs: ACLs are set at the bucket level, only the canned “private” and “public-read” values are supported, and objects inherit their bucket’s ACL
  • IAM roles
  • Object tagging: Get Object Tagging returns an empty tag set for compatibility with certain integrations
  • Website configuration
  • Browser-based uploads to pre-signed URLs using POST
  • SSE-KMS encryption: server-side encryption is supported with Backblaze-managed keys (SSE-B2) or customer-managed keys (SSE-C)
  • v2 signatures: authentication requires v4 signatures

A few behaviors also differ from Amazon S3. Endpoints are located at backblazeb2.com, connections must use HTTPS, buckets are versioned by default, and each account is currently associated with a single region. The S3 Compatible API reference documents every supported operation.

Try it out for yourself

So, which API should you use? In a nutshell, if your app is already written to work with S3, if you’re using tools that are written to S3, or if you’re just unsure, the S3 Compatible API is a good choice. Just confirm that your application doesn’t rely on one of the unsupported features listed above. If you’re looking for more control over access and key management, the B2 Native API is the way to go. Either way, now that you understand the differences between the two APIs you can use to work with B2 Cloud Storage, you can align your use cases to the functionality that best suits them and get started with the API that works best for you.

If you’re ready to try out the B2 Native or S3 Compatible APIs for yourself, check out our documentation:

Of course, if you have any questions, fire away in the comments or reach out to our Sales team. And if you’re interested in trying Backblaze B2, get started today.

Frequently asked questions

Can I use the master application key with the Backblaze S3 Compatible API?

No. The master application key that Backblaze creates automatically is not supported by the S3 Compatible API. Create a separate application key in the Backblaze web console or with the B2 Native API b2_create_key call, then use the key ID as your S3 access key and the application key as your secret key.

What S3 features does the Backblaze S3 Compatible API not support?

The S3 Compatible API does not currently support object-level ACLs, IAM roles, object tagging, website configuration, or browser-based uploads to pre-signed URLs using POST. ACLs apply at the bucket level and accept only “private” or “public-read.” SSE-KMS encryption and v2 signatures are also unsupported, so check your application’s dependencies before migrating.

What server-side encryption options does the Backblaze S3 Compatible API support?

The S3 Compatible API supports server-side encryption with Backblaze-managed keys (SSE-B2) or customer-managed keys (SSE-C). SSE-KMS is not currently supported. If you use SSE-C, you must retain and protect your own keys. You can also set SSE-B2 as a bucket default for files uploaded or copied into that bucket afterward.

Can the same application key work with both the B2 Native API and the S3 Compatible API?

Yes. An application key you create—rather than the master application key—works with both the B2 Native API and the S3 Compatible API. Its capabilities still apply. For example, if you restrict a key to one bucket, enable the listAllBucketNames capability so S3 List Buckets and many S3 compatible tools work as expected.

Molly Clancy

About Molly Clancy

Molly Clancy is a content writer who specializes in explaining tech concepts in an easy, approachable way. With more than 15 years of experience, she has a broad background in industries ranging from B2B tech to engineering to luxury travel. A deep curiosity drives her repeated success explaining what terms like OS kernel and preflight request mean so that anyone can understand them.