# BackBlaze(b2) integration

Backblaze supports external integration through an HTTP-based REST API ([Documentation Link](https://www.backblaze.com/apidocs/introduction-to-api-documentation)).

---

#### 1. Access through B2 REST API

See the [B2 Native API Documentation](https://www.backblaze.com/apidocs/introduction-to-the-b2-native-api)

---

**⚠️ General restrictions**: Backblaze Storage is not a traditional file system but an object storage service. What appears to be a **folder** is actually just a prefix in the object’s name. As a result, renaming folders is not supported. To **move** a folder, you must copy all the objects to the new location and then delete them from the original one.\
B2 REST API does not support resumes on upload and MDTM(File modification time) changes. You can use the **S3 connection endpoint** as a workaround. [2. Access Through S3 REST API Link](BackBlaze-b2-integration.md#section-BackBlaze_28b2_29+integration-2.AccessThroughS3RESTAPI)

---

**⚠️ Proxy Configuration:** If your server accesses the internet through a proxy, make sure to whitelist the following domains for Backblaze Authentication and Drive access: **api.backblazeb2.com**

---

Create **App Keys** on Backblaze:\
**1.)** Go to the **Backblaze** website: [Link](https://www.backblaze.com/)\
**2.)** Log in to your **Backblaze B2 Cloud Storage account**.\
**3.)** Navigate to the Buckets section (under **B2 Cloud Storage**).\
**4.)** Click on **App Keys** in the left-hand menu.\
**5.)** Click **Add a New Application Key**.\
**6.)** Configure the key:\
• Name your key.\
• Set permissions (read/write).\
• (Optional) Restrict the key to a specific bucket or folder.\
**7.)** Click **Create New Key**.\
**8.)** Copy and securely store the **Key ID** and **Application Key**. ⚠️ The Application Key is shown only once after creation.

![B2 app key](BackBlaze-b2-integration/b2_app_key.png)

Use the **KeyId** as **User name** and the **Application Key** as **Password**. Also, make sure to provide the corresponding **Bucket Name** for access.

![B2 reg result](BackBlaze-b2-integration/b2_reg_result.png)

The URL pattern looks like this:

```
b2://<<KeyId>>:<<applicationKey>>@api.backblazeb2.com/<<Bucket Name>>/
```

![B2 vfs settings](BackBlaze-b2-integration/b2_vfs_settings.png)

---

#### 2. Access through S3 REST API

See the [BackBlaze S3-Compatible API Documentation](https://www.backblaze.com/docs/cloud-storage-s3-compatible-api)

Create **App Keys** on Backblaze with **S3 Permissions**:\
**1.)** Go to [BlackBlaze Link](https://www.backblaze.com/) and sign in to your **Backblaze B2 Cloud Storage** account.\
**2.)** In the left-hand menu, go to **Buckets**, then click on **App Keys**.\
**3.)** Click **Add a New Application Key**.\
**4.)** In the key creation form:\
• Name your key.\
• Under Type of Access, select the appropriate permissions (e.g., read-only or read/write).\
• ⚠️ Important: Enable the option for S3 Compatible API access by checking the “Allow access to S3-compatible API” checkbox.\
• Optionally, restrict access to a specific bucket.\
**5.** Click **Create New Key**.\
**6.** Copy and securely store both the **Key ID** and **Application Key**. ⚠️ The Application Key is shown only once after creation.

![B2 application key s3 allow](BackBlaze-b2-integration/b2_application_key_s3_allow.png)

Open the bucket settings and use the **S3 Endpoint URL** for S3 connection.

![B2 s3 endpoint](BackBlaze-b2-integration/b2_s3_endpoint.png)

Use the **KeyId** as **User name** and the **Application Key** as **Password**. Also, make sure to provide the corresponding **Bucket Name** for access.\
The **URL Pattern** looks like this (use the **S3 Endpoint URL**):

```
s3://<<KeyId>>:<<applicationKey>>@s3.us-west-000.backblazeb2.com//<<Bucket Name>>/
```

---

**⚠️ Proxy Configuration:** If your server accesses the internet through a proxy, make sure to whitelist the following domains for Backblaze Authentication and Drive access: **s3.us-west-000.backblazeb2.com**

---

Required flags:\
**SHA256 enabled on signing (Signing Version 4)** and **Include SHA256 to request headers (Signing Version 4 related)** flags must be checked.

![B2 s3 vfs settings](BackBlaze-b2-integration/b2_s3_vfs_settings.png)

More info about s3 VFS configuration: [S3 integration](S3-integration.md)
