Using the API

Conversion options

Send options as a JSON object in the options part of the upload. Every option is optional. Unknown options and out-of-range values are rejected with 400 invalid_option, never silently ignored, so a typing mistake can't quietly change your output.

{
  "pages": "1-3,5",
  "dpi": 300,
  "quality": 85,
  "subsampling": "auto",
  "background": "#FFFFFF",
  "name_template": "invoice_{page_number:001}",
  "zip": true,
  "password": "only-if-the-pdf-is-protected"
}
OptionValuesDefault
pagesWhich pages to convert; see below"all"
dpi10 up to your plan's maximum: 150 on Free, 600 on other plans150
qualityJPEG quality, 1 to 10090
subsampling"auto", "444", "420" or "gray""auto"
backgroundThe colour behind transparent areas, as "#RRGGBB""#FFFFFF"
name_templateFile names; see below"{original}_page_{page_number:0001}"
ziptrue also creates a ZIP of all pagesfalse
passwordThe password of a protected PDF, 1 to 1024 bytesnone

Choosing pages

Pages are numbered from 1. Duplicates are removed, and pages are always converted in ascending order.

ValueConverts
"all"Every page
"5"Page 5
"1-3"Pages 1, 2 and 3
"8-"Page 8 to the end
"1-3,5,8-"Any combination, separated by commas

Bad syntax returns 400 straight away. A page beyond the end of the document can only be detected once the PDF is opened, so the job fails with invalid_page_selection.

Choosing a DPI

DPIGood forCredits per pageA4/Letter page size
72 to 96Thumbnails and previews1about 816 × 1056 at 96 DPI
150Most screen use (recommended)1about 1275 × 1650
200 to 300Sharp text, OCR, printing3about 2550 × 3300 at 300 DPI
600Print-quality archives8about 5100 × 6600

Quality and subsampling

Quality 90 is a good default. Higher values give sharper images and larger files.

subsampling controls colour detail. "auto" uses 4:4:4 at quality 90 or above, and 4:2:0 below that. Choose "444" to keep coloured text crisp, "420" for smaller files, or "gray" for greyscale output.

File names

name_template must include {page_number}, can be up to 200 characters, and can't contain slashes. .jpg is added for you.

PlaceholderBecomes
{original}The uploaded file name without .pdf
{page_number}The page number: 7
{page_number:0001}The page number with zero padding: 0007

Protected PDFs

Send the password in the password option. If it's missing or wrong, the job fails with password_required or password_incorrect; submit the job again with a new Idempotency-Key. RasterNivo opens protected PDFs only with the correct password and never cracks or bypasses protection.