NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

Line Sorter API

POST

Alphabetize any text list in ascending or descending order.

Line Sorter organizes text by sorting lines alphabetically in ascending or descending order with case-sensitive options.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/linesorter
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "sorted": [
      "An apple a day keeps the doctor away",
      "banana",
      "Cherry blossoms bloom in spring",
      "date",
      "The quick brown fox jumps over the lazy dog"
    ],
    "lineCount": 5,
    "order": "asc",
    "caseSensitive": false
  }
}

About the Line Sorter API

A line sorter API for putting lists in order without writing sort code. Send an array of text lines and get them back sorted, with control over direction and whether capital letters are treated differently from lowercase. Use it as a text sorter to sort any list alphabetically, A to Z or Z to A.

It suits cleaning up exported lists, alphabetizing names, tags, product titles or glossary terms, normalizing config and data files before diffing them, and sorting user-pasted lists in no-code tools and spreadsheets that lack a reliable alphabetical sort. By default the sort ignores case, so "apple", "Banana" and "cherry" come back in the order a reader expects.

The response returns the sorted lines, how many lines were sorted, and the order and case setting that were applied, so a workflow can confirm what it got. Every field is available on every plan, including the Free plan.

How it works

Line Sorter sorts the strings in lines and returns them as sorted. Every entry must be a string; a number, boolean or object anywhere in the array returns a 400 error that names the index of the first bad entry. Lines are not trimmed or split, and duplicates stay in the output unless unique is true, so leading spaces affect where a line lands. Set natural to true for numeric-aware order (item1, item2, item10 instead of item1, item10, item2); it uses locale collation in both case modes.

order is asc (the default) or desc. With caseSensitive false (the default) both lines are lowercased and compared with locale-aware collation, which places accented letters next to their base letters and orders digits before letters, giving a natural dictionary order. Lines that differ only in case keep their relative order.

With caseSensitive true the comparison switches to raw UTF-16 code-unit order. In that mode every uppercase ASCII letter sorts before every lowercase one, so ["b", "a", "C"] becomes ["C", "a", "b"], and accented letters sort after "z". Use it when you need a byte-style order that matches other tools, and the default when people will read the result.

lineCount is the number of lines returned (the number received unless unique dropped duplicates), order echoes the direction applied and caseSensitive is the boolean that was actually used; it accepts true, false or the strings "true" and "false". desc is the exact reverse comparison of asc in both modes. The response is identical on every plan.

What people use it for

List Organization
Sort and organize lists alphabetically for better readability and data management
Data Cleanup
Clean up and alphabetize data files with customizable sorting options
Content Sorting
Sort text content with case-sensitive or case-insensitive options
File Processing
Process and organize large text files with up to 10,000 lines

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use Line Sorter

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the Line Sorter API.

Read the docs →
Why does item10 sort before item2, and how do I fix it?
The default order compares text character by character, so 1 in item10 comes before 2. Set natural=true and runs of digits compare as numbers, giving item1, item2, item10. Set unique=true to drop duplicate lines at the same time; duplicatesRemoved reports how many were dropped.
What is the maximum number of lines I can sort in a single request?
You can submit up to 10,000 lines per call. If you need to sort files or lists larger than 10,000 lines, divide your data into separate batches across multiple requests.
Can I sort lines in reverse alphabetical order?
Yes. Line Sorter supports both ascending and descending order, allowing you to organize text from Z to A as easily as A to Z.
Can I ignore capitalization when alphabetizing text?
Yes. Disabling case sensitivity sorts lines purely alphabetically without letting capital letters take precedence over lowercase letters. Enabling it preserves strict case distinction in the output.
Does the response confirm how many lines were processed?
Yes. Line Sorter returns the total line count alongside the sorted text and the applied sort order, making it straightforward to verify that all lines were accounted for.
Which plan fits sorting 50,000 lists a month?
The Starter plan easily covers this volume. At 1 credit per call, sorting 50,000 lists uses 50,000 credits, which is a quarter of Starter's 200,000 monthly credits. That works out to about $0.15 per 1,000 calls. The Free plan includes 200 calls per month for testing.

Ready to build with Line Sorter? Start with 200 free credits — one key unlocks all 404+ APIs.

Explore the catalog

404+ APIs on the same key and the same response shape.

Browse all APIs