Skip to main content
The Sublay REST API is a project-scoped HTTP API. All endpoints follow the same base structure and share common conventions for authentication, pagination, and error reporting.

Base URL

All API requests are made to:
Replace :projectId with the UUID of your Sublay project, which you can find in the Sublay dashboard. So every endpoint takes the form:
The project is read from the path only. Don’t send 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 accept application/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-query or <area>/invalid-body, with error naming 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 a Bearer token in the Authorization header:
See Authentication for full details on obtaining and refreshing tokens.

Pagination

Endpoints that return pages of records use offset pagination. Pass page 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 limit above 100. It is never lowered to 100 for you; the message names the maximum.
  • a page above 9007199254740991 ("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.
Paginated responses always return the same envelope:
To read a whole list, request pages in turn (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:
  • error is text for people. Show it or log it, but don’t branch on it: it can change.
  • code is stable, in the form <area>/<kebab-case-slug> (entity/not-found, auth/email-taken). Branch on this.
Some errors add keys:
  • param names the failing input when the error is about one: a validation 400 (<area>/invalid-body, <area>/invalid-query, <area>/invalid-params), including a key the endpoint doesn’t take and a malformed or misspelled actingUserId; 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 leaves param out 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-failed and auth/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, bundleId and dashboardUrl on a missing bundle, verificationId on an unverified sign-in); each endpoint’s page lists them.
Two exceptions:
  • An access token that is missing, expired or invalid gets a bare 401 Unauthorized / 403 Forbidden with 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 429 is 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: a request/ 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 a multipart/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. Loading a file through its link (an originalPath 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 returns 429 with code request/rate-limited and the endpoint’s own message as error:
The response carries the standard rate-limit headers. Limits are noted per endpoint in this reference.