Skip to main content
Create Space
Creates a new space. Its creator — the signed-in user, or the user a service key names in actingUserId — is automatically added as an admin. A space always has a creator, so a service key must name one. Supports optional avatar and banner image upload via multipart form data. Authentication required. A request with no credentials returns 401.

Body Parameters

string
Display name for the space. Must be 3–100 characters.
string
Optional URL slug. Must be unique per project. Supports Unicode letters, numbers, hyphens, and underscores.
string
Optional description. Up to 1,000 characters.
string
Who can read content: "anyone" or "members". Defaults to "anyone".
string
Who can post entities: "anyone", "members", or "admins". Defaults to "members".
string
Who can find and see the space: "public", "unlisted", or "private". Defaults to "public". Independent of readingPermission, which governs content. "unlisted" keeps the space out of the directory and search, and out of sub-space lists for non-members, but reachable by id, short id or slug; "private" makes it seen only by its active members (everyone else gets 404), and it can’t be joined: members are added by its moderators and admins. See Space visibility.
boolean
Whether new joins require approval. Defaults to true.
object
Optional arbitrary key-value data. Up to 1 MB.
string | null
Optional UUID of a parent space. The caller must be an admin of the parent space; when a service key creates the space for a user (actingUserId), that user must be. For a top-level space, send null or leave it out; the string "none" is refused with 400 space/unsupported-param (see Saying “no value”).
file
Optional avatar image. Multipart form field. Requires avatarFile.options when provided.
file
Optional banner image. Multipart form field. Requires bannerFile.options when provided.
string
Service key only, and required with one: the user this request acts as, who creates the space and becomes its admin, held to their own permissions. Leaving it out returns 400 space/missing-user-id. A user token always acts as its own user and must not send it (400 space/acting-user-not-allowed).

Response

Returns the created Space object with membersCount, childSpacesCount, and optional file associations.

Error Responses

Returned with no JSON body: 401 when no Authorization header is sent, 403 when the access token is invalid or expired. Checked before any uploaded file is read, so a request with no credentials gets 401 rather than a body or acting-user error.
A service key sent no actingUserId. A space needs a creator.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
actingUserId was sent in the query string. On this endpoint every field, actingUserId included, goes in the request body.
Returned when a service key names an actingUserId that isn’t a user in this project.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token:
The parent space doesn’t exist, or the caller can’t see it (see Space visibility). Checked before the parent-admin check.
The creator was banned in the parent space (or above) while the child space was being created.
Returned when an avatar or banner is uploaded on a project without the files-images bundle. missingTables lists the tables that aren’t installed.
See also: useCreateSpace