Getting Started with the Reformat API

The Reformat API lets you format Word documents programmatically. You can integrate document formatting into your own workflows, automation scripts, or applications using standard HTTP requests.

Base URL

All API requests use the following base URL:

https://reformatword.com/api/v1

Authentication

Every request must include an API key in the Authorization header using the Bearer scheme:

Authorization: Bearer rf_sk_your_key_here

API keys are created on the Reformat website. See Managing API Keys for instructions on creating and revoking keys.

If the key is missing, invalid, or revoked, the API returns a 401 Unauthorized response.

Credits

API calls that process documents consume credits from your organisation’s balance — the same credits used by the Word add-in and the web interface. You can check your remaining balance at any time using the usage endpoint.

Request and Response Format

  • All responses return JSON with the following structure:
{
  "success": true,
  "requestId": "req_abc123",
  "data": { ... }
}
  • Error responses include an error code and message:
{
  "success": false,
  "requestId": "req_abc123",
  "error": {
    "code": "invalid_key",
    "message": "API key is invalid or revoked"
  }
}
  • Every response includes an X-Request-Id header. Include this ID when contacting support about a specific request.

Endpoints

Process a Document

Formats a Word document using a specified template. This is the main endpoint — it applies the template, runs optional checks, and returns the formatted document.

POST /api/v1/documents/process
Content-Type: multipart/form-data

Parameters (form data):

Parameter Type Required Description
document file Yes The .docx file to format (max 50 MB)
templateId string Yes The ID of the template to apply
checkRequirements string No "true" or "false" — run requirements check (default: true)
runFinalCheck string No "true" or "false" — run Final Draft Check (default: true)

Example request:

curl -X POST https://reformatword.com/api/v1/documents/process \
  -H "Authorization: Bearer rf_sk_your_key_here" \
  -F "document=@contract.docx" \
  -F "templateId=your-template-id" \
  -F "checkRequirements=true" \
  -F "runFinalCheck=true"

Success response includes:

  • data.document — the formatted document as a base64-encoded string.
  • data.filename — the suggested filename for the download.
  • data.results.templateApplied — template name and the list of commands that ran, with paragraph counts.
  • data.results.requirementsCheck — whether requirements passed, and any issues found (if enabled).
  • data.results.finalDraftCheck — categorised Final Draft Check results (if enabled).
  • data.results.summary — paragraph counts by type (headings, list items, definitions, body text, etc.).
  • usage.creditsUsed — the number of credits consumed.
  • usage.creditsRemaining — your remaining credit balance.

The X-Credits-Used and X-Credits-Remaining response headers also carry this information.

Idempotency: You can include an Idempotency-Key header with a unique value. If the same key is sent again with the same request parameters, the API will not charge additional credits. This is useful for retrying failed network requests safely.

Analyze a Document

Analyzes a document’s structure without applying any formatting changes. Returns paragraph counts by category (headings, lists, definitions, body text, signatures).

POST /api/v1/documents/analyze
Content-Type: multipart/form-data

Parameters (form data):

Parameter Type Required Description
document file Yes The .docx file to analyze
templateId string Yes The template to use for analysis

Example request:

curl -X POST https://reformatword.com/api/v1/documents/analyze \
  -H "Authorization: Bearer rf_sk_your_key_here" \
  -F "document=@contract.docx" \
  -F "templateId=your-template-id"

Success response:

{
  "success": true,
  "requestId": "req_abc123",
  "data": {
    "summary": {
      "totalParagraphs": 142,
      "headings": 12,
      "listItems": 38,
      "definitions": 6,
      "signatures": 2,
      "bodyText": 84
    }
  }
}

This endpoint does not consume credits and does not modify the document.

Inspect a Document

Compares an original document against a formatted version, showing what changed in each paragraph. Useful for reviewing formatting decisions in detail.

POST /api/v1/documents/inspect
Content-Type: multipart/form-data

Parameters (form data):

Parameter Type Required Description
originalDocument file Yes The original .docx file (before formatting)
currentDocument file Yes The formatted .docx file (after formatting)
templateId string Yes The template that was used
startIndex string No First paragraph index to inspect (default: 0)
endIndex string No Last paragraph index to inspect (default: end of document)

