Alethia - Docs

Schemas

JSON schema reference for request and response data

Data Schemas

This page documents the JSON structures used throughout the Alethia Host API. Use these as a reference when implementing your host in any language.


Slugs

Slugs are unique identifier strings used throughout the API to distinguish resources and build URLs for fetching data. They appear in endpoint paths (:mangaSlug, :chapterSlug) and in response payloads.

Slug Types

TypeExampleUsed In
Source slugmangadexGET /:source, POST /:source/search
Manga slugone-piece-abc123GET /:source/:mangaSlug
Chapter slugchapter-1100-enGET /:source/:mangaSlug/chapters/:chapterSlug
Tag slugactionfilters.includeTag, filters.excludeTag

Guidelines

  • Keep them stable — Slugs should not change over time. If the upstream resource ID is stable, derive slugs deterministically from it.
  • Make them deterministic — Given the same upstream resource, always generate the same slug. This ensures consistency across requests and caching.
  • Use meaningful identifiers — Where possible, include human-readable context (e.g., one-piece-abc123 rather than just abc123).

URL Safety

Slugs used in endpoint paths (:mangaSlug, :chapterSlug) must be URL-safe. Avoid spaces, special characters, and non-ASCII characters. Stick to lowercase alphanumeric characters, hyphens, and underscores. If upstream IDs contain unsafe characters, encode or transform them.


Core Definitions

Entry

A search result entry containing minimal information for display in lists. This is a lightweight object used in search results.

{
  "slug": "one-piece",
  "title": "One Piece",
  "cover": "https://example.com/covers/one-piece.jpg"
}
FieldTypeRequiredDescription
slugstringYesUnique identifier used in URLs to fetch details (see Slugs)
titlestringYesDisplay title
coverstring | nullYesURL to cover image (can be null if no cover available)

Minimal Data

Entry is intentionally minimal to keep search responses lightweight. Full metadata (tags, classification, etc.) is fetched via the manga details endpoint upon actual request.


Manga

General Content Object

Despite terminology used as "Manga" here and spread elsewhere in these docs - this is a general content object representing any serialized work (manga, manhwa, webtoon, novel, etc.) depending on the source.

Full manga details returned by the GET /:source/:mangaSlug endpoint.

{
  "slug": "one-piece",
  "url": "https://mangadex.org/title/a1c7c817-4e59-43b7-9365-09675a149a6f",
  "title": "One Piece",
  "alternativeTitles": ["ワンピース", "OP", "海贼王"],
  "authors": ["Oda Eiichiro"],
  "synopsis": "Gol D. Roger, a man referred to as the \"Pirate King,\" is set to be executed by the World Government...",
  "covers": [
    "https://example.com/covers/one-piece-vol1.jpg",
    "https://example.com/covers/one-piece-vol2.jpg"
  ],
  "tags": ["action", "adventure", "comedy", "fantasy"],
  "classification": "Safe",
  "publication": "Ongoing",
  "createdAt": "2020-01-15T10:30:00Z",
  "updatedAt": "2024-12-01T08:00:00Z"
}
FieldTypeRequiredDescription
slugstringYesUnique identifier (matches URL parameter, see Slugs)
urlstringYesURL to the manga on the upstream source
titlestringYesPrimary display title (defaults to "Unknown Title")
alternativeTitlesstring[]YesOther titles (translations, abbreviations). Can be empty array.
authorsstring[]YesList of author names. Can be empty array.
synopsisstringYesDescription/summary (defaults to "No Description.")
coversstring[]YesCover image URLs. Can be empty array.
tagsstring[]YesArray of tag slugs (strings, not full tag objects)
classificationClassificationYesContent rating
publicationPublicationYesPublication status
createdAtstringYesISO 8601 timestamp of when the manga was added
updatedAtstringYesISO 8601 timestamp of last update

Chapter

Chapter metadata returned by the GET /:source/:mangaSlug/chapters endpoint.

{
  "slug": "en-chapter-1100-abc123",
  "url": "https://mangadex.org/chapter/abc123",
  "title": "Chapter 1100: My Dear Hero",
  "number": 1100,
  "date": "2024-01-15T12:00:00Z",
  "language": "en",
  "scanlator": "TCB Scans"
}
FieldTypeRequiredDescription
slugstringYesUnique identifier for the chapter (used to fetch pages, see Slugs)
urlstringYesURL to the chapter on the upstream source
titlestringYesChapter title for display (defaults to "No Title")
numbernumberYesChapter number (ideally unique, must be >= 0)
datestringYesISO 8601 timestamp of release/upload date
languagestringYesLanguage code in ISO 639-1 format (e.g., en, ja, pt-br)
scanlatorstringYesScanlation group name (defaults to "Unknown Scanlator")

