HomeDocsAPI Reference › Manipulation Endpoints

Manipulation Endpoints

Merge, split, rotate, resize, and manage PDF pages via the REST API.

Overview

The manipulation endpoints let you restructure PDF documents by merging multiple files, splitting pages, extracting or removing specific pages, reorganizing page order, rotating, resizing, and adding watermarks or page numbers. All endpoints return the modified PDF in the response body.

Info
All manipulation endpoints require authentication. Include your X-Api-Key and X-Api-Secret headers on every request. See Authentication for details.

Merge PDFs

POST /api/pdf/merge

Combines two or more PDF files into a single document. Files are merged in the order they are uploaded.

Note
The merge endpoint supports a maximum total upload size of 200 MB, which is higher than the standard 100 MB limit for other endpoints.
NameTypeRequiredDescription
filesFile[]YesTwo or more PDF files to merge. Use multiple files fields in the form data.
outputFileNameStringNoCustom name for the merged output PDF.
curl -X POST https://pdf.mapsoft.com/api/pdf/merge \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "files=@document1.pdf" \
  -F "files=@document2.pdf" \
  -F "files=@document3.pdf" \
  -F "outputFileName=merged.pdf" \
  -o merged.pdf

Split PDF

POST /api/pdf/split

Splits a PDF document into multiple files. You can split by page count, page ranges, or into individual pages. Returns a ZIP archive containing the split files.

NameTypeRequiredDescription
fileFileYesThe PDF file to split.
splitMethodStringNoHow to split: byPages (default), byRange, everyPage.
pageCountIntegerNoNumber of pages per split file (used with byPages). Default: 1.
rangesStringNoComma-separated page ranges (used with byRange), e.g., 1-3,4-6,7-10.
outputFileNameStringNoBase name for the output files.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/split \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "splitMethod=byRange" \
  -F "ranges=1-3,4-6,7-10" \
  -o split-files.zip

Extract Pages

POST /api/pdf/extract-pages

Extracts specific pages from a PDF and returns them as a new PDF document.

NameTypeRequiredDescription
fileFileYesThe PDF file to extract pages from.
pagesStringYesPages to extract. Supports ranges and individual pages: 1,3,5-8,12.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/extract-pages \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "pages=1,3,5-8" \
  -o extracted.pdf

Remove Pages

POST /api/pdf/remove-pages

Removes specified pages from a PDF document and returns the modified PDF.

NameTypeRequiredDescription
fileFileYesThe PDF file to remove pages from.
pagesStringYesPages to remove. Supports ranges and individual pages: 2,4,6-8.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/remove-pages \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "pages=2,4,6-8" \
  -o trimmed.pdf

Reorganize Pages

POST /api/pdf/reorganize

Reorders the pages of a PDF document according to a specified page sequence.

NameTypeRequiredDescription
fileFileYesThe PDF file to reorganize.
pageOrderStringYesNew page order as a comma-separated list, e.g., 3,1,2,5,4. Pages can be repeated or omitted.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/reorganize \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "pageOrder=3,1,2,5,4" \
  -o reorganized.pdf

Rotate Pages

POST /api/pdf/rotate-pages

Rotates specified pages in a PDF document by a given angle.

NameTypeRequiredDescription
fileFileYesThe PDF file to rotate pages in.
angleIntegerYesRotation angle in degrees: 90, 180, or 270.
pagesStringNoPages to rotate (e.g., 1,3,5-8). Defaults to all pages.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/rotate-pages \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "angle=90" \
  -F "pages=1,3" \
  -o rotated.pdf

Resize Page

POST /api/pdf/resize-page

Resizes all or selected pages in a PDF document to a specified paper size.

NameTypeRequiredDescription
fileFileYesThe PDF file to resize.
pageSizeStringYesTarget page size: A3, A4, A5, Letter, Legal, Tabloid, or custom dimensions.
widthFloatNoCustom width in points (used when pageSize is custom).
heightFloatNoCustom height in points (used when pageSize is custom).
pagesStringNoPages to resize (e.g., 1-5). Defaults to all pages.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/resize-page \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "pageSize=A4" \
  -o resized.pdf

Add Watermark

POST /api/pdf/add-watermark

Adds a text or image watermark to a PDF document.

NameTypeRequiredDescription
fileFileYesThe PDF file to watermark.
textStringNoWatermark text (e.g., CONFIDENTIAL, DRAFT). Required if no image watermark is provided.
watermarkImageFileNoImage file to use as a watermark (PNG, JPG). Required if no text is provided.
fontSizeIntegerNoFont size for text watermark. Default: 48.
colorStringNoText color as hex code (e.g., #FF0000). Default: #808080.
opacityFloatNoWatermark opacity from 0.0 (invisible) to 1.0 (opaque). Default: 0.3.
rotationIntegerNoRotation angle in degrees. Default: -45 (diagonal).
positionStringNoPosition: center (default), top-left, top-right, bottom-left, bottom-right.
pagesStringNoPages to watermark (e.g., 1,3,5-8). Defaults to all pages.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/add-watermark \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "text=CONFIDENTIAL" \
  -F "fontSize=60" \
  -F "color=#FF0000" \
  -F "opacity=0.25" \
  -F "rotation=-45" \
  -o watermarked.pdf

Add Page Numbers

POST /api/pdf/add-page-numbers

Adds page numbers to a PDF document in a specified position and format.

NameTypeRequiredDescription
fileFileYesThe PDF file to add page numbers to.
positionStringNoPosition of numbers: bottom-center (default), bottom-left, bottom-right, top-center, top-left, top-right.
formatStringNoNumber format: numeric (default), roman, alphabetic. Or a pattern like Page {n} of {total}.
startNumberIntegerNoStarting page number. Default: 1.
fontSizeIntegerNoFont size for the page numbers. Default: 10.
pagesStringNoPages to number (e.g., 2-10). Defaults to all pages.
outputFileNameStringNoCustom name for the output PDF file.
passwordStringNoPassword to open the PDF, if it is password-protected.
curl -X POST https://pdf.mapsoft.com/api/pdf/add-page-numbers \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -F "file=@document.pdf" \
  -F "position=bottom-center" \
  -F "format=Page {n} of {total}" \
  -F "startNumber=1" \
  -o numbered.pdf