---
title: "XML Formatter"
method: POST
path: "/api/v1/tools/xml-formatter"
tags: ["tools"]
---

# XML Formatter

`POST /api/v1/tools/xml-formatter`

## Request

- Base URL: `https://toolforte.com`
- URL: `https://toolforte.com/api/v1/tools/xml-formatter`
- Auth: HTTP bearer

Pretty-print XML with consistent indentation, or minify it by removing the whitespace between tags. Elements that hold only text stay on one line, and comments, CDATA and processing instructions are kept. Malformed XML is reported with the line number rather than reshaped.

## Request body

- object
  - `xml` string
  - `mode` string
  - `indent` integer

## Response `200`

Successful result

- object
  - `ok` boolean
  - `data` object
    - `xml` string

## Other responses

- `400`: Missing or invalid request fields
- `401`: Invalid or missing API key
- `429`: Monthly plan limit reached

---

[API](https://skmtc.dev/toolforte/apis/toolforte-api.md) · [All operations](https://skmtc.dev/toolforte/apis/toolforte-api/llms.txt) · [OpenAPI document](https://skmtc.dev/toolforte/apis/toolforte-api/revisions/4d814d484dfc?raw)
