{"uid":"cap_Ukb2rEjBl-Irp-YQHk1-k","slug":"citation-locator-conversion-f680c611","name":"Citation Locator Conversion","description":"Convert half-open UTF-8 byte, UTF-16 code-unit, or Unicode code-point spans into all three units for supplied text. Reject offsets inside a code point. No PDF parsing, page inference, or external source lookup.","url":"https://www.mahastrategies.com/api/v1/micro/citation-locator-conversion?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["dataClass","sources","locators"],"properties":{"sources":{"type":"array","maxItems":16,"minItems":1},"locators":{"type":"array","maxItems":64,"minItems":1},"dataClass":{"enum":["public","synthetic"],"type":"string"}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["version","offerId","amountBaseUnits","inputDigest","result","boundaries","receiptDigest"],"properties":{"result":{"type":"object"},"offerId":{"enum":["citation-locator-conversion"],"type":"string"},"version":{"enum":["maha-microproducts/0.1"],"type":"string"},"boundaries":{"type":"array","maxItems":128,"minItems":0},"inputDigest":{"type":"string","maxLength":71},"receiptDigest":{"type":"string","maxLength":71},"amountBaseUnits":{"enum":["24000"],"type":"string"}},"additionalProperties":false}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.024","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","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.024/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.024","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.024","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_GA-MNWAm16-545MZts-Ak","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.024","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts text span offsets between UTF-8 byte positions, UTF-16 code-unit positions, and Unicode code-point positions, rejecting invalid mid-codepoint offsets.","exampleAgentPrompt":"I have a text snippet and a set of half-open spans in UTF-8 byte positions — can you convert those locators into all three formats: UTF-8 bytes, UTF-16 code units, and Unicode code points? The data class is synthetic.","exampleUseCases":[{"title":"NLP pipeline offset normalization","prompt":"My NLP model returns character spans as UTF-16 code-unit offsets, but my database stores UTF-8 byte positions. Can you convert these spans for the text 'Hello, 世界!' into all three offset formats so I can store them consistently? Data class is public."},{"title":"Citation validation in multilingual documents","prompt":"I need to verify that these citation locators I extracted from a multilingual document are valid — they shouldn't land in the middle of a code point. Please convert these UTF-8 byte spans for the source text into Unicode code-point and UTF-16 positions and flag any that are invalid. Mark the data as public."},{"title":"Cross-platform text annotation sync","prompt":"We have annotations stored as Unicode code-point spans but our front-end editor uses UTF-16. Can you convert these locator spans for this text into all three encoding formats so we can sync across both systems? Use synthetic data class since this is test data."}],"resultDescription":"Returns a result object containing converted offset spans in all three encoding formats (UTF-8 bytes, UTF-16 code units, Unicode code points) for each input locator, a boundaries array, an inputDigest, a receiptDigest, an offerId, a version, and an amountBaseUnits field. Invalid offsets that fall inside a code point are rejected with an error.","failureModes":["Offset falls inside a multi-byte code point — endpoint rejects the locator with an error","Input text is not valid UTF-8 — parsing fails","Locator array exceeds 64 items — request rejected","Sources array exceeds 16 items — request rejected","Invalid dataClass value — request rejected with schema validation error","Malformed body or missing required fields — 400-level error returned"],"whenToPreferThis":"Use this endpoint when you need to accurately convert text span offsets between UTF-8 byte positions, UTF-16 code-unit positions, and Unicode code-point positions, especially for multilingual or emoji-containing text where encoding boundaries differ. It is ideal for citation tracking, NLP annotation pipelines, and cross-platform text editor synchronization where encoding mismatches cause bugs. It does not do PDF parsing, page inference, or any external lookups — it is a pure, deterministic conversion utility.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-24T18:36:27.875Z","isFirstParty":false,"canonicalSlug":"citation-locator-conversion-f680c611"}