Appearance
Create namespace
POST /v4/namespace/{type}
Create a new namespace. The path parameter type specifies the namespace type (storage or stream).
Request body
| Field | Type | Description |
|---|---|---|
| namespace | string | Required. The name of the new namespace. |
Response schema
| Field | Type | Description |
|---|---|---|
| data | Namespace | Created namespace information. |
| duration | string | Time taken to process the request, returned in a human-readable format (e.g., "1.234567ms"). |
Namespace object
| Field | Type | Description |
|---|---|---|
| name | string | The name of the namespace. |
| workspace | string | The workspace this namespace belongs to. |
| created_at | string (date-time) | When this namespace was created. |
| updated_at | string (date-time) | When this namespace was last updated. |
| tx | integer<int64> | Latest transaction ID in this namespace. |
| stat | object<string,integer> | Statistics about the namespace (key counts, size, etc.). |
Example
sh
curl --location 'https://api.litebase.io/v4/namespace/storage' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $LITEBASE_API_KEY" \
--data '{
"namespace": "sample"
}'Response:
json
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": {
"name": "sample",
"workspace": "default",
"created_at": "2024-03-20T10:30:00Z",
"updated_at": "2024-03-20T10:30:00Z",
"tx": 0,
"stat": {
"key_count": 0,
"size_bytes": 0
}
},
"duration": "1.234567ms"
}