API reference
API reference
Base URL, versioning, conventions, errors and objects of the REST API.
The REST API is how apps read and change things in Lamma. It is versioned, JSON in and out, and shaped like Discord's so code ported from there reads the same.
#Base URL
https://lammapp.sa/v1Every request needs a bot token in the Authorization header. Request bodies are JSON, up to 64 KB. Responses are never cached (Cache-Control: no-store).
#Versioning
/v1 only grows: new fields, endpoints and error codes can appear, but nothing is removed or changes meaning. Ignore fields you don't know. Anything that would break existing bots goes into a new /v2, with notes on how to move.
#Conventions
- IDs are strings. They are Lamma's own ids, so a Discord id won't find anything.
- Times are Unix time in milliseconds, unless a field says otherwise.
- Servers are called
guildsin paths and fields, as on Discord. - Responses are the object or list itself, with no wrapper.
- Path parameters are written
{name}on these pages.@memeans the bot or its application.
#Errors
Errors have a status and a short code:
{ "error": "missing_scope", "scope": "messages.read" }| Status | Code | Meaning |
|---|---|---|
400 | message_invalid and others | The request body is wrong |
401 | bot_token_required | No token was sent |
401 | bot_token_invalid | The token is wrong or revoked |
403 | application_disabled | The app was switched off or deleted |
403 | missing_scope | The install doesn't include a scope this call needs. scope names it |
403 | missing_permissions | The bot's role lacks a permission this call needs |
404 | not_found | It doesn't exist, or the bot can't see it |
409 | nonce_conflict | The nonce was used before with a different message |
429 | rate_limit | Slow down. See Rate limits |
Anything the bot can't see answers 404 exactly like something that doesn't exist: a server the app isn't in, a hidden or deleted channel, or a direct message. That way the API never confirms what is there.
#Objects
#User object
| Field | Type | Notes |
|---|---|---|
id | string | |
username | string | Unique handle |
name | string | Display name |
avatar_id | string or null | |
bot | boolean | true for app bot accounts |
The server, member, role, channel and message objects are described with their endpoints.
#Endpoints
| Area | Page |
|---|---|
| The bot, its application and the gateway address | Users and applications |
| Servers, roles and members | Servers |
| Channels, messages and reactions | Channels and messages |
| Audit logs | Audit logs |
| Slash commands and interaction answers | Slash commands |