API PDF được xây dựng cho nhà phát triển
Mỗi tác vụ một điểm cuối REST đơn giản. Gộp, chuyển đổi, nén và bảo vệ PDF từ bất kỳ ngôn ngữ nào - không cần SDK, không cần máy chủ, không phải vật lộn với thư viện PDF.
Bắt đầu nhanh
1. Lấy khóa
Đăng nhập và tạo khóa trong bảng điều khiển của bạn.
2. Gọi một điểm cuối
Gửi POST tệp của bạn dưới dạng multipart/form-data.
3. Nhận kết quả
Tệp đã xử lý được trả về ngay lập tức.
curl -X POST https://smallpdf.us/api/v1/merge \
-H "X-API-Key: YOUR_API_KEY" \
-F "files=@image1.pdf" \
-F "files=@image2.pdf" \
-o merged.pdfXác thực
Mọi yêu cầu phải bao gồm khóa bí mật của bạn trong header X-API-Key . Tạo và quản lý khóa trong bảng điều khiển. Hãy giữ khóa phía máy chủ - không bao giờ để lộ chúng trong mã phía máy khách.
X-API-Key: sk_live_xxxxxxxxxxxxxxxxxxxxxxxxURL gốc & phản hồi
Tất cả điểm cuối là POST dưới:
- Khi thành công, tệp đã xử lý được trả về trực tiếp trong phần thân.
- Khi có lỗi, một phần thân JSON được trả về:
{ "error": "...", "code": "..." } - Mọi phản hồi đều bao gồm
X-RateLimit-Limit/X-RateLimit-Remaining - Các tệp tải lên được quét mã độc và bị xóa khỏi máy chủ của chúng tôi ngay sau khi xử lý.
Điểm cuối
Sắp xếp
/v1/mergeMerge PDFCombine two or more PDFs into a single document, in the order provided.
Tham số
filesfile[]bắt buộcTwo or more PDF files.
Trả về: PDF file · merged.pdf
curl -X POST https://smallpdf.us/api/v1/merge \
-H "X-API-Key: YOUR_API_KEY" \
-F "files=@image1.pdf" \
-F "files=@image2.pdf" \
-o merged.pdf/v1/splitSplit PDFSplit a PDF. Without `pages` you receive a ZIP with one PDF per page; with `pages` you receive a single PDF of just those pages.
Tham số
filefilebắt buộcThe PDF to split.
pagesstringtùy chọnOptional range, e.g. "1,3,5-7".
Trả về: PDF file · split.pdf
curl -X POST https://smallpdf.us/api/v1/split \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "pages=1-3" \
-o split.pdf/v1/rotateRotate PDFRotate every page by a multiple of 90 degrees.
Tham số
filefilebắt buộcThe PDF to rotate.
angleinttùy chọn90, 180 or 270. Default 90.
Trả về: PDF file · rotated.pdf
curl -X POST https://smallpdf.us/api/v1/rotate \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "angle=90" \
-o rotated.pdfChuyển đổi
/v1/pdf-to-wordPDF to WordConvert a PDF into an editable Word (.docx) document with layout preserved.
Tham số
filefilebắt buộcThe PDF to convert.
Trả về: Word .docx file · converted.docx
curl -X POST https://smallpdf.us/api/v1/pdf-to-word \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-o converted.docx/v1/word-to-pdfWord to PDFConvert a Word document (.doc, .docx, .odt, .rtf) into a PDF.
Tham số
filefilebắt buộcThe document to convert.
Trả về: PDF file · converted.pdf
curl -X POST https://smallpdf.us/api/v1/word-to-pdf \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.docx" \
-o converted.pdf/v1/pdf-to-jpgPDF to JPGRender each PDF page to a JPG image. Returns a ZIP archive.
Tham số
filefilebắt buộcThe PDF to convert.
qualitystringtùy chọnstandard (150dpi) · high (300) · maximum (600).
Trả về: ZIP archive of images · pages.zip
curl -X POST https://smallpdf.us/api/v1/pdf-to-jpg \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "quality=high" \
-o pages.zip/v1/pdf-to-pngPDF to PNGRender each PDF page to a PNG image. Returns a ZIP archive.
Tham số
filefilebắt buộcThe PDF to convert.
qualitystringtùy chọnstandard · high · maximum.
Trả về: ZIP archive of images · pages.zip
curl -X POST https://smallpdf.us/api/v1/pdf-to-png \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "quality=high" \
-o pages.zip/v1/jpg-to-pdfJPG to PDFCombine one or more JPG images into a single PDF (one image per page).
Tham số
filesfile[]bắt buộcOne or more JPG images.
Trả về: PDF file · images.pdf
curl -X POST https://smallpdf.us/api/v1/jpg-to-pdf \
-H "X-API-Key: YOUR_API_KEY" \
-F "files=@image1.jpg" \
-F "files=@image2.jpg" \
-o images.pdf/v1/png-to-pdfPNG to PDFCombine one or more PNG images into a single PDF (one image per page).
Tham số
filesfile[]bắt buộcOne or more PNG images.
Trả về: PDF file · images.pdf
curl -X POST https://smallpdf.us/api/v1/png-to-pdf \
-H "X-API-Key: YOUR_API_KEY" \
-F "files=@image1.png" \
-F "files=@image2.png" \
-o images.pdfTối ưu
/v1/compressCompress PDFReduce a PDF's file size with lossless stream compression.
Tham số
filefilebắt buộcThe PDF to compress.
Trả về: PDF file · compressed.pdf
curl -X POST https://smallpdf.us/api/v1/compress \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-o compressed.pdfBảo mật
/v1/protectProtect PDFEncrypt a PDF with AES-256 so it can only be opened with the password.
Tham số
filefilebắt buộcThe PDF to protect.
passwordstringbắt buộcPassword required to open the file.
Trả về: PDF file · protected.pdf
curl -X POST https://smallpdf.us/api/v1/protect \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "password=secret123" \
-o protected.pdfGói & hạn mức
| Gói | Lượt gọi API | Giá |
|---|---|---|
| Free | 50 / month | $0 |
| Starter | 1,000 / month | $9/mo |
| Pro | 10,000 / month | $19/mo |
| Max | 100,000 / month | Contact sales |
Hạn mức được đặt lại vào ngày 1 hằng tháng (UTC). Chỉ các lượt gọi thành công được tính. Xem bảng giá đầy đủ →
Mã trạng thái & mã lỗi
| HTTP | Mã | Ý nghĩa |
|---|---|---|
| 200 | - | Success. The processed file is returned in the body. |
| 400 | BAD_INPUT | Missing or invalid file / parameters. |
| 401 | NO_API_KEY · BAD_API_KEY | Missing, invalid or revoked key. |
| 429 | QUOTA_EXCEEDED | Monthly quota used up - upgrade your plan. |
| 500 | PROCESSING_ERROR | The file could not be processed. |
Bắt đầu xây dựng ngay hôm nay
Tạo khóa API miễn phí và thực hiện lệnh gọi đầu tiên chỉ trong chưa đầy một phút.
Nhận khóa API của bạn