
Text Manipulator API
Content
Transform text with powerful editing tools. Convert case, format, clean data, find/replace, and process text in bulk with one-click operations.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
2 endpoints available
Overview
Apply one text operation and get the result in output, with word, character and line counts
of the output in stats. Fields are returned at the top level of the response.
Operations
uppercase: UPPERCASElowercase: lowercasetitle_case: Capitalize the first letter of each word, lowercase the restsentence_case: Lowercase everything, then capitalize the first letter of each sentencereverse_text: Reverse the charactersalternating_case: aLtErNaTiNg caserandom_case: Random upper/lower case per letterduplicate_text: Repeat the text options.times times, separated by a blank lineremove_empty_lines: Drop blank linesremove_duplicate_lines: Keep the first copy of each linesort_lines: Sort lines by character code (uppercase sorts before lowercase)reverse_lines: Reverse line orderbullet_list: Prefix each non-empty line with a bulletnumbered_list: Number each non-empty lineremove_extra_whitespace: Collapse all whitespace, including line breaks, to single spaces and trimremove_leading_whitespace: Trim the start of each line (blank lines are dropped too)remove_trailing_whitespace: Trim the end of each line (blank lines are dropped too)remove_all_whitespace: Remove every whitespace characterremove_double_newlines: Replace blank-line gaps with a single line breakremove_newlines: Join everything into one line, collapsing whitespaceremove_numbers: Remove digitsremove_special_characters: Keep only A-Z, a-z, 0-9 and whitespace (accented letters are removed)remove_punctuation: Remove these characters: . , / # ! $ % ^ & * ; : { } = - _ ` ~ ( )escape_html: Escape & < > " ' and / as HTML entitiesunescape_html: Turn the six entities escape_html produces back into charactersbase64_encode: Encode as Base64 (UTF-8)base64_decode: Decode Base64 to UTF-8 textwrap_text: Wrap lines at options.wrapWidth charactersfind_replace: Replace every match of options.find (plain text)find_replace_regex: Replace every match of options.find (regular expression)
Notes
textcan be up to 100,000 characters.duplicate_textoutput is capped at 1,000,000 characters.- Find/replace matches every occurrence and is case-insensitive unless
options.caseSensitiveis true.options.findis required for both find/replace operations. - For
find_replace_regex,options.replacecan use$1,$2for groups. An invalid pattern returns 400, and so does a pattern that takes more than 2 seconds to run. - Other options are ignored by operations that do not use them.
- A GET request (with your API key) returns
availableOperationsand a short usage summary.
Endpoints
POST
https://opentools.ca/api/v1/tools/text-manipulatorApply a text operation
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Required | The text to change (1 to 100,000 characters). |
| operation | string Enum: uppercase, lowercase, title_case, sentence_case, reverse_text, alternating_case, random_case, duplicate_text, remove_empty_lines, remove_duplicate_lines, sort_lines, reverse_lines, bullet_list, numbered_list, remove_extra_whitespace, remove_leading_whitespace, remove_trailing_whitespace, remove_all_whitespace, remove_double_newlines, remove_newlines, remove_numbers, remove_special_characters, remove_punctuation, escape_html, unescape_html, base64_encode, base64_decode, wrap_text, find_replace, find_replace_regex | Required | The operation to apply. See the list above. |
| options.find | string | Optional | Text or regex to find (max 1,000 characters). Required for find_replace and find_replace_regex. |
| options.replace | string | Optional | Replacement text (max 10,000 characters). Used by find_replace and find_replace_regex.Default: "" |
| options.caseSensitive | boolean | Optional | Match case when finding. Used by find_replace and find_replace_regex.Default: false |
| options.wrapWidth | number | Optional | Line width for wrap_text, 1 to 1000.Default: 80 |
| options.times | number | Optional | How many copies duplicate_text makes, 1 to 100.Default: 2 |
Response Example
{
"success": true,
"output": "HELLO WORLD",
"stats": {
"wordCount": 2,
"charCount": 11,
"lineCount": 1
}
}Error Codes
400
Invalid request. Validation problems are listed in details.401
Missing or invalid API key403
API key is deactivated or expired, or this IP address is not allowed for the key429
Rate limit exceeded (120 requests per minute per key)500
Internal server errorGET
https://opentools.ca/api/v1/tools/text-manipulatorList the supported operations and the POST body
Response Example
{
"success": true,
"availableOperations": [
"uppercase",
"lowercase",
"title_case",
"...",
"find_replace",
"find_replace_regex"
],
"usage": {
"method": "POST",
"body": {
"text": "string (required)",
"operation": "string (required) - one of availableOperations",
"options": {
"find": "string (for find_replace operations)",
"replace": "string (for find_replace operations)",
"caseSensitive": "boolean (default: false)",
"wrapWidth": "number (for wrap_text, default: 80)",
"times": "number (for duplicate_text, default: 2)"
}
}
}
}Error Codes
401
Missing or invalid API key403
API key is deactivated or expired, or this IP address is not allowed for the key429
Rate limit exceeded (120 requests per minute per key)Code Examples
# Uppercase
curl -X POST https://opentools.ca/api/v1/tools/text-manipulator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "hello world", "operation": "uppercase"}'
# Find and replace
curl -X POST https://opentools.ca/api/v1/tools/text-manipulator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "I like cats. Cats are great.", "operation": "find_replace", "options": {"find": "cats", "replace": "dogs"}}'Rather use it in your browser? Open the Text Manipulator