apyhub
DEVELOPER TOOLS

Best Match Text Search API

Hosted on ApyHub

What it does

Text Match Ranking compares a source string against a list of candidate strings and returns them ordered by Levenshtein distance. Send a source, a candidates array, and an optional limit; get back a data array of matches with their distance values.

Use it when you need to find the closest spelling, product name, or user-entered value without building your own fuzzy matching logic. The response is straightforward: each item includes the matched string and its edit distance from the source, so you can rank, filter, or display the best options in your app.

Because the service works on plain strings, it fits deduplication workflows, search suggestions, typo correction, and lightweight record linking. If you are normalizing incoming text or comparing one value against a short candidate list, Text Match Ranking gives you the nearest matches in a format that is easy to sort and consume.

POST
Best-match against candidates
http://localhost:8080/apyhub/best-match-text-search
QUICKSTARTGUIDE

Quickstart

Rank a list of candidate strings by how closely they match a source string.

curl -X POST "http://localhost:8080/apyhub/best-match-text-search" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "apple",
    "candidates": ["ape", "applet", "banana", "apply"]
  }'

What you'll get back

Returns a JSON object with a data array. Each item in data is an object with match as a string and distance as an integer, where distance is the Levenshtein distance from the source.

{
  "data": [
    { "match": "applet", "distance": 1 },
    { "match": "apply", "distance": 2 },
    { "match": "ape", "distance": 2 }
  ]
}
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*
Max results to return. 0 means all.
The reference string to match against.
candidates*
Candidate strings to rank.

About this endpoint

What it does

Ranks the provided candidate strings against a source string and returns the matches ordered by closeness. You send the source plus one or more candidates, and the response returns the ranked matches with their distances.

Request Body

ParameterTypeMandatoryDescription
sourceStringYesThe reference string to match against.
candidatesString ArrayYesCandidate strings to rank.
limitIntegerNoMax results to return. 0 means all. Minimum 0.

Response

Returns a JSON object with a data array field. Each item in data is an object with a match string and a distance integer, where distance is the Levenshtein distance from the source.

ParameterTypeMandatoryDescription
dataObject ArrayYesRanked match results. Each item contains match and distance.
data[].matchStringYesThe matching candidate string.
data[].distanceIntegerYesLevenshtein distance from the source.

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.