Client libraries
Official NexPDF Cloud clients for TypeScript, Python, Go, Rust, PHP, .NET, Java, Ruby and Swift.
Every client has the same shape: create it once, call one method per endpoint, and get back a result you can save or read. They use only their language's standard library, retry rate limits and busy servers for you, and raise one error type with the API's error code.
| Language | Package | Create the client |
|---|---|---|
| TypeScript / JavaScript | npm @nexdevit/nexpdf-cloud | new NexPdfCloud() |
| Python | PyPI nexpdf-cloud | NexPdfCloud() |
| Go | github.com/nexdevit/nexpdf-cloud-go | nexpdfcloud.New(nexpdfcloud.Options{}) |
| Rust | crate nexpdf-cloud | Client::from_env()? |
| PHP | Composer nexdevit/nexpdf-cloud | new Client() |
| .NET | NuGet Nexdevit.NexPdf.Cloud | new NexPdfCloudClient() |
| Java / Kotlin | Maven com.nexdevit:nexpdf-cloud | NexPdfCloud.fromEnv() |
| Ruby | gem nexpdf-cloud | NexPdfCloud::Client.new |
| Swift | SwiftPM NexPdfCloud | try NexPdfCloud.Client() |
Install commands are on Get started.
For AI assistants, the MCP server (npm @nexdevit/nexpdf-cloud-mcp) is built on the
TypeScript client.
Methods
| Endpoint | TypeScript | Python | Go | .NET |
|---|---|---|---|---|
/v1/build | build | build | Build | BuildAsync |
/v1/convert/pdf | convertToPdf | convert_to_pdf | ConvertToPDF | ConvertToPdfAsync |
/v1/ocr | ocr | ocr | OCR | OcrAsync |
/v1/merge | merge | merge | Merge | MergeAsync |
/v1/extract/markdown | extractMarkdown | extract_markdown | ExtractMarkdown | ExtractMarkdownAsync |
/v1/xlsx/edit | editXlsx | edit_xlsx | EditXLSX | EditXlsxAsync |
/v1/docx/edit | editDocx | edit_docx | EditDOCX | EditDocxAsync |
/v1/split | split | split | Split | SplitAsync |
/v1/verify | verifySignatures | verify_signatures | VerifySignatures | VerifySignaturesAsync |
/v1/health | health | health | Health | HealthAsync |
Rust, PHP, Java, Ruby and Swift follow their own conventions with the same names
(convert_to_pdf, convertToPdf, convertToPDF…). Each package's README lists them.
Files
Pass a path on disk, or bytes with a file name when the document is already in memory:
| Language | From a path | From bytes |
|---|---|---|
| TypeScript | file('a.pdf') | file(bytes, 'a.pdf') |
| Python | "a.pdf" | File.from_bytes(data, "a.pdf") |
| Go | nexpdfcloud.Path("a.pdf") | nexpdfcloud.Bytes(data, "a.pdf") |
| Rust | Input::path("a.pdf") | Input::bytes(data, "a.pdf") |
| PHP | File::path('a.pdf') | File::bytes($data, 'a.pdf') |
| .NET | CloudFile.FromPath("a.pdf") | CloudFile.FromBytes(data, "a.pdf") |
| Java | CloudFile.path("a.pdf") | CloudFile.bytes(data, "a.pdf") |
| Ruby | "a.pdf" | NexPdfCloud::File.bytes(data, "a.pdf") |
| Swift | .path("a.pdf") | .bytes(data, name: "a.pdf") |
Results
A result holds the response body and what the API said about it: the content type, the units the
request cost and its request id. save(path) writes it to disk; text() reads it as UTF-8 (for
Markdown, HTML and JSON output).
Retries
The clients retry a request up to twice when the API answers 429 with rate_limited or
concurrency_limited, 503, or when the network fails. They wait for Retry-After when the
API sends one (at most 30 seconds), otherwise 0.5 s, then 1 s. Other errors are raised at once:
retrying a bad request or an exhausted quota would not help.
Errors
Every failure raises one error type, with the HTTP status, the API's code, its message, the
request id and retryAfter when the API sent one.
| Language | Error type |
|---|---|
| TypeScript, Python, Swift | NexPdfCloudError |
| Go | *nexpdfcloud.Error (use errors.As) |
| Rust | nexpdf_cloud::Error |
| PHP, .NET, Java | NexPdfCloudException |
| Ruby | NexPdfCloud::Error |
Errors the client finds before sending use the codes missing_api_key and invalid_request; a
failed connection uses network. The API's codes are listed on Errors.
Source and tests
The clients live in the sdks/cloud folder of the NexPDF repository. All nine pass the same
conformance scenarios against a mock of the API, and every sample on these pages is compiled and
run against it before the site is published.