# Retire Storage Location

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

Retires a storage location: it stops being listed and can't be linked again. A location that any bucket or dataset uses (a retired dataset included, since it still holds objects) is refused with 409 `K9O_STATE_CONFLICT`, reason `location_in_use`, never a silent fallback. Answers with the id and `status: "retired"`. 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"`. |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | The location that was retired. |
| `data.id` | string | yes | The retired location's id (`byos_...`). |
| `data.status` | enum ("retired") | yes | Always `retired`. |
| `meta` | object | yes |  |


## Errors

| HTTP | Code | When |
|---|---|---|
| 403 | `K9O_ACCESS_DENIED` | Your role does not permit deprovisioning this storage location. |
| 404 | `K9O_NOT_FOUND` | No storage location with this id exists in the project, or it is already retired. |
| 409 | `K9O_STATE_CONFLICT` | The storage location is still used by a bucket or a Dataset (`context.reason: "location_in_use"`, with the buckets and the Dataset count). |

## Code samples

### cURL

```bash
curl -X DELETE 'https://<org>.api-<region>.k9o.io/@storefront/storage/locations/<locationId>' \
  -H 'Authorization: Bearer $K9O_TOKEN'
```

### fetch

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

### k9o CLI

```bash
k9o storage locations retire <locationId>
```

### @k9o/core

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

### k9o

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

### sdk-go

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

### k9o

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

### dev.k9o:core

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

### K9o.Core

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

### k9o

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

### k9o/sdk

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

### K9o

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

### core-kotlin

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

### k9o (Flutter)

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

### @k9o/react-native

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


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