Chapter Numbers

The number field should be a numeric value for proper sorting. For special chapters (e.g., "Chapter 100.5"), use decimal values like 100.5. For non-numeric chapters (e.g., "Oneshot"), use 0 or another appropriate value.

Chapter Deduplication

When multiple chapters share the same number (e.g., different scanlators or languages), the client displays only one version per number based on user-configured source and scanlator priorities (unified chapter list). To avoid confusion, aim for unique chapter numbers where possible. If duplicates are unavoidable, ensure the scanlator and language fields are accurate, or the titles are well-defined to distinguish easier.


Tag

Tag information used in source configuration. Tags define the available genres/categories users can filter by.

{
  "slug": "action",
  "name": "Action",
  "nsfw": false
}
FieldTypeRequiredDescription
slugstringYesUnique identifier (used in filters and manga tags array, see Slugs)
namestringYesDisplay name (1-50 characters)
nsfwbooleanYesWhether this tag indicates NSFW content (defaults to false)

Tags in Context

Tags appear in two places: as full objects in source configuration (search.tags), and as slug strings in manga details (tags: ["action", "adventure"]).


Enumerations

These are the allowed string values for enumerated fields.

Notice

Values defined here are in PascalCase.

Classification

Content rating classification for manga.

ValueDescription
UnknownClassification not determined
SafeAppropriate for all ages
SuggestiveMay contain mild sexual content or themes
ExplicitContains explicit content
PornographicContains pornographic content

Publication

Publication status of a manga. This indicates whether the manga is still being released.

ValueDescription
UnknownStatus cannot be determined
OngoingCurrently being published
CompletedPublication finished
CancelledPermanently discontinued
HiatusOn temporary break

Sort Options

Standard sort option values. Sources declare which ones they support in their search.sort configuration array.

About Sort Options

The below list is quite generic and may not all be supported by every source. I don't believe adding new ones will be truly beneficial unless otherwise desired, as typically whatever these 'new' sorting options are would likely be extremely niche or can fall under an existing sorting category. Please get in contact otherwise if you have a specific use case in mind.

