Skip to main content
Create Entity
Requires the entities bundle. A project without the entities bundle returns 403 database/tables-not-available. See Bundles.
Creates a new entity in your project. Supports optional file uploads via multipart/form-data. When no files are attached, use application/json. The entity’s author is the signed-in user, or the user a service key names in actingUserId; the create then runs under that user’s own checks, such as suspension. Without a user, the entity has no author: it is app-owned, and only a service key naming nobody can later edit, publish or delete it. Who may create an entity without an author:
  • A service key naming nobody — always.
  • A request with no credentials — only while the project’s Who can create entities without an author setting is Everyone (the default). Under Signed-in users only or No one from the client it returns 403 entity/authorless-creation-not-allowed, also for a draft (this is checked before the draft rule). A request whose user token is expired or invalid is treated as one with no credentials. A project admin changes the setting in the dashboard under Settings → General → SDK.
A signed-in user’s request always creates that user’s entity, whatever the setting.

Body Parameters

string
Your application’s identifier for this entity (URL, slug, database ID, etc.). Used to fetch or create entities without knowing the Sublay ID.
string | null
Groups entities by source. Use a topic ID or page ID to scope feeds to a specific context. For no source, leave it out or send null. none, null and undefined (as strings, exact and case-sensitive) are reserved: list filters use none to mean “no source”, so an entity can’t be stored with one of them. They are refused with 400 entity/invalid-body.
string
The ID of the space this entity belongs to. The space must exist in the same project.
string
Service key only: the user this request acts as, who authors the entity. Leave it out to create an app-owned entity with no author. A user that doesn’t exist returns 404 entity/user-not-found. A user token always acts as its own user and must not send it, and neither may a request with no credentials (400 entity/acting-user-not-allowed).
string
A title or headline for the entity.
string
The main body text of the entity.
object[]
An array of generic attachment objects. Each item is a free-form JSON object — structure is defined by your application.
string[]
Tags or keywords associated with this entity. Used for keyword-based filtering in the list endpoint.
object[]
Users or spaces mentioned in this entity. Each object is a discriminated union:
  • { type: "user", id: string, username: string, foreignId?: string }
  • { type: "space", id: string, slug: string }
Each mentioned user receives one in-app notification, however many times they are mentioned. A space mention sends no notification, and an author mentioning themselves is not notified. When a service key creates the entity on a user’s behalf, that user is the notification’s initiator. An entity without an author sends no mention notifications.
object
Geographic coordinates for this entity. Enables proximity-based filtering.
object
A free-form JSON object for any custom data your application needs alongside the entity. Supports rich filtering via metadataFilters in the list endpoint.
boolean
When true, the entity is saved as a draft and excluded from public feeds. Publish it later via the Publish Entity endpoint. A draft needs an owner: send it with a user token, or with a service key and actingUserId. Otherwise it returns 400 entity/draft-requires-user.
string
ISO 8601 datetime to backfill a creation timestamp. Service key only, also with actingUserId (importing content with its original authors and dates). Ignored from a user token. More than five minutes in the future returns 400 entity/invalid-body (createdAt can't be in the future.).
string
ISO 8601 datetime for updatedAt. Requires createdAt to also be set. Must be ≥ createdAt. When only createdAt is sent, updatedAt is set to the same time. Service key only, also with actingUserId. Ignored from a user token. More than five minutes in the future returns 400 entity/invalid-body (updatedAt can't be in the future.).

File Uploads (multipart/form-data)

When uploading files, send the request as multipart/form-data. All JSON fields above are sent as form fields. Form fields can only carry strings, so the object and array fields — attachments, keywords, mentions, location and metadata — must be JSON-stringified. Booleans are sent as "true" / "false". Plain strings such as title and content are sent as-is.
The SDKs handle this for you — useCreateEntity switches to multipart/form-data and stringifies these fields automatically as soon as you pass images or files.
file[]
Image files to attach. Maximum 10 images, 50 MB each. Must be valid images. Requires images.options.
string
Stringified JSON describing how to process uploaded images. Must include a mode field:
  • "exact-dimensions" — resize to specific pixel dimensions per variant
  • "aspect-ratio-width-based" — resize by width maintaining aspect ratio
  • "aspect-ratio-height-based" — resize by height maintaining aspect ratio
  • "original-aspect" — preserve original ratio, resize by max dimension
  • "multi-aspect-ratio" — generate crops at multiple aspect ratios
Optional fields: quality (1–100), format (webp, jpeg, png, original), stripExif (boolean), pathParts (string[]).
file[]
Generic files to attach. Maximum 10 files, 50 MB each.
string
Stringified JSON for file options. Optional pathParts (string[]) customizes the storage path.

Response

Returns the created Entity object. When files are uploaded, the entity includes a files array with signed URLs for each attachment.
Draft entities are invisible to everyone but their author until published. Use Fetch Drafts to list an author’s unpublished drafts.

Error Responses

A request with no credentials, on a project whose Who can create entities without an author setting is Signed-in users only or No one from the client. A project admin can change the setting in the dashboard under Settings → General → SDK.
The entity’s author is suspended: the signed-in user, or the user a service key names in actingUserId. Nothing is created.
reason is null when none was given; endDate is null for a suspension with no end date.
A user token, or a request with no credentials, 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.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token, or with no credentials:
sourceId is "none", "null" or "undefined". Other spellings, such as "None", are ordinary values.
Returned when your entity.created validation webhook rejects the request. error carries the message your webhook returned. Nothing is stored.
The request sent a foreignId that is taken. Another entity already has this foreignId, or had it: a foreignId is unique across the project’s entities, deleted ones included, and a deleted entity’s foreignId can’t be reused. Nothing is created.
When the entity holding it was deleted:
Also returned when updatedAt is earlier than createdAt:
Returned to a service key when createdAt or updatedAt is more than five minutes ahead of the current time. error names the field.
The request sent excludeUserId. To create an entity with no author, use a service key without actingUserId.
The request sent requireUser. A user’s token always creates that user’s entity, and who else may create an entity without an author is the project’s Who can create entities without an author setting.
isDraft was true with no author: a request with no credentials, or a service key naming nobody. A draft needs an owner.
Returned when a service key names an actingUserId that isn’t a user in this project.
Returned when a file or image is uploaded on a project without the files-images bundle. missingTables lists the tables that aren’t installed.