apyhub
DEVELOPER TOOLS

Text Distance Search API

Hosted on ApyHub

What it does

Text Distance Search computes the Levenshtein edit distance between two strings. Send a source string and a target string, and get back a single integer in data showing how many insertions, deletions, or substitutions are needed to turn one into the other.

Use Text Distance Search when you need fuzzy matching or similarity scoring for user-entered text. It’s a practical fit for deduplicating names, catching typos in search queries, comparing product titles, or ranking candidate matches when exact string equality is too strict.

The request body is minimal: source and target. The response is equally direct: data contains the edit distance as an integer. If you are building search, validation, or cleanup workflows, this gives you a simple distance metric you can use to sort, filter, or threshold string comparisons.

Because the output is just the distance value, it is easy to plug into existing logic without mapping extra metadata or parsing a complex structure.

POST
Compute Levenshtein distance
http://localhost:8080/apyhub/text-distance-search
QUICKSTARTGUIDE

Quickstart

Compare two strings by sending them as JSON and get back their edit distance.

curl -X POST "http://localhost:8080/apyhub/text-distance-search" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"source":"kitten","target":"sitting"}'

What you'll get back

Returns a JSON object with a data integer field — the Levenshtein edit distance between source and target (for example, kittensitting returns 3).

{
  "data": 3
}
TRY ITLIVE · 25 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*
First string to compare.
Second string to compare.

About this endpoint

What it does

Computes the Levenshtein edit distance between two input strings and returns the distance as an integer.

Request Body

ParameterTypeMandatoryDescription
sourceStringYesFirst string to compare.
targetStringYesSecond string to compare.

Response

Returns a JSON object with a data integer field containing the Levenshtein edit distance between source and target.

ParameterTypeMandatoryDescription
dataIntegerYesLevenshtein edit distance between the two input strings.

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.