Themes¶
A theme is a custom CSS stylesheet stored under a short identifier; anyone holding the identifier can fetch it. The HTTP API has one operation, which stores a theme. The stored stylesheet is then served as a public file.
The route is user-only: a bot token is rejected with 403 ACCESS_DENIED.
Theme identifier¶
A theme identifier is 16 lowercase hexadecimal characters (^[a-f0-9]{16}$), chosen at random. Submitting identical CSS twice creates two independent themes.
Document bounds¶
| Bound | Value |
|---|---|
| Maximum size | 8388608 bytes (8 MiB) of UTF-8, inclusive |
| Minimum size | 1 byte |
There is no per-account theme quota; the theme:share:create rate limit is the only bound on how many themes an account creates.
TEBHOS stores the CSS verbatim. It is not parsed, validated, minified or rewritten.
Create theme¶
POST /users/@me/themes
Stores a CSS document and returns 201 with its theme identifier. No permission is required.
JSON body¶
| Field | Type | Description |
|---|---|---|
| css | string | The CSS text to store (1 byte to 8 MiB) |
Response¶
| Status | Body | Condition |
|---|---|---|
| 201 | {"id": string} |
The document was stored |
| 400 | error response | css is empty or larger than 8 MiB (BAD_REQUEST), or the body is not a JSON object with a string css |
| 403 | error response | The caller is a bot (ACCESS_DENIED) |
Side effects¶
The document is stored as themes/{id}.css with the content type text/css; charset=utf-8 before the identifier is returned. It is served publicly at:
Theme CSS is public and permanent
The identifier is the only thing protecting a stored document, and the read URL needs no authentication. The API cannot replace or delete a stored theme. Never put a token or any other secret in a theme.
Rate limit¶
20 requests per minute per client, on the theme:share:create bucket.