The response includes a list of paragraphs in the requested range, each showing:

  • The original and final style, font, and formatting properties.
  • The formatting category and style that was assigned.
  • Review signals highlighting paragraphs that may need attention (e.g., style boundary changes, numbering changes).

Results are paginated — up to 100 paragraphs per request. If the range exceeds 100 paragraphs, the response includes a truncated: true flag so you know to request the next page.

Apply Corrections

Applies specific style corrections to individual paragraphs in a document. Use this after inspecting the document if you want to override specific formatting decisions.

POST /api/v1/documents/correct
Content-Type: multipart/form-data

Parameters (form data):

Parameter Type Required Description
document file Yes The .docx file to correct
templateId string Yes The template context for style resolution
corrections string Yes A JSON array of corrections

Each correction in the array specifies:

  • paragraphIndex — the paragraph number to change (zero-based).
  • newStyle — the style name to apply.
  • expectedCurrentStyle (optional) — if provided, the correction is rejected if the paragraph’s current style doesn’t match.

Example corrections value:

[
  { "paragraphIndex": 5, "newStyle": "Heading 2" },
  { "paragraphIndex": 12, "newStyle": "Paragraph Text", "expectedCurrentStyle": "Normal" }
]

The response includes two lists:

  • applied — corrections that were successfully applied, with the previous and new style for each.
  • rejected — corrections that could not be applied, with the reason (e.g., paragraph index out of range, style not found, current style mismatch).

The corrected document is returned as a base64-encoded string in data.document.

List Templates

Returns all templates available to your organisation.

GET /api/v1/templates

Example request:

curl https://reformatword.com/api/v1/templates \
  -H "Authorization: Bearer rf_sk_your_key_here"

Example response:

{
  "success": true,
  "requestId": "req_abc123",
  "data": {
    "templates": [
      {
        "id": "clx1abc...",
        "name": "Agreement Template",
        "type": "Agreement",
        "isDefault": true,
        "isCustom": false,
        "commandCount": 7
      },
      {
        "id": "clx2def...",
        "name": "My Custom Template",
        "type": "Custom",
        "isDefault": false,
        "isCustom": true,
        "commandCount": 5
      }
    ]
  }
}

Get Template Details

Returns detailed information about a specific template, including its style configuration and, if a template file is available, the parsed style definitions and numbering scheme.

GET /api/v1/templates/{id}

Example request:

curl https://reformatword.com/api/v1/templates/your-template-id \
  -H "Authorization: Bearer rf_sk_your_key_here"

The response includes the template’s style configuration and, when available, parsed details such as:

  • The full list of defined styles with their font, size, spacing, and formatting properties.
  • The numbering scheme (hierarchical numbering levels and formats).
  • Default document properties (font, size, line spacing).
  • Page margins.

Check Usage

Returns your organisation’s current credit balance and breakdown.

GET /api/v1/usage

Example request:

curl https://reformatword.com/api/v1/usage \
  -H "Authorization: Bearer rf_sk_your_key_here"

Example response:

{
  "success": true,
  "requestId": "req_abc123",
  "data": {
    "organisation": {
      "id": "org_abc...",
      "name": "My Company"
    },
    "credits": {
      "available": 450,
      "breakdown": {
        "monthly": 400,
        "total": 50,
        "referral": 0
      },
      "resetDate": "2026-05-01T00:00:00.000Z"
    }
  }
}

For unlimited plans, the available field returns "unlimited" and the breakdown is omitted.

Error Codes

Code HTTP Status Description
invalid_key 401 API key is missing, invalid, or revoked
invalid_request 400 Missing required parameter
invalid_document 400 File is not a valid .docx or exceeds 50 MB
invalid_template 400 Template ID not found
template_access_denied 403 Your organisation does not have access to this template
insufficient_credits 402 No credits remaining
duplicate_request 409 Idempotency key reused with different parameters
processing_error 500 Internal error during processing

Rate Limits

The API enforces rate limits per API key. If you exceed the limit, the API returns a 429 Too Many Requests response. Wait and retry after the window resets.

Tips

  • Always save your API key securely. It cannot be retrieved after creation.
  • Use the Idempotency-Key header when retrying document processing requests to avoid duplicate credit charges.
  • Check your credit balance with the usage endpoint before batch-processing documents.
  • The analyze endpoint is free to call and useful for previewing what the template will do before committing credits.