Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
createSpacelistSpacesdeleteSpacecreateSessionlistSessionsdeleteSession
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKSpaces and sessionscreateSpace

createSpace

Provision the caller's space. Idempotent — the created flag says whether this call made it.

PURPOSE

Provision the caller's space. Idempotent: calling it against a space that already exists succeeds and tells you so. The body is optional — a call with no arguments is the normal one.

POST/v1/spacesBearer API keystable
createSpace(input?: CreateSpaceInput): Promise<SpaceProvision>
Handshake credentialstable
createSpace(request: SpaceCreateRequest): Promise<SpaceCreateResponse>

Parameters

ParameterTypeRequired
metadatastring (wire: bytes | null)optional

Opaque metadata to attach at provision time. Brain stores it and never interprets it.

Returns

FieldTypePresence
spacestringalways

The space's id.

createdbooleanalways

true when this call made it, false when it was already there. The rest of the body is identical either way, so this flag is the only way to tell. The edge also answers 201 versus 200.

createdAtUnixNanos / lastActiveUnixNanos64-bit integeralways

Provisioning time and last write.

memoryCount / sessionCountintegeralways

What is already in it.

You do not choose your space on the HTTP tier

The space comes from the credential. These verbs act on the caller's space. Addressing another space per request is a wire-tier capability — see act_as. Per-end-user isolation is a storage-key prefix inside one space, not a key per user; see Namespaces.

See also
listSpacesNamespaces

Was this page helpful?

unlink

Remove a memory-to-memory edge. Removing one that is not there is a success, not an error.

listSpaces

The spaces in the caller's namespace — and the cross-shard completeness flag you must check.

On this page

ParametersReturns
Suggest an editOpen in Playground