Skip to Content
NexPDF

Build API

The instructions of /v1/build, part by part.

English

POST /v1/build takes multipart/form-data: each file in a field of its own, and an instructions field with JSON. The instructions name the files by their field.

{
  "parts": [ … ],
  "actions": [ … ],
  "output": { … }
}

Unknown fields are refused with invalid_request, so a typo never passes silently. Every file sent must be used by a part.

curl https://api.nexpdf.dev/v1/build \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F contract=@contract.pdf \
  -F annex=@annex.docx \
  -F 'instructions={
    "parts": [
      {
        "file": "contract"
      },
      {
        "file": "annex",
        "pages": {
          "start": 0,
          "end": 1
        }
      }
    ],
    "actions": [
      {
        "type": "rotate",
        "degrees": 90,
        "pages": [
          2
        ]
      },
      {
        "type": "delete_pages",
        "pages": [
          0
        ]
      }
    ]
  }' \
  -o packet.pdf

Parts

Up to 20, joined in order. Each part has either file or html.

Prop

Type

Actions

Up to 50, applied in order to the joined document. pages lists count from 0.

typeFieldsGuide
ocrlanguages (optional, such as eng+por)OCR
watermarktextWatermark
rotatedegrees (90, 180 or 270; negative turns the other way); pages (optional, all pages when left out)Pages
delete_pagespagesPages
flatten_annotations, flatten_formsNoneForms
fill_formvalues: { "field name": value }Forms
redactquery; mode: text (default), regex or pattern; fill_whiteRedaction
pdfalevel: 1a, 1b, 2a, 2b (default), 2u, 3a, 3b or 3uPDF/A
pdfuapart (1 or 2), langAccessibility
optimizeNoneOptimize
encryptowner_password; user_password and permissions (optional). Last action only, with PDF output.Encrypt
signAll optional: certificate (the field of an uploaded PKCS#12 file; self-signed when left out), password, name, reason, location, contact, field, appearance (page, rect, text). Last action only, with PDF output that is not linearised.Digital signatures

Output

Optional; a PDF when left out.

typeFieldsReturns
pdflinearizePDF
pngpage (from 0), dpi (36–300, default 150)A PNG of one page
markdown, html, jsonNoneThe text of the document
docx, xlsxNoneA Word or Excel file
splitevery (pages per file) or ranges (a list of { "start", "end" })A ZIP of PDFs, part-1.pdf, part-2.pdf… (Split)

Cost

The parts and actions are counted as if they were separate calls; see limits and pricing. A job that would need more units than are left this month is refused before it runs.

On this page