Documentation

File upload

POST /v1/upload — the file in multipart/form-data, field file.

curl https://api.smartpdf.ru/v1/upload -H "X-API-Key: $SMARTPDF_API_KEY" -F "file=@document.pdf"

Response 201:

{
  "file_id": "6b0e3c4d9f2a4e1b8c7d5a3f2e1d0c9b",
  "filename": "document.pdf",
  "size": 48213,
  "text_layer": true
}

text_layer is returned for PDFs only: whether there is text on the first pages. false means it looks like a scan: for “PDF to Word” and “PDF to Markdown”, pass ocr: true. For other formats, it’s null.

Formats

PDF; Word — DOC and DOCX; Excel — XLS and XLSX; PowerPoint — PPT and PPTX; OpenDocument — ODT, ODS, ODP; RTF; images — JPG, PNG, WEBP, GIF, HEIC and HEIF (iPhone photos), TIFF, BMP; books — DjVu, FB2, EPUB; HTML. The format each operation needs is listed on its page in the Operations section.

The file type is taken from the Content-Type of the part; if the client sends a generic type such as application/octet-stream or none at all, it’s taken from the file name extension. The content is checked against the type by its signature: a renamed or damaged file gets 415.

Size

The maximum size depends on the account’s plan: 50 MB, 200 MB on Pro, 500 MB on Business. A larger file gets 413.

Lifetime

A file_id is valid for an hour: after that, the file is deleted, and operations with this file_id get 404. Within the hour, one file_id can be used in several operations — for example, first recognize the text, then compress.

Pages

For PDFs, pages are counted at upload: they determine the price of heavy operations (see Billing) and are checked against the text recognition limit.

This page for agents: Markdown · llms.txt