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_here

Endpoint

Send a POST request with multipart/form-data.

POST https://pypaper.cortode.id.vn/api/convert

Request parameters

FieldTypeNotes
fileFileRequired .ipynb file.
themestringlight or dark.
autoFormatbooleanFormat code with Ruff before render.
hideCodebooleanHide code cells, keep outputs.
headerTextstringText in the header of each page.
footerTextstringText in the footer of each page.
marginTopstring (mm)Top margin in millimeters.
marginRightstring (mm)Right margin in millimeters.
marginBottomstring (mm)Bottom margin in millimeters.
marginLeftstring (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

StatusWhen it happens
400Missing file or invalid notebook.
401Invalid or missing API key.
413File too large for the current plan.
429Rate limit exceeded.
500Conversion 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)