SDKs overview

Shippo provides Software Development Kits (SDKs) to facilitate integration with its shipping API. These libraries are designed to simplify common operations such as retrieving shipping rates, creating labels, tracking shipments, and managing returns. By encapsulating API calls and handling request/response serialization, the SDKs reduce the amount of boilerplate code developers need to write, allowing them to focus on application logic. Shippo's approach to its API and SDKs is consistent with RESTful principles, using predictable resource-oriented URLs and standard HTTP response codes to indicate API status and errors. This design choice aligns with common industry practices for web service development, as outlined by organizations like the World Wide Web Consortium on REST.

The official SDKs are maintained by Shippo and are available for several popular programming languages. In addition to official support, the developer community sometimes contributes unofficial libraries or wrappers that can extend functionality or offer alternative integration patterns. While official SDKs are generally recommended for stability and direct support, community contributions can sometimes offer specialized features or language support not covered officially.

Integration with Shippo through these SDKs typically involves authenticating with an API key, configuring the client library, and then calling methods that correspond to specific API endpoints. The SDKs manage the underlying HTTP requests and JSON parsing, returning native language objects that represent the API responses. This abstraction aims to provide a more idiomatic development experience for each supported language, making it easier for developers to incorporate shipping capabilities into their applications.

Official SDKs by language

Shippo maintains official SDKs for a range of programming languages, ensuring direct support and compatibility with the latest API versions. These libraries are designed to provide a native-like experience for developers in their preferred language, abstracting the complexities of direct HTTP requests and JSON parsing. Each SDK includes functionalities for key Shippo API features, such as rate retrieval, label purchasing, manifest creation, and webhook management. Developers can find comprehensive guides and API references for these SDKs in the Shippo developer documentation.

The table below lists the officially supported SDKs, along with their respective package names and typical installation commands.

Language Package Name Install Command (Example) Maturity
Python shippo pip install shippo Stable
Ruby shippo gem install shippo Stable
Node.js shippo npm install shippo Stable
PHP shippo/shippo-php composer require shippo/shippo-php Stable
Java com.shippo:shippo-java (Maven/Gradle dependency) Stable
Go github.com/goshippo/shippo-go go get github.com/goshippo/shippo-go Stable
C# Shippo dotnet add package Shippo Stable

Installation

Installing a Shippo SDK generally follows the standard package management practices for each respective programming language. The process typically involves using a command-line tool to add the library as a dependency to your project. Before installation, developers should ensure they have the correct language runtime and package manager installed.

Python

To install the Python SDK, use pip, the Python package installer:

pip install shippo

Ruby

For Ruby projects, the SDK is installed via gem:

gem install shippo

Node.js

Node.js developers can install the SDK using npm or yarn:

npm install shippo
# or
yarn add shippo

PHP

The PHP SDK is managed with Composer:

composer require shippo/shippo-php

Java

Java projects typically use Maven or Gradle for dependency management. Add the following to your pom.xml (Maven) or build.gradle (Gradle) file. Refer to the Shippo Java SDK documentation for the latest version details.

Maven

<dependency>
    <groupId>com.shippo</groupId>
    <artifactId>shippo-java</artifactId>
    <version>LATEST_VERSION</version>
</dependency>

Gradle

implementation 'com.shippo:shippo-java:LATEST_VERSION'

Go

Install the Go SDK using the go get command:

go get github.com/goshippo/shippo-go/v2

Note: The /v2 at the end indicates the major version of the module. Developers should adjust this according to the Shippo Go SDK documentation for the current major version.

C#

For C# projects, the SDK is installed using the .NET CLI or NuGet Package Manager:

dotnet add package Shippo

Quickstart example

This example demonstrates how to use the Python SDK to retrieve shipping rates for a hypothetical parcel. It illustrates the basic steps of client initialization, object creation (address, parcel), and calling an API method.

Before running this code, replace YOUR_SHIPPO_API_KEY with your actual Shippo API key.

import shippo

# Replace with your actual Shippo API key
shippo.config.api_key = 'YOUR_SHIPPO_API_KEY'

# 1. Create 'From' and 'To' addresses
# The 'to' address is where the package is going
to_address = shippo.Address.create(
    name='Ms. Shippy', 
    street1='215 Clayton St.', 
    city='San Francisco', 
    state='CA', 
    zip='94117', 
    country='US'
)

# The 'from' address is where the package is coming from
from_address = shippo.Address.create(
    name='Shippo Team', 
    street1='25 Main St.', 
    city='San Francisco', 
    state='CA', 
    zip='94103', 
    country='US'
)

# 2. Create a Parcel object
# Dimensions and weight are required for rate calculation
parcel = shippo.Parcel.create(
    length='5', 
    width='5', 
    height='5', 
    distance_unit='in', 
    weight='2', 
    mass_unit='lb'
)

# 3. Create a Shipment object to get rates
# This combines the addresses and parcel information
shipment = shippo.Shipment.create(
    address_from=from_address.object_id,
    address_to=to_address.object_id,
    parcels=[parcel.object_id],
    async=False # Set to True for asynchronous rate retrieval
)

# 4. Print the available rates
if shipment.rates: # Check if rates were returned
    print(f"Found {len(shipment.rates)} shipping rates:")
    for rate in shipment.rates:
        print(f"  Carrier: {rate.provider}, Service: {rate.servicelevel.name}, Amount: {rate.amount} {rate.currency}")
else:
    print("No rates found for this shipment.")

# Example of retrieving a specific rate (e.g., the cheapest)
if shipment.rates:
    cheapest_rate = min(shipment.rates, key=lambda r: float(r.amount))
    print(f"\nCheapest rate: {cheapest_rate.provider} {cheapest_rate.servicelevel.name} for {cheapest_rate.amount} {cheapest_rate.currency}")

This quickstart demonstrates the fundamental workflow: defining origin and destination, specifying parcel details, and then querying for available shipping rates. Further operations, such as purchasing a label or tracking a shipment, would build upon these initial steps, utilizing other methods provided by the SDK.

Community libraries

While Shippo provides official SDKs for widely used programming languages, the broader developer community may also contribute unofficial libraries, wrappers, or plugins. These community-driven projects can offer support for additional languages, frameworks, or specialized use cases not covered by the official offerings. For instance, developers might create integrations with specific e-commerce platforms or content management systems.

When considering community libraries, it is important to evaluate their maintenance status, documentation quality, and compatibility with the latest Shippo API versions. Unlike official SDKs, community projects may not receive the same level of direct support or timely updates from Shippo. Developers should review the source code and community feedback to assess reliability and security before integrating such libraries into production environments. Resources like GitHub and public package repositories (e.g., PyPI, npmjs.com) are common places to discover these contributions, often alongside discussions in developer forums or Q&A sites like Stack Overflow.

For the most up-to-date and officially supported integration methods, developers are always directed to the Shippo official documentation. If a specific language or framework is not covered by an official SDK, the Shippo REST API reference provides comprehensive details for direct HTTP integration, which can serve as a basis for building custom client libraries.