Install
| Client | Package | Install | Guide |
|---|---|---|---|
| TypeScript | wellfriend-document-sdk | npm install wellfriend-document-sdk@latest | /docs/sdk-cli/typescript |
| Python | wellfriend-document-sdk | pip install -U wellfriend-document-sdk | /docs/sdk-cli/python |
| Go | wellfriend.dev/go/wellfriend | go get wellfriend.dev/go/wellfriend@latest | /docs/sdk-cli/go |
| Rust | wellfriend-document-sdk | cargo add wellfriend-document-sdk | /docs/sdk-cli/rust |
| CLI | wellfriend (in wellfriend-document-sdk) | npm install -g wellfriend-document-sdk@latest | /docs/sdk-cli/cli |
Quickstart
Create a key in the dashboard (/dashboard/developer-api/keys) and set it as WELLFRIEND_API_KEY on your server. Each client compresses a PDF to a file in three lines.
import { Wellfriend } from "wellfriend-document-sdk";
const wf = new Wellfriend(); // reads WELLFRIEND_API_KEY
await wf.tools.compressPdf("input.pdf").then((result) => result.save("output.pdf"));from wellfriend import Wellfriend
wf = Wellfriend() # reads WELLFRIEND_API_KEY
wf.tools.compress_pdf("input.pdf").save("output.pdf")wf := wellfriend.New() // reads WELLFRIEND_API_KEY
res, err := wf.Tools.CompressPDF(ctx, wellfriend.File("input.pdf"), nil)
if err == nil { err = res.Save(ctx, "output.pdf") }let wf = Wellfriend::new(); // reads WELLFRIEND_API_KEY
let result = wf.tools().compress_pdf("input.pdf", None).await?;
result.save("output.pdf").await?;npm install -g wellfriend-document-sdk@latest
wellfriend login # or set WELLFRIEND_API_KEY
wellfriend compress-pdf input.pdf -o output.pdfTools
Every tool is one method: wf.tools.compressPdf in TypeScript, wf.tools.compress_pdf in Python, wf.Tools.CompressPDF in Go, wf.tools().compress_pdf in Rust, and wellfriend compress-pdf in the CLI. It uploads the file, runs the tool, waits and returns a result you save, read or stream.
Pipelines
wf.pipeline(steps).run(input) runs up to ten tools on one file in one run, and wellfriend pipeline does the same from a terminal. workflows.define keeps a named pipeline to run again.
Errors
All four SDKs raise the same error types, and every message carries a reference to quote to Support.
WellfriendError
├─ APIError (status, code, message, referenceId, details)
│ ├─ BadRequestError (400) / ValidationError (422)
│ ├─ AuthenticationError (401) / PermissionDeniedError (403)
│ ├─ NotFoundError (404) / ConflictError (409)
│ ├─ RateLimitError (429, retryAfter)
│ └─ ServerError (5xx)
├─ ConnectionError
├─ TimeoutError
├─ OperationFailedError (code, message, operation)
└─ WaitTimeoutError (operation id, to resume)Webhooks
webhooks.verify (or verifyWebhook on its own) checks a delivery's signature over the raw body and returns the typed event. See /docs/webhooks/signatures.
Packages and source
Every SDK is open source in the public repository, where each package's changelog is. What the registries serve now: TypeScript 1.0.0 on npm; Python 1.0.0 on PyPI; Go v1.0.1 on pkg.go.dev; Rust 1.0.0 on crates.io.
- TypeScript · npmnpm install wellfriend-document-sdk@latest
- Python · PyPIpip install -U wellfriend-document-sdk
- Go · pkg.go.devgo get wellfriend.dev/go/wellfriend@latest
- Rust · crates.iocargo add wellfriend-document-sdk
- CLI · npmnpm install -g wellfriend-document-sdk@latest
Official guides
Server-side rules
- Load the key from an environment variable or a secret manager; never put it in a web page or a mobile app.
- Check that your user may send a file before you forward it.
- Store the document, version and operation IDs your code needs later.
- Keep the SDK's automatic retries; add your own only for errors it does not retry.