{"uid":"cap_WpS_BYIPKkyFZGwekjMoy","slug":"one-engine-text-clean-normalize-whitespace-9fb39d4e","name":"ONE Engine Text Clean & Normalize Whitespace","description":"Clean and normalize whitespace in text for downstream agent processing","url":"https://one-search.one-engine.workers.dev/v1/text/clean?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"mode":{"enum":["compact","preserve_lines"],"type":"string","description":"compact collapses whitespace; preserve_lines keeps paragraph boundaries"},"text":{"type":"string","description":"Text to clean"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0011","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0011/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0011","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0011","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_nF43djEtDuk8QOQLC0sI8","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0011","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Cleans and normalizes whitespace in text strings using either compact or preserve-lines mode for downstream agent processing","exampleAgentPrompt":"Clean up this text for me — collapse all the extra spaces and tabs into single spaces using compact mode: 'Hello   world,   this   is   a   test   string   with   weird   spacing.'","exampleUseCases":[{"title":"Normalize scraped web content","prompt":"I just scraped some text from a webpage and it has a ton of extra whitespace and weird spacing — can you clean it up in compact mode so it's ready for me to process further? Here's the text: 'Product   Description:    A   great   item   with   lots   of   features.    Buy   now!'"},{"title":"Preserve paragraph breaks in user content","prompt":"Can you clean up this user-submitted article without losing the paragraph breaks? Use preserve_lines mode so blank lines between paragraphs stay intact: 'This is paragraph one.   It has extra spaces.\n\nThis is paragraph two.    Also messy.'"},{"title":"Prep LLM prompt text for token efficiency","prompt":"Before I send this text to an LLM, I want to collapse all the redundant whitespace to save tokens — use compact mode to clean it: 'The    quick   brown    fox   jumps   over   the   lazy     dog   and   runs   away   fast.'"}],"resultDescription":"Returns the cleaned text string with whitespace normalized according to the specified mode: compact mode collapses all consecutive whitespace (spaces, tabs, newlines) into single spaces, while preserve_lines mode collapses inline whitespace but retains paragraph/line boundaries.","failureModes":["Missing 'text' field returns a validation error","Invalid 'mode' enum value returns a 400 bad request","Empty text string may return an empty result or validation error","Payment failure via x402 returns a 402 response requiring USDC on Base","Extremely large text inputs may be rejected or time out"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-call utility to normalize whitespace in text before downstream processing — especially in agent pipelines where clean, consistent spacing matters for tokenization, storage, or display. Prefer over custom regex solutions when you want a hosted, reliable microservice. Use compact mode for dense single-block output (e.g. LLM prompts, search indexing) and preserve_lines when paragraph structure matters (e.g. article formatting, user content).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T02:57:03.227Z","isFirstParty":false,"canonicalSlug":"one-engine-text-clean-normalize-whitespace-9fb39d4e"}