Skip to main content

Overview

The Database Dumps API allows administrators to manage database dump files, making them available for download. This is useful for backups, data analysis, or sharing dataset snapshots with the community.
All database dump endpoints require administrator authentication and permissions.

Authentication

All endpoints require:
  • Valid authentication token
  • Administrator role/permissions
  • Bearer token in Authorization header
Authorization: Bearer YOUR_ACCESS_TOKEN

Dump Structure

Database dumps contain the following fields:
FieldTypeDescription
dump_idintegerUnique identifier for the dump
pathstringFile path to the dump file
publicbooleanWhether the dump is publicly accessible
linkstringDownload URL for the dump (auto-generated)
created_atdatetimeWhen the dump was created
updated_atdatetimeWhen the dump record was last updated

Endpoints

List Dumps

Get a paginated list of public database dumps.
GET /api/admin/dump
By default, this endpoint returns only public dumps (where public is true).
Query Parameters:
  • Standard pagination and filtering parameters
  • Supports field selection and includes
Example Response:
{
  "dumps": [
    {
      "dump_id": 1,
      "path": "dumps/animethemes-2026-03-01.sql.gz",
      "public": true,
      "link": "https://api.animethemes.moe/dump/1",
      "created_at": "2026-03-01T00:00:00.000000Z",
      "updated_at": "2026-03-01T00:00:00.000000Z"
    },
    {
      "dump_id": 2,
      "path": "dumps/animethemes-2026-02-01.sql.gz",
      "public": true,
      "link": "https://api.animethemes.moe/dump/2",
      "created_at": "2026-02-01T00:00:00.000000Z",
      "updated_at": "2026-02-01T00:00:00.000000Z"
    }
  ]
}

Create Dump

Register a new database dump file.
POST /api/admin/dump
This endpoint registers a dump file in the system. The actual database dump file must be created separately using database backup tools.
Request Body:
{
  "path": "dumps/animethemes-2026-03-03.sql.gz",
  "public": true
}
Required Fields:
  • path - File path to the dump file
  • public - Whether the dump should be publicly accessible
Example Response:
{
  "dump": {
    "dump_id": 3,
    "path": "dumps/animethemes-2026-03-03.sql.gz",
    "public": true,
    "link": "https://api.animethemes.moe/dump/3",
    "created_at": "2026-03-03T12:00:00.000000Z",
    "updated_at": "2026-03-03T12:00:00.000000Z"
  }
}

Get Dump

Retrieve information about a specific dump.
GET /api/admin/dump/{id}
Path Parameters:
  • id - The dump ID
Example Response:
{
  "dump": {
    "dump_id": 1,
    "path": "dumps/animethemes-2026-03-01.sql.gz",
    "public": true,
    "link": "https://api.animethemes.moe/dump/1",
    "created_at": "2026-03-01T00:00:00.000000Z",
    "updated_at": "2026-03-01T00:00:00.000000Z"
  }
}

Update Dump

Update dump metadata (typically to change visibility).
PUT /api/admin/dump/{id}
Path Parameters:
  • id - The dump ID
Request Body:
{
  "public": false
}
Example Response:
{
  "dump": {
    "dump_id": 1,
    "path": "dumps/animethemes-2026-03-01.sql.gz",
    "public": false,
    "link": "https://api.animethemes.moe/dump/1",
    "created_at": "2026-03-01T00:00:00.000000Z",
    "updated_at": "2026-03-03T12:00:00.000000Z"
  }
}

Delete Dump

Permanently delete a dump record.
DELETE /api/admin/dump/{id}
Path Parameters:
  • id - The dump ID
This operation permanently deletes the dump record. It does not delete the actual file from storage.
Example Response:
{
  "message": "The Dump 'dumps/animethemes-2026-03-01.sql.gz' was deleted."
}

Downloading Dumps

To download a dump file, users can access the link URL provided in the dump record:
# Get the download link
curl -X GET https://api.animethemes.moe/api/admin/dump/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Download using the link
curl -O https://api.animethemes.moe/dump/1
The download route is publicly accessible for dumps marked as public: true.

Usage Examples

Register a New Monthly Dump

curl -X POST https://api.animethemes.moe/api/admin/dump \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "dumps/animethemes-2026-03-01.sql.gz",
    "public": true
  }'

Make a Dump Private

curl -X PUT https://api.animethemes.moe/api/admin/dump/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "public": false
  }'

List All Available Dumps

curl -X GET https://api.animethemes.moe/api/admin/dump \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Delete an Old Dump Record

curl -X DELETE https://api.animethemes.moe/api/admin/dump/5 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Dump Types

Database dumps typically come in different formats:
Complete snapshots of the entire database, usually generated monthly.Naming convention: animethemes-YYYY-MM-DD.sql.gzThese dumps contain all tables and data for a complete restore.
Dumps containing only changes since the last full dump.Useful for reducing file size and transfer time for regular backups.
Dumps of specific tables for targeted data exports.Example: animethemes-wiki-2026-03.sql.gz for wiki tables only.

Best Practices

Create dumps on a regular schedule (e.g., monthly) to ensure data is backed up consistently. Use automated scripts with the API to register new dumps.
Implement a retention policy to manage storage:
  • Keep last 12 monthly dumps
  • Keep last 4 weekly dumps
  • Delete dumps older than 1 year
Before registering a dump via the API, verify the dump file:
  • Check file integrity
  • Verify file size is reasonable
  • Test restoration in a development environment
Consider which dumps should be public:
  • Public: Anonymized datasets, historical data, community releases
  • Private: Recent dumps, dumps containing sensitive data, test dumps
Use consistent naming conventions for dump files:
  • Include date in ISO format (YYYY-MM-DD)
  • Include dump type (full, incremental, specific tables)
  • Use descriptive names: animethemes-full-2026-03-01.sql.gz

Creating Database Dumps

While this API manages dump records, the actual dump files are created using database tools:
# Create a MySQL dump (example)
mysqldump -u user -p database_name | gzip > dumps/animethemes-2026-03-03.sql.gz

# Register the dump via API
curl -X POST https://api.animethemes.moe/api/admin/dump \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "dumps/animethemes-2026-03-03.sql.gz",
    "public": true
  }'
The API manages dump metadata and download links. The actual dump file creation and storage is handled separately by database backup tools and storage systems.

Security Considerations

  • Always review dumps for sensitive data before making them public
  • Consider anonymizing user data in public dumps
  • Use secure transfer methods (HTTPS) for downloading dumps
  • Regularly audit who has access to dump endpoints
  • Delete dump records for files that no longer exist in storage

Database Dumps Guide

Comprehensive guide to database dumps

Storage Configuration

Configure dump file storage

Build docs developers (and LLMs) love