gitlabEdit

๐Ÿ“ฆSDK Overview

Docs-Dispatcher provides official client libraries in three popular programming languages to simplify integration with the API. These SDKs handle authentication, request building, validation, and error handling, allowing you to focus on your business logic.

Why Use an SDK?

While you can interact with the Docs-Dispatcher API using raw HTTP clients or curl, SDKs provide significant advantages:

Type Safety

  • Strong typing: Full IntelliSense and autocomplete support in your IDE

  • Compile-time checks: Catch errors before runtime

  • TypeScript support: The Node.js SDK includes complete TypeScript definitions

Developer Experience

  • Simplified authentication: Built-in support for Bearer tokens and Basic Auth

  • Intuitive builders: Chain methods to construct complex objects (invoices, customers, items)

  • Validation: Client-side validation catches errors before making API calls

  • Error handling: Structured exceptions with detailed error information

Maintainability

  • Version compatibility: SDKs are versioned alongside the API

  • Backward compatibility: Clear upgrade paths when API changes

  • Documentation: Inline documentation and code examples

Productivity

  • Less boilerplate: No need to manually construct JSON payloads

  • Helper utilities: Built-in formatters, converters, and validators

  • Service composition: Easily combine multiple services (e.g., generate + email + upload)

Available SDKs

Language
Package Name
Minimum Version
Latest Version
Repository

docs-dispatcher-sdk

Node.js ^22

v0.7.0+

docs-dispatcher.io/sdk

PHP 8.1+

v0.2.x

docsdispatcher-java-client

Java 1.8+

v0.0.1

Feature Comparison

Feature
Node.js
PHP
Java

Authentication

Bearer Token (JWT)

โœ… v0.7.0+

โœ… v0.2+

โœ…

Basic Auth

โœ…

โœ…

โœ…

Services

Email Dispatch

โœ…

โœ…

โœ…

File Generation

โœ…

โœ…

โœ…

SMS Dispatch

โœ…

โœ…

โœ…

Postal Dispatch

โœ…

โœ…

โœ…

E-Signature

โœ…

โœ…

โœ…

Invoicing

โœ… v0.7.0+

โœ…

โœ…

Upload Targets

โœ…

โœ…

โœ…

Service Composition

โœ…

โœ…

โœ…

Developer Experience

TypeScript Support

โœ… Full types

โŒ

โŒ

Builder Pattern

โœ…

โš ๏ธ Partial

โš ๏ธ Partial

Validation

โœ… Client-side

โš ๏ธ Server-side

โš ๏ธ Server-side

Async/Promises

โœ… async/await

โœ…

โœ…

Documentation

Inline Docs

โœ…

โœ…

โœ…

Code Examples

โœ…

โœ…

โœ…

Online API Docs

โœ…

โŒ

โš ๏ธ JavaDoc

SDK Selection Guide

Choose Node.js SDK if you:

  • Use JavaScript or TypeScript in your stack

  • Want the best developer experience with full type safety

  • Need client-side validation before API calls

  • Prefer modern async/await patterns

  • Use Yarn or npm package management

  • Build web applications, serverless functions, or Node.js backends

Best for: Modern JavaScript/TypeScript applications, React/Vue/Angular frontends, serverless environments

Get Started with Node.js SDK โ†’

Choose PHP SDK if you:

  • Use PHP 8.1+ in your backend

  • Build traditional server-side applications

  • Use Composer for dependency management

  • Need a mature, stable PHP ecosystem

  • Integrate with frameworks like Laravel, Symfony, or WordPress

Best for: PHP web applications, CMS integrations, traditional server-rendered websites

Get Started with PHP SDK โ†’

Choose Java SDK if you:

  • Use Java 1.8+ or Kotlin

  • Build enterprise applications

  • Use Maven or Gradle for dependency management

  • Need thread-safe client libraries

  • Work with Spring Boot, Jakarta EE, or other Java frameworks

  • Require strong compile-time safety

Best for: Enterprise Java applications, Android apps, microservices, Spring Boot projects

Get Started with Java SDK โ†’

API Compatibility

All SDKs are designed to work with Docs-Dispatcher API v3.6+. Feature availability depends on both SDK version and API version:

Feature
API Version Required
Node.js
PHP
Java

Basic Auth

v3.5+

All

All

All

Bearer Token (JWT)

v3.6+

v0.7.0+

v0.2+

All

Invoice Dispatcher

v3.6.2+

v0.7.0+

v0.2+

All

Universal Targets

v3.6.2+

v0.7.0+

v0.2+

All

E-Invoice Support

v3.7+

v0.7.0+

v0.2+

All

circle-exclamation

Common Workflows

1. Simple Document Generation

Generate a PDF from a template with data:

  • Node.js: FileDispatcher + setTemplateName() + dispatch()

  • PHP: FileService + ServiceMediator + Client::executeRequest()

  • Java: FileContentRequest + EndUserApiApi::dispatchersDispatch()

2. Email with Generated Attachment

Generate a document and send it via email in one API call:

  • All SDKs: Use service composition to chain FILE + EMAIL

3. Invoice Creation and Delivery

Create an invoice and have the provider send it:

  • Node.js: InvoiceDispatcher with builder pattern

  • PHP: InvoicingService with customer and items

  • Java: Build CompositeRequest with invoice data

4. Multi-Provider Dispatch

Send the same document via multiple channels:

  • All SDKs: Chain services like FILE + EMAIL + SMS + UPLOAD

Authentication Best Practices

circle-info

Recommendation: Always use Bearer Token (JWT) authentication for production applications. It's more secure and provides better audit trails.

Obtaining API Tokens

  1. Navigate to Settings โ†’ API Tokens

  2. Generate a new token with appropriate permissions

  3. Store the token securely (environment variables, secrets manager)

Security Guidelines

  • Never commit tokens to version control

  • Use environment variables for token storage

  • Rotate tokens regularly (quarterly or after team changes)

  • Use separate tokens for development, staging, and production

  • Implement token expiration and renewal logic

  • Log authentication failures for security monitoring

See Authentication Guidearrow-up-right for detailed information.

Next Steps

Choose Your SDK

Understand Services

Troubleshoot Issues

Community and Support

Migration Guides

Upgrading from an older SDK version? See the CHANGELOG in each SDK repository:

Last updated