fynepdf logo
Docs menu

Quickstart

Compress your first PDF with the FynePDF API in five minutes, with curl, Node or Python.

1. Get a key

Sign in on fynepdf.com, open Developers and create a key. Start with a test key: it's free, and every PDF it makes says "FynePDF test key" across the page. Keep the key on your server, then:

export FYNEPDF_API_KEY="fyne_test_…"

Using Node or Python? Install the SDK; curl needs nothing:

npm install fynepdf

2. Add a file

Point the API at a PDF on the web (or upload one):

curl https://api.fynepdf.com/v1/files \
  -H "Authorization: Bearer $FYNEPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/report.pdf"}'

A file on your computer? fyne.files.upload("./report.pdf") sends it, through an upload link when it's over 25 MB.

The answer is the file, with an id like file_01jc8x4m2k9q7r3t5vwy6z.

3. Compress it

Ask for a target size; the API picks the settings:

curl https://api.fynepdf.com/v1/pdf/compress \
  -H "Authorization: Bearer $FYNEPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_id":"file_01jc8x4m2k9q7r3t5vwy6z","target_size_bytes":5000000}'

4. Download the result

The call waits up to 30 seconds and answers with the finished job. Its receipt says what happened, and outputs holds the result:

{
  "status": "succeeded",
  "receipt": {
    "steps": [
      { "action": "compress", "status": "succeeded", "bytes_before": 8700000, "bytes_after": 4600000, "target_met": true, "credits": 1 }
    ],
    "credits": 1
  },
  "outputs": [
    { "id": "file_01jc9b7c8d9e0f1g2h3j4k", "filename": "report.pdf", "bytes": 4600000, "download_url": "https://files.fynepdf.com/…" }
  ]
}
curl -o report-small.pdf "https://files.fynepdf.com/…"

download_url works for an hour; the file is kept for 24 hours, and its id can go straight into another job. A job that's still running answers 202: poll it or use a webhook. The SDKs retry safely and wait for you: fyne.jobs.wait(job).

Next

  • Chain steps in one job: compress, then add page numbers, then PDF/A.
  • Switch to a live key when you're ready: 250 free credits every month, then credit packs.
  • Browse every action in the menu, from OCR to generating invoices.