{"uid":"cap_XPHgud7jNuoVZgcriQ2WW","slug":"one-engine-text-truncate-ebff9601","name":"ONE Engine Text Truncate","description":"Low-cost pay-per-call utility APIs for autonomous agents using x402 on Base.","url":"https://one-search.one-engine.workers.dev/v1/text/truncate?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string"},"maxLength":{"type":"integer","maximum":50000,"minimum":0}}},"responseSchema":{"type":"json","example":{"text":"ONE En","truncated":true}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_YYXjmwEAcp_59jwFl5gSE","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Truncates a text string to a specified maximum character length, returning the shortened text and a flag indicating if truncation occurred.","exampleAgentPrompt":"Can you truncate this article summary to a maximum of 280 characters: 'Researchers at the University of California have announced a breakthrough in fusion energy that could revolutionize how the world generates electricity, promising virtually limitless clean power within the next two decades if funding continues at its current pace.'","exampleUseCases":[{"title":"Fit tweet-length content","prompt":"I need to cut this blog excerpt down to 280 characters for a social post — here it is: 'Our new product line combines cutting-edge materials science with ergonomic design principles honed over a decade of user research, resulting in tools that professional craftspeople say feel like natural extensions of their hands.'"},{"title":"Clip agent output for UI display","prompt":"Trim this AI-generated product description to 150 characters max so it fits in the card preview: 'Handcrafted from sustainably sourced oak with a water-resistant finish, this desk organizer keeps your workspace tidy while adding a touch of natural warmth to any office setting.'"},{"title":"Enforce database field length limit","prompt":"I need to make sure this user bio doesn't exceed 500 characters before saving it — can you truncate it? 'Born in Tokyo and raised across three continents, Sofia has spent the last fifteen years building open-source tools for climate scientists, winning two international awards and mentoring over two hundred early-career researchers worldwide.'"}],"resultDescription":"A JSON object containing the (possibly truncated) text string under the 'text' key, and a boolean 'truncated' field indicating whether the original text was shortened. If the original text was within the limit, 'truncated' is false and 'text' is unchanged.","failureModes":["Text exceeds server-side limits (maxLength capped at 50000 characters)","Invalid or missing 'text' field returns an error","maxLength below 0 or above 50000 rejected by schema validation","Payment failure via x402 protocol blocks the call","Non-string input for 'text' field causes validation error"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, deterministic string truncation with a clear boolean signal indicating whether truncation happened — especially in agentic pipelines where you want to enforce character limits programmatically without writing local code. At $0.001 USDC per call via x402, it's suitable for high-frequency use in autonomous workflows on Base. Prefer it over local truncation logic when your agent runtime lacks string manipulation utilities or you need a consistent, hosted utility callable across different agent environments.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T12:44:02.026Z","isFirstParty":false,"canonicalSlug":"one-engine-text-truncate-ebff9601"}