Numbers ordinal
Exactnumbers_ordinalDeterministic and authoritative — the canonical answer for this input.
Render an integer as an ordinal: 1 → '1st', 22 → '22nd', 113 → '113th'. Handles the 11–13 'th' exceptions correctly. Processing multiple inputs? Use `numbers_ordinal_batch` to do up to 1000 in one call.
Parameters
valuestringrequiredThe integer to render as an ordinal.
Call it
curl -X POST https://api.snipget.ai/v1/numbers/ordinal \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"value":"22"}'The Batch tab sends up to 1000 inputs in one call via /v1/numbers/ordinal/batch.
Example response
{
"input": "22",
"is_valid": true,
"output": "22nd"
}FAQ
Why do I need a tool for adding st, nd, rd, or th?
The teens are the trap: it is 11th, 12th, and 13th, not 11st, 12nd, 13rd, and the same exception repeats in every hundred (111th, 212th). This encodes the full rule so 22 becomes 22nd but 12 becomes 12th, every time.
Does it work for large numbers and negatives?
Yes. Any whole number works; the suffix follows the trailing digits (113th, 1022nd) and negatives keep their sign (-2 becomes -2nd).
Does it spell the ordinal out, like 'twenty-second'?
No. The output is the numeral plus suffix (22nd). numbers_to_words spells numbers out, but as cardinals ('twenty-two'); there is no spelled-out-ordinal tool today.
What happens with a decimal or non-numeric input?
Ordinals only exist for whole numbers, so '2.5' or 'twenty' comes back with confidence 0 and a reason rather than a guess or an error.