Skip to content
HALOWERK

Text Tools

epub toc spine inversions

EPUB reading-order comparison counts navigation document pairs reversed against a supplied spine. Use it when an agent needs checking a table of contents against the actual reading order.

POST https://text.halowerk.com/v1/epub-toc-spine-inversions

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
tocstringYes
spinearrayYes
Show full input schema
{
  "type": "object",
  "properties": {
    "toc": {
      "type": "string",
      "maxLength": 20000,
      "minLength": 1
    },
    "spine": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 250,
        "minLength": 1
      },
      "maxItems": 128,
      "minItems": 1
    }
  },
  "required": [
    "toc",
    "spine"
  ],
  "additionalProperties": false
}

Open original schema

Published input example

{
  "toc": "<ol><li><a href=\"text/halftitlepage.xhtml\">Moby Dick</a><ol><li><a href=\"text/chapter-1.xhtml\">I: Loomings</a></li><li><a href=\"text/chapter-2.xhtml\">II: The Carpetbag</a></li></ol></li></ol>",
  "spine": [
    "text/chapter-2.xhtml",
    "text/chapter-1.xhtml",
    "text/halftitlepage.xhtml"
  ]
}

Result & documentation

Show published result schema
{
  "type": "object",
  "required": [
    "measured_at",
    "source",
    "data",
    "limitations"
  ],
  "properties": {
    "measured_at": {
      "type": "string"
    },
    "source": {
      "type": "object",
      "required": [
        "reference",
        "retrieved_at"
      ],
      "properties": {
        "reference": {
          "type": "string"
        },
        "retrieved_at": {
          "type": "string"
        }
      }
    },
    "data": {
      "type": "object",
      "properties": {
        "matched_documents": {
          "type": "integer"
        },
        "reversed_pairs": {
          "type": "integer"
        },
        "first_reversed": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "matched_documents",
        "reversed_pairs",
        "first_reversed"
      ]
    },
    "limitations": {
      "type": "string"
    }
  }
}

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-12-05 UTC.

More endpoints in this hub

All endpoints in this hub →