webcapture Get a free key

Name the PDF file with curl

cnv_9f2c01ab.pdf is a database row, not a filename. Send filename in the body and the name rides the receipt and the download's Content-Disposition header.

Without a caller filename the download is named after the conversion id. The filename field renames it at the source: letters, digits, dot, dash, and underscore, up to 100 characters, echoed on the receipt and carried verbatim by the download's Content-Disposition header, where curl's -OJ reads it.

The recipe

ORIGIN="https://webcapture.io"

RECEIPT=$(curl -sS -X POST "$ORIGIN/v1/convert" \
  -H "Authorization: Bearer wc_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/", "filename": "invoice-2026.pdf"}')
echo "$RECEIPT"
# {"id": "cnv_4a7c90be", "bytes": 88210, "attempts": 1,
#  "remaining": 47, "filename": "invoice-2026.pdf",
#  "download": ".../v1/conversions/cnv_4a7c90be.pdf"}

ID=$(printf '%s' "$RECEIPT" | sed -E 's/.*"id": *"([^"]+)".*/\1/')
case "$ID" in cnv_*) ;; *) echo "convert failed: $RECEIPT" >&2; exit 1 ;; esac

# -OJ takes the name from the response's Content-Disposition header:
curl -sS -OJ -H "Authorization: Bearer wc_your_key" \
  "$ORIGIN/v1/conversions/$ID.pdf"
# invoice-2026.pdf lands in the working directory

The name is stored with the conversion, so every later download of this artifact carries it, and ?disposition=attachment on the download url flips the header's token from inline to attachment without touching the name. The filename is presentation only: the url itself is still the id-based one.

Same-key GET: 401 without it; 404 for another key.

The fields this recipe uses

Related

Method

Source: convert field reference, checked 2026-10-05. Corrections.