{"uid":"cap_-o9-dlfLq7d4YhA2gEr_u","slug":"delx-commerce-truncate-middle-5bbe8318","name":"Delx Commerce — Truncate Middle","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/truncate-middle?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Input field: text."},"max_chars":{"type":"integer","description":"Input field: max chars."}}},"responseSchema":{"type":"json","example":{"text":"abcde…vwxyz","schema":"delx/util-truncate-middle/v1","max_chars":11,"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_MZGjSTqNhm1zXDoeVaCZv","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 maximum character length by removing characters from the middle and inserting an ellipsis, preserving the start and end.","exampleAgentPrompt":"Can you truncate this file path '/home/user/documents/projects/secret-project/final-report-v3.pdf' to a max of 40 characters using middle truncation so I can display it cleanly in a narrow column?","exampleUseCases":[{"title":"Displaying long file paths in UI","prompt":"I have a long file path like '/var/data/backups/2024/december/full-snapshot-encrypted.tar.gz' and I need to show it in a 50-character-wide table cell — can you truncate it from the middle so both the start and end are visible?"},{"title":"Shortening wallet addresses for display","prompt":"Shorten this Ethereum wallet address '0x71C7656EC7ab88b098defB751B7401B5f6d8976F' to 20 characters max, keeping the beginning and end visible with an ellipsis in the middle."},{"title":"Abbreviating long product names for labels","prompt":"I've got a product name 'Ultra-Premium Organic Cold-Pressed Extra Virgin Coconut Oil 500ml' that needs to fit in a 30-character label — truncate it from the middle so customers can still see the start and end."}],"resultDescription":"Returns a JSON object containing the truncated text string (with ellipsis inserted in the middle if truncation was needed), a boolean 'truncated' flag indicating whether truncation actually occurred, the applied max_chars value, and a schema identifier string.","failureModes":["Missing required 'text' field returns an error","Missing required 'max_chars' field returns an error","max_chars value too small to fit even the ellipsis may result in an error or unexpected output","Payment failure via x402 protocol returns 402 status before processing","Non-integer max_chars value may cause a validation error"],"whenToPreferThis":"Choose this endpoint when you need deterministic, rule-based middle truncation of a string — particularly for displaying long file paths, URLs, hashes, or identifiers in constrained UI spaces where both the beginning and end of the string carry meaningful information. It is preferable over custom code when you need a pay-per-call, no-signup micro-utility with verifiable delivery via x402 on Base or Solana.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T00:53:47.043Z","isFirstParty":false,"canonicalSlug":"delx-commerce-truncate-middle-5bbe8318"}