apyhub
DEVELOPER TOOLS

Text Comparison

What it does

Text Comparison lets you compare two text or code snippets and pass in a comparison mode of char, word, or line. Send text1 and text2, and use the mode that matches the level of detail you need for your diff workflow.

Use it when you need to check changes between draft revisions, review code snippets, or spot line-level edits in generated content. Because the input is just two strings plus an optional mode, it fits well into editors, CI checks, review tools, and automation that needs a simple before/after comparison step.

The request schema is intentionally small: text1 and text2 are required, and mode is optional. The endpoint returns an empty response schema, so treat it as a comparison action rather than a structured data source. That makes Text Comparison useful as a lightweight utility for detecting differences without adding parsing overhead.

POST
Compare two text or code snippets
https://api.eu.apyverse.com/apyhub/compare-text

QUICKSTART

GUIDE

Quickstart

Compare two text snippets by sending them as JSON in the request body.

curl -X POST "https://api.eu.apyverse.com/apyhub/compare-text" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text1":"Hello","text2":"Jello","mode":"char"}'

What you'll get back

{
  "data": {
    "mode": "char",
    "diffs": [
      {
        "op": "delete",
        "text": "h"
      },
      {
        "op": "insert",
        "text": "j"
      },
      {
        "op": "equal",
        "text": "ello"
      }
    ],
    "stats": {
      "additions": 1,
      "deletions": 1,
      "unchanged": 4
    }
  }
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Compares two text or code snippets sent in the request body. The endpoint’s response schema is not yet defined, so the exact success payload is not documented here.

Request Body

ParameterTypeMandatoryDescription
modeENUMNoComparison mode. Allowed values: char, word, line. Default: word.
text1StringYesFirst text or code snippet to compare.
text2StringYesSecond text or code snippet to compare.

Response

ParameterTypeMandatoryDescription
dataObjectNoContains the details of difference in text

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.