Skip to content
DocInfra

Document rewrite APIBeta

Rewrite documents through the API, not by hand.

The same job pipeline that converts documents also rewrites them: upload a DOCX, choose the register, receive a webhook, download the result. Built for products that generate or process documents at volume.

Implemented and in Beta: async DOCX rewrite jobs, available to any workspace with it enabled.

# Queue a document rewrite job

curl -X POST https://api.apidocinfra.com/v1/documents/rewrite \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: rewrite_123" \
  -F "[email protected]" \
  -F "mode=professional" \
  -F "protected_terms=DocInfra, ISO 27001"
# 202 {"job_id": "...", "status": "queued"}; GET /v1/jobs/{job_id} returns the DOCX download_url

Real endpoints and fields from the API contract. Replace the key and the file.

Designed as an API

  • One endpoint

    POST /v1/documents/rewrite takes the file and the same options as the text endpoint: mode, intensity, language, preserve, protected_terms.

  • Async with webhooks

    202 with a job; document.completed, document.failed and document.rejected events signed with your secret.

  • Idempotent

    Same file and options with the same Idempotency-Key return the same job. Different options with the same key are a 409.

  • Metered

    Words rewritten count in GET /v1/usage under document_rewrite, separate from text rewrites and conversions.

  • Fails safe

    If a protected element does not survive, the job fails with PRESERVATION_FAILED and nothing is delivered.

  • Same guarantees as the text API

    Versioned prompt, output checks, no text stored, provider behind an abstraction.

Integration in three calls

  1. 1

    Upload: multipart POST with file, options and an Idempotency-Key. Keep the job_id.

  2. 2

    Wait: poll GET /v1/jobs/{job_id} or handle the signed webhook.

  3. 3

    Download: follow download_url within five minutes; request a fresh one from the job at any time before the document expires.

Outputs are judged on naturalness and preserved facts, not on AI detectors.

Questions

Which formats?
DOCX in, DOCX out. HTML and PDF rewriting are not available.
What are the limits?
25 MB per file, 30,000 rewritable words per document, plus the plan and daily word budgets of the workspace.
What happens to the file?
Original and result stay in private storage for 24 hours, then they are deleted. The text is never logged.