Documentation
Build with textportdocx
Integrate editorial-grade LaTeX ↔ Word conversion into your own app. Everything you need to install the SDK, authenticate requests, understand credit costs, and how the local WASM engine keeps files private.
SDK setup
Install once, run anywhere.The @texport/sdk package works in Node.js 18+, Vite, Next.js, Webpack, and modern browsers. It wraps the same engine used on this site.
npm install @texport/sdk
Quick example
import { convert } from '@texport/sdk'
const docx = await convert(texContent, {
apiKey: 'txp_your_key_here',
direction: 'tex-to-docx',
})
// Save the result
const blob = new Blob([docx.buffer], { type: docx.mimeType })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = docx.filename
a.click()Node.js / server
Use the node entry for file-system workflows.
Browser / CDN
Import from a CDN for static sites or demos.
import { convert } from '@texport/sdk/node'
import fs from 'node:fs/promises'
const source = await fs.readFile('./paper.tex', 'utf-8')
const result = await convert(source, {
apiKey: process.env.TEXPORT_API_KEY,
direction: 'tex-to-docx',
})
await fs.writeFile(result.filename, Buffer.from(result.buffer))<script type="module">
import { convert } from 'https://cdn.jsdelivr.net/npm/@texport/sdk/+esm'
const result = await convert(file, {
apiKey: 'txp_your_key_here',
})
</script>The SDK accepts a string, a File, or a Blob. For ZIP uploads, include the main .tex file plus any included images.
Authentication
API keys identify your account.Every SDK call must include a valid API key. Keys are managed from the Developer page. Keep your key secret — it is tied to your credit balance.
Key format
txp_<32-hex-chars>Server-side validation checks the SHA-256 hash of the full key. We never store the key itself in plain text.
const result = await convert(tex, {
apiKey: process.env.TEXPORT_API_KEY, // or window.env in the browser
direction: 'tex-to-docx',
})If the key is missing, revoked, or has no remaining credits, the SDK returns a typed error with a machine-readable code field.
Credit limits
LaTeX ↔ Word only.Credits are consumed only for LaTeX ↔ Word conversions. All other converters — PDF ↔ Word, image tools, and the LaTeX diagram renderer — are free and do not require credits.
1 credit
≈ 300 source words or 10 source pages.
Admin keys
Unlimited conversions, no credit checks.
How costs are calculated
- LaTeX → Word: cost is based on the source
.texword count before conversion. - Word → LaTeX: cost is based on the source
.docxword count. - ZIP uploads: only the main document counts; included images are free.
Pricing is configured by the site admin and may include volume packs or coupons. Buy credits from the Credits page.
Local WASM architecture
Files stay on-device.The core conversion engine is a custom build of Pandoc compiled to WebAssembly. It runs entirely inside your browser or server process. Your file contents are never uploaded to our infrastructure.
- 1Preprocess. The source is normalised: macros are expanded, unknown commands are safelisted, equations are tagged, and environments are mapped.
- 2AST conversion. Pandoc reads the normalised LaTeX into an internal abstract syntax tree, then writes it back as OOXML for Word.
- 3Post-formatting. Native Word XML is injected for colours, highlights, boxed math, table shading, floats, and theorem environments.
- 4Verification. The generated DOCX is re-read to catch structural issues. If problems are found, the engine retries with a remediation pass.
Server touches only metadata
The only server calls are: (1) validating your API key, (2) deducting credits, and (3) optional TikZ figure rendering when you enable it. The actual document bytes never leave the client.
Agent integrations (MCP)
Connect an AI assistant.textportdocx exposes an MCP server so Claude, ChatGPT, and other assistants can act on your behalf. Connect it from your assistant's custom connector settings using the server URL shown on the Developer page.
Available tools
- convert_latex_to_docx — Start a LaTeX → Word conversion. Returns a pre-flight report (packages, math, TikZ, issues) plus a one-time claim link that expires in 30 minutes. Costs 1 credit, charged only on success. Max 2 MB of .tex.
- get_conversion_result — Poll a job and download the finished .docx via a signed, expiring URL (or inline for smaller files).
- get_account — Check your credit balance and account status.
- list_credit_transactions — View recent credit usage.
- list_payments — View purchase history.
How the agent path handles your files
An AI assistant can't reach the in-browser engine directly, so a file sent through MCP is stored briefly on our servers and you finish the conversion by opening the claim link in your browser while signed in. The stored source and the Word output are deleted within an hour of completion, and unclaimed jobs are dropped when the link expires. Conversions you start directly on textportdocx.in are unaffected — they still run entirely in your browser and upload nothing.
MCP tools authenticate as you through Supabase OAuth and respect the same credit balance and role permissions as the web app.
Limits & error handling
Know what to expect.File size
ZIP uploads are limited to ~50 MB. Single .tex files can be much larger because they stay in memory.
Packages
Most standard AMS, graphicx, and bibliography packages are supported. Exotic TikZ libraries may need the server render toggle.
Fonts
Word output uses standard Office fonts. Custom LaTeX fonts are mapped to the closest available family.
Errors
The SDK resolves with a result object that includes a fidelity score, warnings array, and raw engine log.
const result = await convert(tex, { apiKey })
console.log(result.fidelity.score) // 0–100
console.log(result.fidelity.warnings) // [{ kind, message, line }]
console.log(result.rawLog) // full engine outputFor the full compatibility matrix, see the Compatibility page.
