# comparepdfs: Compare PDFs (AI + Text Diff)

> comparepdfs (Compare PDFs (AI + Text Diff)) is a 1001fx API function in the group Files & PDF: POST https://api.1001fx.com/files/comparepdfs, 1 credit per item. It works as a ready-made module in Make or as a plain HTTP call.

Compares two versions of a PDF: a word-by-word diff (line breaks, spacing and hyphenation are ignored) with every change, its context and page, and an AI explanation of what changed and how important it is (high/medium/low), in the language of the documents. Each PDF is stored encrypted for 2 days under its SHA-256 hash, together with the extracted text: pass file1Hash/file2Hash instead of the file to compare it again without upload and without new OCR. Scanned pages without a text layer are read by OCR (ocr auto). Credits: 1 per started 5 pages of both PDFs together, plus 6 per OCR page, plus 4 per started 1,000 AI tokens (twice that with gpt-6.1-terra).

- Group: Files & PDF
- Endpoint: `POST https://api.1001fx.com/files/comparepdfs`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: multipart/form-data
- Credits: 1 credit per item
- Ready-made in: Make
- Service provider: Mistral
- Docs: https://1001fx.com/functions/comparepdfs

## Parameters

- `file1` (file, optional) – File: The old version (PDF). Either file1 or file1Url.
- `file1Url` (string, optional) – File URL: Public URL of the old version (PDF). Either file1 or file1Url.
- `file1Hash` (string, optional) – File 1 hash: SHA-256 hash of a PDF compared in the last 2 days (file1.hash of that answer). Compares it again without upload and without new OCR. Either file1, file1Url or file1Hash.
- `file2` (file, optional) – File: The new version (PDF). Either file2 or file2Url.
- `file2Url` (string, optional) – File URL: Public URL of the new version (PDF). Either file2 or file2Url.
- `file2Hash` (string, optional) – File 2 hash: SHA-256 hash of a PDF compared in the last 2 days (file2.hash of that answer). Compares it again without upload and without new OCR. Either file2, file2Url or file2Hash.
- `ai` (boolean, optional, default `true`) – AI explanation: Explains and rates the changes with AI (default true). false: text diff only (1 credit per 5 pages).
- `instructions` (string, optional) – Instructions: What the AI should pay attention to, e.g. "Focus on deadlines, prices and liability" or "Answer in English".
- `model` (enum, optional, one of `gpt-6-luna`, `gpt-6.1-terra`, default `gpt-6-luna`) – Model: gpt-6-luna (default) or gpt-6.1-terra for long or difficult documents (twice the AI credits).
- `ocr` (enum, optional, one of `auto`, `always`, `never`, default `auto`) – OCR: auto (default): OCR only for pages without text layer (scans); always: OCR for every page (bad text layer); never: text layer only. 6 credits per OCR page, at most 50 pages per PDF; stored OCR pages are reused for free.
- `includeDiff` (boolean, optional, default `false`) – Include full diff: Adds the full word diff (all text, marked equal/removed/added) as diff, e.g. to show it side by side.

## Example: Compare two contract versions

```bash
curl -X POST 'https://api.1001fx.com/files/comparepdfs' \
  -H 'X-API-KEY: YOURSECRETAPIKEY'
```