ValueDescription
relevanceSearch relevance (only meaningful with a query)
latestRecently updated
titleAlphabetical by title
popularityMost popular
ratingHighest rated
chaptersNumber of chapters
yearPublication year
viewsView count
followsFollower/subscriber count
createdAtDate added (unstable reference for when a series was actually created, don't depend on this)
updatedAtLast updated

Filter Options

About Filter Options

The below list is quite generic and may not all be supported by every source. I don't believe adding new ones will be truly beneficial unless otherwise desired, as typically whatever these 'new' filter options are would likely be extremely niche or can fall under an existing filtering category. Please get in contact otherwise if you have a specific use case in mind.

Standard filter keys. These are defined capabilities that a source would be able to perform and should be declared in the search.filters configuration array.

KeyValue TypeDescription
genrestring[]Filter by genre slugs
statusstring[]Filter by publication status values
contentRatingstring[]Filter by classification values
yearnumberPublication year
originalLanguagestring[]Filter by original language codes
translatedLanguagestring[]Filter by available translation languages
authorstringFilter by author name
artiststringFilter by artist name
includeTagstring[]Include manga with these tag slugs
excludeTagstring[]Exclude manga with these tag slugs
demographicstring[]Filter by demographic (shounen, seinen, etc.)
publisherstringFilter by publisher name
minChaptersnumberMinimum number of chapters

API Request/Response Schemas

This section expands on the request and response formats for each endpoint. See Endpoints for full endpoint documentation.

Search Request

POST body for the POST /:source/search endpoint.

{
  "query": "one piece",
  "page": 1,
  "limit": 20,
  "sort": "relevance",
  "direction": "desc",
  "filters": {
    "status": ["Ongoing", "Completed"],
    "contentRating": ["Safe", "Suggestive"],
    "includeTag": ["action"],
    "excludeTag": ["romance"]
  }
}
FieldTypeRequiredDefaultDescription
querystringNo""Search query text
pagenumberYesPage number (1-indexed)
limitnumberNo20Results per page (max: 100)
sortstringYesSort option from source's supported list
directionstringNo"desc"Sort direction: asc or desc
filtersobjectNo{}Filter key-value pairs

Search Response

Response from the POST /:source/search endpoint.

{
  "results": [
    {
      "slug": "one-piece",
      "title": "One Piece",
      "cover": "https://..."
    }
  ],
  "page": 1,
  "more": true
}
FieldTypeDescription
resultsEntry[]Array of matching entries
pagenumberCurrent page number
morebooleantrue if more results exist on the next page

Auth Request

POST body for the POST /:source/authenticate endpoint. Fields depend on the source's auth.fields configuration.

Basic/Session auth:

{
  "username": "user@example.com",
  "password": "password123"
}

API Key auth:

{
  "apiKey": "sk-abc123def456"
}

Bearer auth:

{
  "token": "eyJhbGciOiJIUzI1NiIs..."
}

Cookie auth:

{
  "cookie": "session=abc123; cf_clearance=xyz789"
}

Auth Response

Response from the POST /:source/authenticate endpoint.

Success:

{
  "success": true,
  "headers": {
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIs...",
    "Cookie": "session=abc123"
  }
}

Failure:

{
  "success": false,
  "error": {
    "code": "INVALID_CREDENTIALS",
    "message": "Invalid username or password"
  }
}
FieldTypeDescription
successbooleanWhether authentication succeeded
headersobjectHeaders to include in authenticated requests (success only)
errorobjectError details (failure only)
error.codestringMachine-readable error code
error.messagestringHuman-readable error message

Ping Response

Response from the GET /:source/ping endpoint.

{
  "status": "ok",
  "latencyMs": 150
}
FieldTypeDescription
statusstringok if upstream is reachable, down otherwise
latencyMsnumberRound-trip time in milliseconds
errorstringError message (only present when status is down)

Configuration Schemas

Host

Response from the GET / endpoint.

{
  "name": "myhost",
  "author": "developer",
  "repository": "https://github.com/developer/myhost",
  "version": "1.0.0",
  "hash": "abc123def456",
  "sources": ["mangadex"],
  "manifest": {
    "mangadex": {
      "version": "1.0.0",
      "hash": "xyz789",
      "status": "active"
    }
  }
}
FieldTypeDescription
namestringHost name (lowercase a-z only, 2-50 characters)
authorstringHost maintainer (lowercase a-z only, 2-50 characters)
repositorystringURL to source code repository
versionstringSemantic version (e.g., 1.0.0)
hashstringContent hash for change detection
sourcesstring[]Array of available source slugs
manifestobjectPer-source metadata

Source

Response from the GET /:source endpoint.

{
  "name": "MangaDex",
  "slug": "mangadex",
  "icon": "https://example.com/mangadex-icon.png",
  "languages": ["en", "ja"],
  "nsfw": false,
  "url": "https://mangadex.org",
  "referer": "https://mangadex.org",
  "auth": {
    "type": "none",
    "required": false
  },
  "search": {
    "sort": ["relevance", "latest", "popularity"],
    "filters": ["status", "contentRating", "includeTag", "excludeTag"],
    "tags": [
      { "slug": "action", "name": "Action", "nsfw": false }
    ]
  },
  "presets": [
    {
      "name": "Latest Updates",
      "description": "Recently updated manga",
      "request": {
        "query": "",
        "page": 1,
        "limit": 20,
        "sort": "latest",
        "direction": "desc"
      }
    }
  ],
  "version": "1.0.0",
  "hash": "abc123",
  "updatedAt": "2025-01-01T00:00:00Z"
}
FieldTypeDescription
namestringDisplay name (2-50 characters)
slugstringUnique identifier (lowercase a-z only)
iconstringURL to source icon
languagesstring[]Supported language codes (at least one required)
nsfwbooleanWhether source contains NSFW content by default
urlstringBase URL of upstream source
refererstringReferer header for image requests (defaults to empty)
authobjectAuthentication configuration
searchobjectSearch capabilities (sort, filters, tags)
presetsarrayPredefined search configurations
versionstringSemantic version
hashstringContent hash for change detection
updatedAtstringISO 8601 timestamp of last update

Error Response

Standard error response format used across all endpoints.

{
  "error": {
    "code": "MANGA_NOT_FOUND",
    "message": "The requested manga could not be found"
  }
}
FieldTypeDescription
error.codestringMachine-readable error code (SCREAMING_SNAKE_CASE)
error.messagestringHuman-readable error description

Common Error Codes

CodeHTTP StatusDescription
NOT_FOUND404Resource not found
MANGA_NOT_FOUND404Manga does not exist
CHAPTER_NOT_FOUND404Chapter does not exist
SOURCE_NOT_FOUND404Source slug is invalid
INVALID_REQUEST400Request body is malformed
MISSING_FIELDS400Required fields not provided
INVALID_CREDENTIALS401Authentication failed
RATE_LIMITED429Too many requests
UPSTREAM_ERROR502Upstream source returned an error
UPSTREAM_TIMEOUT504Upstream source did not respond

On this page