Base URL
All API requests are made to::projectId with the UUID of your Sublay project, which you can find in the Sublay dashboard.
So every endpoint takes the form:
projectId in the query string or the body, or an x-sublay-project-id header: each is refused with 400 project/wrong-location. The exception is a custom-table column named projectId, which stays writable in the row bodies of Insert Row, Bulk Insert Rows (inside each entry of rows) and Update Row.
Request Format
Most endpoints acceptapplication/json. Endpoints that support file uploads accept multipart/form-data. The Content-Type header should be set accordingly.
Where each field goes is decided by the method: the path holds the resource, GET and DELETE take every other field in the query string and no body, and POST, PATCH and PUT take every other field in the body, actingUserId included. Each field is read from one place; sent elsewhere, it is refused with a 400 that names the right place:
See Where each input goes.
Ids
Every Sublay record id (spaceId, entityId, userId, …) is a UUID. Ids are accepted in either case and the server lowercases them; record ids in responses are lowercase.
An id that isn’t a UUID is refused with 400:
-
In the URL path: checked before sign-in, permissions or any lookup (only a missing bundle,
403 database/tables-not-available, is reported first). Code<area>/invalid-params, where<area>is the endpoint’s area (space,entity,chat, …): -
In the query string or body: code
<area>/invalid-queryor<area>/invalid-body, witherrornaming the field.
foreignId and sourceId are your own strings, not Sublay ids, so they accept any text, except that sourceId can’t be none, null or undefined: list filters use none for “no source” (see Saying “no value”).
Authentication
Protected endpoints require aBearer token in the Authorization header:
Pagination
Endpoints that return pages of records use offset pagination. Passpage and limit as query parameters:
The maximum
limit is 100 on every page-numbered endpoint. Each endpoint’s page gives its default.
Both values are written as plain digits. A request is refused with 400 <area>/invalid-query in the endpoint’s own area, with param naming the field (page or limit), when it sends:
- a
limitabove100. It is never lowered to100for you; the message names the maximum. - a
pageabove9007199254740991("page: Page must be at most 9007199254740991"). 0, a negative number, a decimal (1.5), an exponent (1e1), trailing text (5abc), surrounding spaces or an empty value.
page=1, page=2, …) until pagination.hasMore is false; a paginated endpoint never returns all its records in one response.
Chat conversations, chat messages and comments page by cursor instead, with the same data and a pagination.hasMore. Comments and chat conversations take an opaque cursor: pass the previous page’s pagination.nextCursor back unchanged. Chat messages page before or after a message: pass the id of the first or last message you hold as before or after. Their pages describe the details.
Error Format
Every error is JSON with the same two keys:erroris text for people. Show it or log it, but don’t branch on it: it can change.codeis stable, in the form<area>/<kebab-case-slug>(entity/not-found,auth/email-taken). Branch on this.
-
paramnames the failing input when the error is about one: a validation400(<area>/invalid-body,<area>/invalid-query,<area>/invalid-params), including a key the endpoint doesn’t take and a malformed or misspelledactingUserId; an id that isn’t a UUID, the project id in the path included (project/invalid-id); a value another record already holds (<area>/foreign-id-taken,<area>/username-taken,auth/email-taken,space/slug-taken); a referenced record that can’t be used (chat/invalid-parent,chat/invalid-quote,collection/invalid-parent); a single value the endpoint refuses (chat/invalid-emoji,auth/redirect-url-not-allowed); an image-options field that is missing or isn’t valid JSON; a refused file (<area>/file-too-large,<area>/unsupported-file-type,<area>/unexpected-file-field,<area>/invalid-image). It is the input’s dot path, as you sent it (email,metadata.title,images.options,images). A validation rule that checks several fields together names the field it’s about, or leavesparamout when no single field is. It is left out when the error is about the request as a whole: a body sent with a content type the server doesn’t read, or a query string with more parameters than the server reads. -
A
500’s code is<area>/server-error, with two exceptions on sign-out:auth/device-deregistration-failedandauth/sign-out-failed. The underlying failure is recorded in Sublay’s server logs, not returned in the response. -
Some errors add keys of their own (
missingTables,bundleIdanddashboardUrlon a missing bundle,verificationIdon an unverified sign-in); each endpoint’s page lists them.
- An access token that is missing, expired or invalid gets a bare
401 Unauthorized/403 Forbiddenwith no JSON body. See Authentication. - The pages Sublay hosts for your users to open in a browser answer their errors as pages, not JSON: the email verification link (its
429is a plain sentence) and the password reset page.
Request errors
These can come from any endpoint, because they are about the HTTP request itself rather than the resource. For a body the rule is: arequest/ code means the body couldn’t be read at all; once it is read, anything wrong with its content gets the endpoint’s own area code (<area>/invalid-body, the upload errors below).
Upload errors
Endpoints that take a file in amultipart/form-data body answer a refused file with a code in the endpoint’s area (entity, event, comment, space, user, auth, chat, storage):
The limits are per request, the same on every endpoint: at most 50 MB per file, 20 files in total, and 250 MB for the whole body. A field that holds a list of files takes up to 20 of them; a field that holds one file (
avatarFile, bannerFile, coverFile) takes one. They don’t cap how many files a record holds: an update can add more. A record’s files are sent in the same fields everywhere: one image in a slot (avatarFile, bannerFile, coverFile) with its options in <field>.options, and a list as images (processed into sizes, images.options required) and files (stored as uploaded, files.options optional). An update that holds files takes removeFileIds. Endpoints that process images add their own checks (for example 422 <area>/invalid-image for a file that isn’t a valid image, with param naming its field, and 400 <area>/missing-image-options for images sent without their options); an id in removeFileIds that isn’t the record’s own file gets 400 <area>/invalid-remove-file-ids, and uploads that would take the project past its plan’s file-storage limit get 429 project/quota-reached. Each endpoint’s page lists them.
File link errors
Loading a file through its link (anoriginalPath or publicPath, which is how <img> and image components load it) needs no credentials: the link itself is the proof. A link that doesn’t work answers:
Same situation, same answer
The same situation gets the same status and the same kind of code on every endpoint, so you can handle each one once:Common HTTP Status Codes
An expired token returns
403, not 401 — see
Authentication for why that distinction
matters when writing your own refresh logic.Rate Limiting
Each endpoint has its own rate limit, counted per client IP. When a limit is exceeded, the API returns429 with code request/rate-limited and the endpoint’s own message as error:

