{"uid":"cap_D0ZOQJoiHLO21wqO6loK6","slug":"delx-commerce-string-truncation-api-b13f1f8a","name":"Delx Commerce — String Truncation API","description":"Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.","url":"https://commerce.delx.ai/api/v1/x402/string-trunc?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Input field: text."},"ellipsis":{"type":"string","description":"Input field: ellipsis."},"max_chars":{"type":"integer","description":"Input field: max chars."}}},"responseSchema":{"type":"json","example":{"ok":true,"result":"abcdefghi…","schema":"delx/util-string-trunc/v1","max_chars":10,"truncated":true,"original_chars":26}},"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_OyVvshzeonxsAVRMAb6AC","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 string to a specified maximum character length, optionally appending a custom ellipsis, and returns the result with metadata about the operation.","exampleAgentPrompt":"Can you truncate this text to 10 characters and add '…' at the end: 'Hello, this is a long string that needs clipping'?","exampleUseCases":[{"title":"Shorten product title for UI card","prompt":"I need to clip this product title to 50 characters with an ellipsis so it fits in our card component: 'Ultra Premium Noise Cancelling Wireless Bluetooth Headphones Pro Edition 2024'."},{"title":"Enforce tweet-preview character limit","prompt":"Trim this tweet preview text down to 140 characters and append '…' if it gets cut: 'Just launched our brand new product that helps developers build faster, smarter APIs with zero setup and instant results for their users everywhere.'"},{"title":"Prepare metadata description snippet","prompt":"Cut this SEO meta description to 160 characters max with a trailing ellipsis: 'Discover the best recipes for healthy living, including breakfasts, lunches, dinners, and snacks that are easy to make and loved by the whole family every day.'"}],"resultDescription":"Returns a JSON object with: ok (boolean success flag), result (the truncated string), schema identifier (delx/util-string-trunc/v1), max_chars (the limit applied), truncated (boolean indicating whether truncation occurred), and original_chars (original character count of the input text).","failureModes":["Missing required 'text' field returns validation error","Invalid 'max_chars' type (non-integer) causes request rejection","Payment failure via x402 if USDC balance is insufficient","Very large text inputs may hit platform size limits","Empty string input returns ok:true with truncated:false and result as empty string"],"whenToPreferThis":"Choose this endpoint when you need a simple, deterministic, pay-per-use string truncation with no API key or signup required — especially suited for AI agents that need to enforce character limits on dynamic content at runtime. Useful when truncation logic must be consistent, auditable, and verifiably executed rather than handled client-side.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:54:03.471Z","isFirstParty":false,"canonicalSlug":"delx-commerce-string-truncation-api-b13f1f8a"}