API
REST API Endpoints
No authentication. Write endpoints are rate limited per client address.
Errors are JSON too: {"error": {"status": 400, "message": "..."}}.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/list?page=1&per_page=25 | Newest items first. Returns items, page, per_page, total and has_more. per_page is at most 100. |
| GET | /api/item/:id | One item |
| GET | /api/bot?period= | A random item as JSON. period (optional): week, month, year. |
| GET | /api/random?period= | Redirect to a random image, same filter |
| POST | /api/submit | Register an image by URL. JSON body {"url": "...", "poster_key": "..."} (poster_key optional: a secret random 8–64 character key per app install, letters, digits, - and _; only its digest is stored or shown, and a banned key is refused with 403); returns the created (or already existing) item. The URL must be public HTTPS, must not redirect, and must serve a PNG, JPEG, GIF or WebP: the server fetches its first bytes to check, and answers 400 otherwise. |
| POST | /api/upload | Upload an image. JSON body {"image": "<base64>", "poster_key": "..."} (poster_key optional, as for /api/submit), up to 10 MB; returns the created item. |
| POST | /api/moderation/report/:id | Flag an item as objectionable. JSON body {"reporter_key": "...", "reason": "..."}, both optional. The operators are notified and act within 24 hours; the item itself is unchanged until they do. |
| POST | /api/moderation/block/:poster_key | Block a poster. JSON body {"reporter_key": "..."} (optional). Notifies the operators; hiding the poster's items is the client's job. |
Item
{
"id": 1234,
"url": "https://.../image.png", // as stored
"image_url": "https://.../image.png", // what to load
"page_url": "https://lgtm.lol/i/1234",
"markdown": "[](https://lgtm.lol/i/1234)",
"poster_key": "3f0c…e9a1", // 64 hex: the digest of the poster's key, only when posted from the app; what /api/moderation/block takes
"created_at": "2025-01-01T00:00:00",
"updated_at": "2025-01-01T00:00:00"
}
gRPC (Legacy)
Server: 45.76.103.213:5555
syntax = "proto3";
package api;
service LGTM {
rpc Items (ItemsRequest) returns (ItemsResponse) {}
rpc Upload (UploadRequest) returns (UploadResponse) {}
rpc Item (ItemRequest) returns (ItemResponse) {}
}
message Item {
int64 id = 1;
string url = 2;
}
message ItemsRequest {
int64 page = 1;
}
message ItemsResponse {
repeated Item items = 1;
}
message ItemRequest {
int64 id = 1;
}
message ItemResponse {
Item item = 1;
}
message UploadRequest {
string image = 1;
}
message UploadResponse {
string result = 1;
}