Skip to content


JSON In ... JSON out

Shipping API integration - Sequence Diagram


Shipping API integration - Class Diagram



The client holds all data related to specific carrier API credentials and configurations

from import  DHLClient

dhlClient = DHLClient(
  "CARRIER_NAME"              # optional, will be DHL by default


The proxy takes care of the communication with the specific carrier's open API

Proxy Pattern

from import DHLProxy

dhlProxy = DHLProxy(dhlClient)

Or create a proxy with a custom mapper (If you extend or implement your own compatible Mapper).

from import DHLMapper

dhlMapper = DHLMapper(dhlClient)
customProxy = DHLProxy(dhlClient, dhlMapper)


The mapper handles the conversion from PurplShip united API Data types to Carrier specific API Datatypes.

Note: Here is the core of PurplShip extensibility and customizability. You can extend the default mapper or write your own.

In most common cases the developer integrating a shipping carrier API has to write or extend mappers

Data mapper Pattern PuplShip Mapper sample

Unified Data Models

Defined by cross-referencing common data types among multiple carriers, the unified data types constitute an intuitive shared API interface.

Explore the library API to know more about the type definitions.