# put\_\_bucket\_{bucketId}

`PUT /bucket/{bucketId}`

*Update Bucket*

Update the configuration of an existing storage bucket. This endpoint allows you to modify bucket properties such as name, credentials, region, and endpoint settings.

**Note:** This endpoint respects workspace access controls. Users can only update buckets within their accessible workspaces. When updating credentials or storage configuration, the system will automatically trigger repository update events for affected storage repositories.

#### TypeScript Client Library

```typescript
public updateStorageBucket = async (bucketId: string, data: UpdateBucketRequest): Promise<UpdateBucketResponse> => {
  return this.makeRequest<UpdateBucketResponse>(`bucket/${bucketId}`, 'PUT', data);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X PUT https://backend.flashback.tech/bucket/{bucketId} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
PUT https://backend.flashback.tech/bucket/{bucketId} HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: application/json
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const inputBody = '{
  "name": "Updated Backup Bucket",
  "region": "us-west-2",
  "endpoint": "https://s3.us-west-2.amazonaws.com"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/bucket/{bucketId}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.put 'https://backend.flashback.tech/bucket/{bucketId}',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.put('https://backend.flashback.tech/bucket/{bucketId}', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/bucket/{bucketId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://backend.flashback.tech/bucket/{bucketId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#put__bucket_-bucketid-parameters" id="put__bucket_-bucketid-parameters"></a>

| Name     | In   | Type   | Required | Description                     |
| -------- | ---- | ------ | -------- | ------------------------------- |
| bucketId | path | string | true     | Unique identifier of the bucket |
| body     | body | object | true     | Updated bucket configuration    |

> Body parameter

```json
{
  "name": "Updated Backup Bucket",
  "storageType": "S3",
  "bucket": "my-updated-bucket",
  "key": "AKIAIOSFODNN7EXAMPLE",
  "secret": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
  "region": "us-west-2",
  "endpoint": "https://s3.us-west-2.amazonaws.com",
  "workspaceId": "workspace-123"
}
```

#### Parameters <a href="#put__bucket_-bucketid-parameters" id="put__bucket_-bucketid-parameters"></a>

| Name          | In   | Type   | Required | Description                                    |
| ------------- | ---- | ------ | -------- | ---------------------------------------------- |
| body          | body | object | true     | none                                           |
| » name        | body | string | false    | Human-readable name for the bucket             |
| » storageType | body | string | false    | Cloud storage provider type                    |
| » bucket      | body | string | false    | Actual bucket name in cloud storage            |
| » key         | body | string | false    | Access key for the storage provider            |
| » secret      | body | string | false    | Secret key for the storage provider            |
| » region      | body | string | false    | Storage region (e.g., us-west-2, eu-west-1)    |
| » endpoint    | body | string | false    | Custom endpoint URL for S3-compatible services |
| » workspaceId | body | string | false    | Workspace ID the bucket belongs to             |

**Enumerated Values**

| Parameter     | Value |
| ------------- | ----- |
| » storageType | S3    |
| » storageType | GCS   |
| » storageType | BLOB  |

> Example responses

> 200 Response

```json
{
  "success": true,
  "bucketId": "550e8400-e29b-41d4-a716-446655440000"
}
```

#### Responses <a href="#put__bucket_-bucketid-responses" id="put__bucket_-bucketid-responses"></a>

| Status | Meaning                                                                    | Description                 | Schema |
| ------ | -------------------------------------------------------------------------- | --------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Bucket updated successfully | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | Validation error            | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)             | Insufficient permissions    | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)             | Bucket or user not found    | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Failed to update bucket     | Inline |

#### Response Schema <a href="#put__bucket_-bucketid-responseschema" id="put__bucket_-bucketid-responseschema"></a>

Status Code **200**

| Name       | Type    | Required | Restrictions | Description                              |
| ---------- | ------- | -------- | ------------ | ---------------------------------------- |
| » success  | boolean | false    | none         | Operation success status                 |
| » bucketId | string  | false    | none         | Unique identifier for the updated bucket |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/storage-apis/bucket-management/put__bucket_-bucketid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
