Skip to content

Create namespace ​

POST /v4/namespace/{type} ​

Create a new namespace. The path parameter type specifies the namespace type (storage or stream).

Request body ​

FieldTypeDescription
namespacestringRequired. The name of the new namespace.

Response schema ​

FieldTypeDescription
dataNamespaceCreated namespace information.
durationstringTime taken to process the request, returned in a human-readable format (e.g., "1.234567ms").

Namespace object ​

FieldTypeDescription
namestringThe name of the namespace.
workspacestringThe workspace this namespace belongs to.
created_atstring (date-time)When this namespace was created.
updated_atstring (date-time)When this namespace was last updated.
txinteger<int64>Latest transaction ID in this namespace.
statobject<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"
}