> For the complete documentation index, see [llms.txt](https://docs.flashback.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flashback.tech/support-reference/platform-api-reference/repo-management/put__repo_repoid.md).

# put\_\_repo\_{repoId}

`PUT /repo/{repoId}`

*Update Repository*

Update an existing storage repository

#### TypeScript Client Library

```typescript
// Function overloads for updateStorageRepo
public updateStorageRepo(repoId: string, data: UpdateRepoRequest): Promise<UpdateRepoResponse>;
public updateStorageRepo(repoId: string, data: UpdateRepoWithBucketsRequest): Promise<UpdateRepoResponse>;
public async updateStorageRepo(
  repoId: string,
  data: UpdateRepoRequest | UpdateRepoWithBucketsRequest
): Promise<UpdateRepoResponse> {
  return this.makeRequest<UpdateRepoResponse>(`repo/${repoId}`, 'PUT', data);
}
```

#### Code Samples

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

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

{% endtab %}

{% tab title="HTTP" %}

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const inputBody = '{
  "name": "My Updated Repository",
  "storageType": "S3",
  "mode": "MIRROR",
  "repoBuckets": [
    {
      "folder": "backups",
      "master": true,
      "bucketId": "123e4567-e89b-12d3-a456-426614174000",

    }
  ],
  "repoAiLlms": [
    {
      "aiLlmId": "ai-llm-123"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/repo/{repoId}',
{
  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/repo/{repoId}',
  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/repo/{repoId}', 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}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://backend.flashback.tech/repo/{repoId}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/repo/{repoId}");
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/repo/{repoId}", data)
    req.Header = headers

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

{% endtab %}
{% endtabs %}

> Body parameter

```json
{
  "name": "My Updated Repository",
  "storageType": "S3",
  "mode": "MIRROR",
  "repoBuckets": [
    {
      "folder": "backups",
      "master": true,
      "bucketId": "123e4567-e89b-12d3-a456-426614174000",
      "bucket": {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "name": "My Backup Bucket",
        "bucket": "my-backup-bucket-2024",
        "storageType": "S3",
        "key": "AKIAIOSFODNN7EXAMPLE",
        "secret": {
          "key": "encrypted-secret-key",
          "iv": "initialization-vector",
          "authTag": "authentication-tag",
          "message": "encrypted-message"
        },
        "endpoint": "https://s3.amazonaws.com",
        "region": "us-east-1",
        "status": "ACTIVE",
        "projectId": "my-project-123",
        "createdAt": "2024-01-15T09:00:00Z"
      }
    }
  ],
  "repoAiLlms": [
    {
      "aiLlmId": "ai-llm-123"
    }
  ]
}
```

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

| Name            | In   | Type      | Required | Description                                                       |
| --------------- | ---- | --------- | -------- | ----------------------------------------------------------------- |
| repoId          | path | string    | true     | Repository ID to update                                           |
| body            | body | object    | true     | Repository update data                                            |
| » name          | body | string    | true     | Repository name                                                   |
| » storageType   | body | string    | true     | Storage provider type                                             |
| » mode          | body | string    | true     | Repository mode                                                   |
| » repoBuckets   | body | \[object] | true     | Repository bucket configuration                                   |
| »» folder       | body | string    | false    | Folder path within the bucket                                     |
| »» master       | body | boolean   | false    | Whether this is the master bucket                                 |
| »» bucketId     | body | string    | false    | Bucket identifier                                                 |
| »» bucket       | body | object    | false    | Storage bucket details                                            |
| »»» id          | body | string    | false    | Bucket identifier                                                 |
| »»» name        | body | string    | false    | Bucket name                                                       |
| »»» bucket      | body | string    | false    | Actual bucket name in cloud storage                               |
| »»» storageType | body | string    | false    | Storage provider type                                             |
| »»» key         | body | string    | false    | Access key for the storage provider                               |
| »»» secret      | body | object    | false    | Encrypted secret key information                                  |
| »»»» key        | body | string    | false    | Encrypted key data                                                |
| »»»» iv         | body | string    | false    | Initialization vector                                             |
| »»»» authTag    | body | string    | false    | Authentication tag                                                |
| »»»» message    | body | string    | false    | Encrypted message                                                 |
| »»» endpoint    | body | string    | false    | Custom endpoint URL                                               |
| »»» region      | body | string    | false    | Storage region                                                    |
| »»» status      | body | string    | false    | Bucket status                                                     |
| »»» projectId   | body | string    | false    | Project identifier (for GCS)                                      |
| »»» createdAt   | body | string    | false    | Creation timestamp for the bucket                                 |
| » repoAiLlms    | body | \[object] | false    | Array of AI LLM associations for the repository                   |
| »» aiLlmId      | body | string    | false    | Unique identifier for the AI LLM to associate with the repository |

**Enumerated Values**

| Parameter     | Value  |
| ------------- | ------ |
| » storageType | S3     |
| » storageType | GCS    |
| » storageType | AZURE  |
| » mode        | MIRROR |
| » mode        | BACKUP |

> Example responses

> 200 Response

```json
{
  "success": true,
  "repo": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "My Updated Repository",
    "storageType": "S3",
    "mode": "MIRROR",
    "createdAt": "2024-01-15T10:00:00Z",
    "updatedAt": "2024-01-15T11:00:00Z"
  }
}
```

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

| Status | Meaning                                                          | Description                     | Schema |
| ------ | ---------------------------------------------------------------- | ------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)          | Repository updated successfully | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Validation error                | Inline |
| 404    | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)   | Repository not found            | Inline |

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

Status Code **200**

| Name           | Type    | Required | Restrictions | Description                             |
| -------------- | ------- | -------- | ------------ | --------------------------------------- |
| » success      | boolean | false    | none         | Indicates if the request was successful |
| » repo         | object  | false    | none         | Updated repository information          |
| »» id          | string  | false    | none         | Repository identifier                   |
| »» name        | string  | false    | none         | Repository name                         |
| »» storageType | string  | false    | none         | Storage provider type                   |
| »» mode        | string  | false    | none         | Repository mode                         |
| »» createdAt   | string  | false    | none         | Creation timestamp                      |
| »» updatedAt   | string  | false    | none         | Last update timestamp                   |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description                             |
| --------- | ------- | -------- | ------------ | --------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful |
| » message | string  | false    | none         | Error message                           |

Status Code **404**

| Name      | Type    | Required | Restrictions | Description                             |
| --------- | ------- | -------- | ------------ | --------------------------------------- |
| » success | boolean | false    | none         | Indicates if the request was successful |
| » message | string  | false    | none         | Error message                           |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/repo-management/put__repo_repoid.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
