Added support for BackBlaze B2 Application Keys

Hey, I thought it’d be nice to let you know: I’ve just merged a PR which updates the library we’re using for accessing BackBlaze B2 ( so that restic now supports “Application Keys”. Before, you could just have one set of credentials for accessing B2, which could not be restricted. With Application Keys, you can now create several credentials with different access privileges, e.g. you can restrict an application key to a specific bucket and/or path.

Let us know what you think!


I was just trying to use application keys and, as it did not seem to work, I searched the internet and found that this feature has been added (what a coincidence). Nevertheless, I have downloaded and compiled the latest version from github but I did not succeed.

What I have done is to use an application key with read and write access to a bucket (only for one bucket) as value for the B2_ACCOUNT_KEY variable but I have only managed to get this error:

b2.NewClient: b2_authorize_account: 401: Invalid authorization

I have double checked the key is correct and even deleted it and created a new one to be sure they key was correct. When I change the value of the B2_ACCOUNT_KEY to the master key everything works as expected.

Am I missing something or did I found a bug ?

An application key consists of a B2_ACCOUNT_ID (which is longer than the master account ID) and a B2_ACCOUNT_KEY. Only setting the latter won’t get you access to your data :wink:

Did you set both?

1 Like

I did set both


works, but


does not work

OK, my fault. I am a bit ashamed now

Although your reply was very clear I misread it and did not notice the B2_ACCOUNT_ID to be used was different and not the master one.

It is working perfectly and I want to thank you for adding this feature. It came right on time for me.

1 Like

Cool, glad you figured it out! It seems to be a common thing, maybe Backblaze should improve their user interface…

I’ve added a bit of text about the application keys here:

1 Like

Great. Now the restic documentation explains the procedure in a very clear way.

I am really not impressed by the related documentation provided by Backblaze. Despite of taking some time to understand how app keys work i got it wrong.

Thank you for your prompt replies

1 Like

Now it is in the documentation, could it also be in a 0.9.2 release? Even if only to add this B2 feature?

Yep, as soon as I have some spare time I’ll do a new release :slight_smile:



Amazing :smiley: Thanks so much!

I just messed up on that one and got confused. I set the B2_ACCOUNT_ID to the master account ID. :(.

A post was split to a new topic: B2 Application Key not working