API Reference
Convert notebooks to PDF
This reference covers authentication, the conversion endpoint, request parameters, and common error responses.
Authentication
API access is available for Pro plans. Include your API key in the x-api-key header on every request.
x-api-key: pp_your_api_key_hereEndpoint
Send a POST request with multipart/form-data.
POST https://pypaper.cortode.id.vn/api/convert
Request parameters
| Field | Type | Notes |
|---|---|---|
| file | File | Required .ipynb file. |
| theme | string | light or dark. |
| autoFormat | boolean | Format code with Ruff before render. |
| hideCode | boolean | Hide code cells, keep outputs. |
| headerText | string | Text in the header of each page. |
| footerText | string | Text in the footer of each page. |
| marginTop | string (mm) | Top margin in millimeters. |
| marginRight | string (mm) | Right margin in millimeters. |
| marginBottom | string (mm) | Bottom margin in millimeters. |
| marginLeft | string (mm) | Left margin in millimeters. |
Response
A successful request returns a PDF file with Content-Type: application/pdf. Errors return JSON.
{
"error": "Missing file field"
}Common errors
| Status | When it happens |
|---|---|
| 400 | Missing file or invalid notebook. |
| 401 | Invalid or missing API key. |
| 413 | File too large for the current plan. |
| 429 | Rate limit exceeded. |
| 500 | Conversion failure. Try again later. |
Examples
cURL
curl -X POST https://pypaper.cortode.id.vn/api/convert \ -H "x-api-key: pp_your_api_key_here" \ -F "file=@analysis.ipynb" \ -F "theme=light" \ --output report.pdf
Python
import requests
url = "https://pypaper.cortode.id.vn/api/convert"
headers = {"x-api-key": "pp_your_api_key_here"}
files = {"file": open("analysis.ipynb", "rb")}
response = requests.post(url, headers=headers, files=files)
with open("report.pdf", "wb") as f:
f.write(response.content)