Files by URL
Send a link instead of the file, and NexPDF Cloud downloads it.
Any file field can be sent as a link instead: add _url to the field's name and give an
http or https address. document becomes document_url, file1 becomes file1_url, a build's
doc becomes doc_url. The server downloads the file and the request goes on as if you had
uploaded it. Uploads and links can be mixed in one request.
Useful when the file is already in object storage (a presigned S3, Google Cloud Storage or Azure link), on a CDN, or too large to pass through your own server first.
Convert a file from a link
curl https://api.nexpdf.dev/v1/convert/pdf \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F document_url=https://files.example.com/reports/q3.docx \
-o q3.pdfMix uploads and links
Here the cover page is uploaded and the contract comes from storage:
curl https://api.nexpdf.dev/v1/build \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F cover=@cover.pdf \
-F contract_url=https://files.example.com/contracts/4471.pdf \
-F 'instructions={
"parts": [
{
"file": "cover"
},
{
"file": "contract"
}
],
"actions": [
{
"type": "watermark",
"text": "COPY"
}
]
}' \
-o packet.pdfWhat is allowed
httpandhttpsonly, on ports 80 and 443, with no user name or password in the URL (put credentials in a presigned query string instead).- The address must be public: private, loopback, link-local and cloud metadata addresses are refused, and so is a redirect to one. At most 5 redirects.
- The file counts toward the key's size limit like an upload, and the download must finish within 30 seconds.
- Up to 10 links per request.
A link that cannot be fetched fails the request with 422 fetch_failed (the message says why); one
that is not allowed fails with 400 invalid_request; a file over the limit with
413 file_too_large. Nothing is charged for a request that fails.
In the client libraries a URL is a file input like a path: url('https://…') in TypeScript,
File.from_url in Python, nexpdfcloud.URL in Go, Input::url in Rust (see
client libraries). The client never downloads the file itself.