# Machine Shop – Clean Text

> Machine Shop – Clean Text is a paid API for AI agents from api.pay-forge.online, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-20).

Strips and normalizes whitespace/formatting from raw text, returning the cleaned version along with before/after character counts.

## Facts

- Endpoint: POST https://api.pay-forge.online/v1/clean-text?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/machine-shop-clean-text-712d5d1e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_WGs1vO6AW34ne5z40feuE

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability machine-shop-clean-text-712d5d1e -d '<json body>'
```

Example prompt: Can you clean up this text for me — it has a bunch of extra spaces, weird line breaks, and trailing whitespace — and tell me how many characters were removed? Here's the text: 'Hello   world  

  Next   line.  '

## When to prefer this

Choose this endpoint when you need a lightweight, cost-effective text normalization step before downstream processing such as field extraction, comparison, or analysis. It is ideal as a preprocessing stage in a pipeline where consistent whitespace and formatting matters. Prefer it over building custom regex cleaning logic when working within the Machine Shop ecosystem, especially when you want a character-count audit of what was removed.

## Known failure modes

- Input text exceeds 50000 Unicode characters — returns HTTP 413
- Malformed JSON body or missing 'text' field — likely 400 error
- Empty text input is valid and returns chars_before and chars_after both as 0 or equal
- Payment not provided or invalid x402 payment header — returns HTTP 402

## How this service works

Turn Apify product scrape results into safe catalog updates with Catalog Update Gate. Find evidence in supplied documents, compare snapshots, extract typed JSON fields, inspect x402 quotes and assess API migrations. Preview inputs, evidence and cost for free. No live web search, scheduled monitoring or third-party purchasing.

## Output

Returns a JSON object with the cleaned text string, the character count before cleaning (chars_before), and the character count after cleaning (chars_after), allowing callers to assess how much whitespace/formatting was removed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "title": "Text",
   "maxLength": 50000,
   "description": "Text to process, including empty text; at most 50000 Unicode characters (413 if exceeded)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "text": "Hello world\nNext line.",
  "chars_after": 22,
  "chars_before": 32
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/machine-shop-clean-text-712d5d1e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.pay-forge.online](https://www.zero.xyz/host/api.pay-forge.online/llms.txt)
