> For the complete documentation index, see [llms.txt](https://docs.khotan.com/llms.txt). A markdown version of any page is available at its `index.md` URL.

# Redis Databases

`/api/v1` operations for redis databases. See [HTTP API](/api/) for authentication, the error envelope, and rate limits.

## Operations

### GET /api/v1/redis-databases

List Redis databases

Returns the organization's non-deleted Redis databases. Responses never include connection credentials.

Auth: API key required.

Operation ID: `listRedisDatabases`

Responses:
- `200` — The organization's Redis databases.
- `401` — Authentication is missing or invalid.
- `429` — Too many requests; retry after the indicated delay.

CLI: `khotan redis list`

### POST /api/v1/redis-databases

Create a Redis database

Provisions a globally replicated Redis database synchronously and responds 201 with the persisted record whether provisioning ends ready or failed; branch on the returned status. This operation is not idempotent: retrying a request that already succeeded provisions a second database. Omit primaryRegion to use the default region.

Auth: API key required.

Operation ID: `createRedisDatabase`

Request body (`application/json`, required):
- `name` (string, required)
- `primaryRegion` (string | null, optional)
- `idempotencyKey` (string, optional)

Responses:
- `201` — The persisted Redis database record, ready or failed.
- `400` — The request was malformed or failed validation.
- `401` — Authentication is missing or invalid.
- `429` — Too many requests; retry after the indicated delay.

CLI: `khotan redis create`

### GET /api/v1/redis-databases/{databaseId}

Get a Redis database

Returns one Redis database's record, including status and failure state when present. Responses never include connection credentials.

Auth: API key required.

Operation ID: `getRedisDatabase`

Path parameters:
- `databaseId` (string, required)

Responses:
- `200` — The Redis database record.
- `401` — Authentication is missing or invalid.
- `404` — The resource was not found.
- `429` — Too many requests; retry after the indicated delay.

CLI: `khotan redis get`

### DELETE /api/v1/redis-databases/{databaseId}

Delete a Redis database

Tears down the database at the provider, then soft-deletes the record — the same semantics as deleting from the dashboard. Deletion is permanent. Returns 403 resource_protected when the database has deletion protection enabled; protection can only be removed from the dashboard.

Auth: API key required.

Operation ID: `deleteRedisDatabase`

Path parameters:
- `databaseId` (string, required)

Responses:
- `200` — The Redis database was deleted.
- `401` — Authentication is missing or invalid.
- `403` — The database is protected from deletion (code resource_protected). Remove protection from the dashboard before deleting via the API.
- `404` — The resource was not found.
- `429` — Too many requests; retry after the indicated delay.
- `502` — Response.

CLI: `khotan redis delete`

### PUT /api/v1/redis-databases/{databaseId}/tags

Set a Redis database's tags

Replaces a Redis database's tag list with the submitted list and returns the stored list. Tags are normalized to lowercase slugs, so `Live` is stored as `live`. Send an empty list to remove every tag. Requires an API key whose role is owner or developer.

Auth: API key required.

Operation ID: `setRedisDatabaseTags`

Path parameters:
- `databaseId` (string, required)

Request body (`application/json`, required):
- `tags` (string[], required) — Full tag list; it replaces the stored list. Each tag is trimmed, lowercased, and has whitespace runs replaced with "-", and repeats are removed. After that, each tag is 1-32 lowercase letters, digits, or single hyphens, with at most 10 tags. Presets: test, live, uat, dev, demo, deprecated.

Responses:
- `200` — The stored tag list, after normalization.
- `400` — The request was malformed or failed validation.
- `401` — Authentication is missing or invalid.
- `403` — The caller is not permitted to perform this action.
- `404` — The resource was not found.
- `429` — Too many requests; retry after the indicated delay.

CLI: `khotan redis tags set`

### GET /api/v1/redis-databases/{databaseId}/connection

Get Redis connection credentials

Returns the rediss:// URI plus the REST URL and read/write and read-only REST tokens for a ready Redis database. These credentials grant access to the database; treat them as secrets. Responds 404 until the database is ready.

Auth: API key required.

Operation ID: `getRedisDatabaseConnection`

Path parameters:
- `databaseId` (string, required)

Responses:
- `200` — The Redis connection credentials for the ready database.
- `401` — Authentication is missing or invalid.
- `404` — The resource was not found.
- `429` — Too many requests; retry after the indicated delay.

CLI: `khotan redis connection`

<!-- generated from the /api/v1 OpenAPI spec v1.0.0 (adapter 0.10.0); do not edit by hand -->
