# Update Storage Location

`PATCH /storage/locations/{locationId}` · Core · Storage & Schema

Updates a storage location. Rotating its credential is always allowed. Moving a location that a bucket or dataset uses (changing its bucket, region or endpoint) is refused with 409 `K9O_STATE_CONFLICT`, reason `location_in_use`, because it would silently re-point objects already written there. A region outside the project's residency set is refused. The change is audited as `data.write.org.settings_updated`.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `locationId` | path | yes | The storage location's id (`byos_...`). Example: `"byos_8x2k4m9q1z7w"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `bucketName` | string | no | The new bucket name. Refused with 409 while a bucket or Dataset uses the location. |
| `region` | string | no | The new platform region; it must be in the project's residency set. Refused with 409 while the location is in use. |
| `providerRegion` | string | no | The new provider region. Refused with 409 while the location is in use. |
| `endpointOverride` | object | no | The new endpoint URL, or null to clear it. Refused with 409 while the location is in use. |
| _one of_ | | |  |
| _or_ | | |  |
| `credentialRef` | string | no | A new credential reference, `kibo://byos-creds/sec_...`. Rotating the credential is allowed while the location is in use. |
| `custodyMode` | enum ("PLATFORM_MANAGED", "BYOK", "HYOK") | no | The new custody mode. Refused with 409 while the location is in use. |
| `providerParams` | object | no | Non-secret settings the provider's credential exchange needs, as string keys with string values (each value at most 512 characters, at most 16 keys). The keys read per provider: - `r2` needs `accountId` and `parentAccessKeyId`. - `b2` needs `bucketId`. - `gcs` needs `serviceAccountEmail`. - `azure_blob` needs `azureTenantId`. - `s3`, `s3_compatible` and `minio` read none. Never put a secret here: the secret lives in the credential that `credentialRef` names, and these values are returned as stored on every read. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | A storage location: a bucket at an outside provider that the project's storage writes to. |
| `data.id` | string | yes | The location id (`byos_...`). |
| `data.projectId` | string | yes | The project the location belongs to (`proj_...`). |
| `data.provider` | enum ("s3", "s3_compatible", "gcs", "azure_blob", "minio", "r2", "b2") | yes | The storage provider. `s3_compatible` is any S3 API at `endpointOverride`. |
| `data.bucketName` | string | yes | The bucket or container name at the provider. |
| `data.region` | string | yes | The platform region the data belongs to. |
| `data.providerRegion` | string | yes | The bucket's region at its provider. |
| `data.endpointOverride` | object | yes | The custom endpoint URL, or null when none is set. |
| _one of_ | | |  |
| _or_ | | |  |
| `data.credentialRef` | string | yes | The credential reference (`kibo://byos-creds/sec_...`). The secret itself is never returned. |
| `data.custodyMode` | enum ("PLATFORM_MANAGED", "BYOK", "HYOK") | yes | Who holds the encryption keys for data written to the location. |
| `data.providerParams` | object | yes | The non-secret provider settings as stored, string keys with string values; an empty object when none were given. |
| `data.createdAt` | string (date-time) | yes | When the location was created. |
| `data.retiredAt` | object | yes | When the location was retired, or null while it is active. List results are always active; a read by id also returns a retired location. |
| _one of_ | | |  |
| _or_ | | |  |
| `meta` | object | yes |  |


## Errors

| HTTP | Code | When |
|---|---|---|
| 400 | `K9O_INVALID_FIELD_VALUE` | The updated credentialRef is not a valid kibo://byos-creds/<secId> reference; pre-create the credential secret and bind its reference. |
| 403 | `K9O_ACCESS_DENIED` | Your role does not permit updating this storage location. |
| 403 | `K9O_CREDENTIAL_CUSTODY_MISMATCH` | The requested credential access mode does not match the custody mode configured for this project. |
| 404 | `K9O_NOT_FOUND` | No storage location with this id exists in the project, or it is retired. |
| 409 | `K9O_STATE_CONFLICT` | The change would move a storage location that a bucket or a Dataset still uses (`context.reason: "location_in_use"`, with the buckets and the Dataset count). A change to `bucketName`, `region`, `endpointOverride`, `providerParams` or `custodyMode` is a move; rotating `credentialRef` is not. |

## Code samples

### cURL

```bash
curl -X PATCH 'https://<org>.api-<region>.k9o.io/@storefront/storage/locations/<locationId>' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/storage/locations/<locationId>', {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({}),
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.storage.locations.update('<locationId>', {})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.storage.locations.update("<locationId>", {})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Storage.Locations.Update(ctx, "<locationId>", map[string]any{})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.storage.locations.update("<locationId>", json!({})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.storage().locations().update("<locationId>", Map.of())
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Storage.Locations.UpdateAsync("<locationId>", new Dictionary<string, object> {  })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.storage.locations.update("<locationId>", {  })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->storage->locations->update('<locationId>', [])
```

### K9o

```swift
// let k9o = try K9o.createClient(orgSlug: "playground", projectSlug: "storefront", apiKey: "k9o_…")
let result = try await k9o.storage.locations.update("<locationId>", {})
```

### core-kotlin

```kotlin
// val k9o = createClient { orgSlug = "playground"; projectSlug = "storefront"; apiKey = "k9o_…" }
val result = k9o.storage.locations.update("<locationId>", {})
```

### k9o (Flutter)

```dart
// final k9o = K9o.createClient(orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…');
final result = await k9o.storage.locations.update('<locationId>', {})
```

### @k9o/react-native

```javascript
// const k9o = createClient({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })  // RN, secure storage
const { data } = await k9o.storage.locations.update('<locationId>', {})
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/update-storage-location
