Database API
14 endpoints.
Get a backup JSON
Section titled “Get a backup JSON”Scans the entire database and returns a backup in JSON form. Consider using the POST variant if your database is large, as this basic GET endpoint might time out if it takes too long to generate the backup.
This backup can be reimported manually through the Backup and Restore feature.
Responses
200Success response
{
"archives": [
{
"arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",
"filename": "FateGOMEMO",
"summary": null,
"tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color, super:test, date_added:1553537258",
"thumbhash": "ec2a0ca3a3da67a9390889f0910fe494241faa9a",
"title": "Fate GO MEMO"
},
{
"arcid": "d1858d5dc36925aa66be072a97817650d39de166",
"filename": "(Memes)9B789D38B0784C5FBC9D59A9F24D20F2",
"summary": null,
"tags": "",
"thumbhash": "9846bb6d62949b56545c42e88d8010446b65702e",
"title": "test title"
}
],
"categories": [
{
"archives": [],
"catid": "SET_1749925633",
"name": "english",
"search": "language:english"
}
],
"tankoubons": [
{
"archives": [
"28697b96f0ac5858be2614ed10ca47742c9522fd",
"d1858d5dc36925aa66be072a97817650d39de166"
],
"name": "sailor moon",
"tankid": "TANK_1749925516"
}
]
}Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Queue a backup job
Section titled “Queue a backup job”Queues a Minion job to generate a backup JSON file.
Use the returned job ID to check progress and download the file once complete.
Responses
200Enqueued job
{
"job": 42,
"operation": "queue_backup",
"success": 1
}This endpoint needs an administrator token — a guest (read-only) token is refused by the server.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Download backup JSON from completed job
Section titled “Download backup JSON from completed job”Downloads the backup JSON file generated by a completed backup job.
Path parameters
- jobidintegerrequired
- ID of the completed backup job.
Query parameters
- formatstring · enum: json | fileoptional
- Format of the returned backup. Defaults to
file.jsonwill return the backup as a JSON response.
Responses
200Backup JSON file
{}400Job not found or not completed
{
"error": "",
"operation": "",
"success": 0,
"successMessage": ""
}Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Clean the Database
Section titled “Clean the Database”Cleans the Database, hiding then removing entries for files that are no longer on the filesystem.
Entries that are no longer on the filesystem are only unlinked at first so they don’t appear in the UI – A subsequent run of this cleanup will delete unlinked entries.
Responses
200Success response
{
"deleted": 0,
"operation": "",
"success": 0,
"unlinked": 0
}This endpoint needs an administrator token — a guest (read-only) token is refused by the server.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Drop the Database
Section titled “Drop the Database”Delete the entire database, including user preferences. This is a rather dangerous endpoint, invoking it might lock you out of the server as a client!
Responses
200Success response
{
"error": "",
"operation": "",
"success": 0,
"successMessage": ""
}This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Imports a LANraragi (or LANrurugi) backup JSON file the caller uploads directly — no live
Section titled “Imports a LANraragi (or LANrurugi) backup JSON file the caller uploads directly — no live”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/database.rs:785), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.
Imports a LANraragi (or LANrurugi) backup JSON file the caller uploads directly — no live
connection to any remote Redis instance (see lanrurugi_backup::import_legacy’s own module
docs for why: the official LANraragi Docker image never exposes its bundled Redis outside the
container by default). Same multipart-file-upload shape as queue_restore above, but this is
deliberately its own independent handler/parsing/persistence path, not a variant of
queue_restore — see import_legacy’s own docs on why the two must not share code despite
superficially similar JSON shapes.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:44.
This response carries no example body.
This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
How many times this instance has ever run a LANraragi import — read by the frontend before
Section titled “How many times this instance has ever run a LANraragi import — read by the frontend before”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/database.rs:994), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.
How many times this instance has ever run a LANraragi import — read by the frontend before
showing the import UI, so it can warn (“you’ve done this before — consider a full backup
first”) on a 2nd-or-later import without waiting for the import itself to complete. Read-only,
separate from queue_import_legacy’s own increment (which happens after a real import
finishes), matching ImportSnapshotRepository::import_count’s own read/increment split.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:48.
This response carries no example body.
This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Newest-first metadata list (no document payload — see
Section titled “Newest-first metadata list (no document payload — see”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/database.rs:1021), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.
Newest-first metadata list (no document payload — see
ImportSnapshotRepository::list_metadata’s own docs) for the Backup page’s Time-Machine-style
rollback-point picker.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:49.
This response carries no example body.
This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
delete_import_snapshot
Section titled “delete_import_snapshot”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The handler is delete_import_snapshot in crates/lanrurugi-api/src/database.rs:1063.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:50.
This response carries no example body.
This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Returns the full BackupDocument payload as a downloadable JSON file — same shape
Section titled “Returns the full BackupDocument payload as a downloadable JSON file — same shape”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/database.rs:1041), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.
Returns the full BackupDocument payload as a downloadable JSON file — same shape
POST /database/restore accepts, so the frontend’s own “restore” flow can take this file
straight back in with zero format translation on either side.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:50.
This response carries no example body.
This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Clear All “New” flags
Section titled “Clear All “New” flags”Clears the “New!” flag on all archives.
Responses
200Success response
{
"error": "",
"operation": "",
"success": 0,
"successMessage": ""
}This endpoint needs an administrator token — a guest (read-only) token is refused by the server.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
rebuild_index
Section titled “rebuild_index”Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.
The handler is rebuild_index in crates/lanrurugi-api/src/database.rs:702.
Responses
200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/database.rs:43.
This response carries no example body.
This endpoint needs an administrator token — a guest (read-only) token is refused by the server.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Queue a restore job
Section titled “Queue a restore job”Queues a Minion job to restore from a backup JSON file.
Use the returned job ID to check progress.
Request body
multipart/form-data
Responses
200Enqueued job
{
"job": 43,
"operation": "queue_restore",
"success": 1
}400Invalid request
{
"error": "",
"operation": "",
"success": 0,
"successMessage": ""
}This endpoint needs an administrator token — a guest (read-only) token is refused by the server.
Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.
Get Statistics
Section titled “Get Statistics”Get tags from the database, with a value symbolizing their prevalence.
Query parameters
- minweightintegeroptional
- Add this parameter if you want to only get tags whose weight is at least the given minimum. Default is 1 if not specified, to get all tags.
- hide_excluded_namespacesstringoptional
- Set to true to exclude namespaces configured in server settings from the results. Default behavior returns all tags.
Responses
200Success response
[
{
"namespace": "character",
"text": "jeanne alter",
"weight": 2
},
{
"namespace": "character",
"text": "xuanzang",
"weight": 2
},
{
"namespace": "parody",
"text": "fate grand order",
"weight": 3
},
{
"namespace": null,
"text": "artbook",
"weight": 3
}
]Request failed — Usual causes: the instance address is wrong or unreachable; cross-origin access is not enabled on the instance; or this page is HTTPS while the instance is plain HTTP on a LAN address, which the browser blocks as mixed content. “Copy as cURL” above sends the same request from a terminal.
Your own instance address. Requests go from this browser straight to it.