{"openapi":"3.1.0","info":{"title":"Truncate API","version":"1.0.0","description":"Truncate text cleanly. Cut a string to a maximum number of characters — at the end, the start or the middle — breaking on word boundaries so words are never chopped in half, and adding an ellipsis (which counts toward the limit). Middle truncation keeps the start and end and elides the centre, ideal for long file paths and IDs. A words endpoint trims to a number of whole words instead. Everything is emoji- and Unicode-safe (it counts code points, not bytes), so multi-byte characters and emoji are never split. Perfect for previews and teasers, table cells and cards, meta descriptions, breadcrumbs and CLI output. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. Distinct from word wrapping, case conversion and text statistics.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/truncate-api","description":"oanor gateway"}],"tags":[{"name":"Truncate"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/truncate":{"get":{"operationId":"get_v1_truncate","tags":["Truncate"],"summary":"Truncate by characters","description":"","parameters":[{"name":"text","in":"query","required":true,"description":"Text to truncate","schema":{"type":"string"},"example":"The quick brown fox jumps over the lazy dog"},{"name":"length","in":"query","required":false,"description":"Max characters (default 100)","schema":{"type":"string"},"example":"20"},{"name":"position","in":"query","required":false,"description":"end|start|middle (default end)","schema":{"type":"string"},"example":"end"},{"name":"ellipsis","in":"query","required":false,"description":"Ellipsis (default …)","schema":{"type":"string"}},{"name":"preserve_words","in":"query","required":false,"description":"true/false (default true)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"position":"end","truncated":"The quick brown…","was_truncated":true,"original_length":43,"truncated_length":16},"meta":{"timestamp":"2026-06-03T09:25:08.981Z","request_id":"4e7050c3-8df7-4283-a556-2d668d0af459"},"status":"ok","message":"Truncate by characters","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/words":{"get":{"operationId":"get_v1_words","tags":["Truncate"],"summary":"Truncate by words","description":"","parameters":[{"name":"text","in":"query","required":true,"description":"Text to truncate","schema":{"type":"string"},"example":"The quick brown fox jumps over the lazy dog"},{"name":"words","in":"query","required":false,"description":"Max words (default 20)","schema":{"type":"string"},"example":"5"},{"name":"ellipsis","in":"query","required":false,"description":"Ellipsis (default …)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"truncated":"The quick brown fox jumps…","was_truncated":true,"original_words":9,"truncated_words":5},"meta":{"timestamp":"2026-06-03T09:25:09.085Z","request_id":"538a81ed-ea17-4085-8a89-1031d76d25fa"},"status":"ok","message":"Truncate by words","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"name":"Truncate API","notes":"The ellipsis counts toward the character length. middle keeps the start and end and elides the centre (handy for long paths/IDs). Nothing is stored.","version":"v1","endpoints":[{"path":"/v1/truncate","params":{"text":"the text (required)","length":"max characters (default 100)","ellipsis":"default …","position":"end|start|middle","preserve_words":"true/false (default true)"},"returns":"the truncated text"},{"path":"/v1/words","params":{"text":"the text (required)","words":"max words (default 20)","ellipsis":"default …"},"returns":"the text cut to N whole words"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"Truncate text cleanly. Cut to a maximum number of characters at the end, start or middle, breaking on word boundaries (so words are never chopped in half) and adding an ellipsis — or truncate to a number of whole words. Emoji-safe (counts code points, not bytes). Pure local, no key."},"meta":{"timestamp":"2026-06-03T09:25:09.191Z","request_id":"f2ba6b39-048d-4bd8-9aaa-225e2ad2f5b7"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":1205,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":245,"monthly_call_quota":10450,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2235,"monthly_call_quota":155500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6035,"monthly_call_quota":820000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/truncate-api"}