Catalog/text-indent

Text

Indent / dedent text API

Adds a leading indent to every line or removes the common leading whitespace (dedent) across all lines. Answers 'how do I indent this block by N spaces?', 'how do I strip the common indentation from a snippet?'.

Price$0.01per request
MethodPOST
Route/v1/text/indent
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
textindentdedentwhitespaceformattingcodeblockreindent
API URLhttps://x402.hexl.dev/v1/text/indent
Integration docs
Example request
{
  "text": "line1\nline2",
  "spaces": 4
}
Example response
{
  "result": "    line1\n    line2",
  "mode": "indent",
  "added": 4
}
Input schema
{
  "type": "object",
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "type": "string",
      "examples": [
        "line1\nline2"
      ]
    },
    "spaces": {
      "type": "number",
      "examples": [
        4
      ]
    },
    "mode": {
      "type": "string",
      "enum": [
        "indent",
        "dedent"
      ],
      "examples": [
        "indent"
      ]
    },
    "char": {
      "type": "string"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}