Text Manipulator

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: UPPERCASE
  • lowercase: lowercase
  • title_case: Capitalize the first letter of each word, lowercase the rest
  • sentence_case: Lowercase everything, then capitalize the first letter of each sentence
  • reverse_text: Reverse the characters
  • alternating_case: aLtErNaTiNg case
  • random_case: Random upper/lower case per letter
  • duplicate_text: Repeat the text options.times times, separated by a blank line
  • remove_empty_lines: Drop blank lines
  • remove_duplicate_lines: Keep the first copy of each line
  • sort_lines: Sort lines by character code (uppercase sorts before lowercase)
  • reverse_lines: Reverse line order
  • bullet_list: Prefix each non-empty line with a bullet
  • numbered_list: Number each non-empty line
  • remove_extra_whitespace: Collapse all whitespace, including line breaks, to single spaces and trim
  • remove_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 character
  • remove_double_newlines: Replace blank-line gaps with a single line break
  • remove_newlines: Join everything into one line, collapsing whitespace
  • remove_numbers: Remove digits
  • remove_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 entities
  • unescape_html: Turn the six entities escape_html produces back into characters
  • base64_encode: Encode as Base64 (UTF-8)
  • base64_decode: Decode Base64 to UTF-8 text
  • wrap_text: Wrap lines at options.wrapWidth characters
  • find_replace: Replace every match of options.find (plain text)
  • find_replace_regex: Replace every match of options.find (regular expression)

Notes

  • text can be up to 100,000 characters. duplicate_text output is capped at 1,000,000 characters.
  • Find/replace matches every occurrence and is case-insensitive unless options.caseSensitive is true. options.find is required for both find/replace operations.
  • For find_replace_regex, options.replace can use $1, $2 for 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 availableOperations and a short usage summary.

Endpoints

POST
https://opentools.ca/api/v1/tools/text-manipulator
Apply a text operation

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
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
OptionalText or regex to find (max 1,000 characters). Required for find_replace and find_replace_regex.
options.replace
string
OptionalReplacement text (max 10,000 characters). Used by find_replace and find_replace_regex.Default: ""
options.caseSensitive
boolean
OptionalMatch case when finding. Used by find_replace and find_replace_regex.Default: false
options.wrapWidth
number
OptionalLine width for wrap_text, 1 to 1000.Default: 80
options.times
number
OptionalHow 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 key
403
API key is deactivated or expired, or this IP address is not allowed for the key
429
Rate limit exceeded (120 requests per minute per key)
500
Internal server error
GET
https://opentools.ca/api/v1/tools/text-manipulator
List 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 key
403
API key is deactivated or expired, or this IP address is not allowed for the key
429
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"}}'

Ready to get started?

Create an API key to start using the Text Manipulator API.

Rather use it in your browser? Open the Text Manipulator