This guide will help you integrate ParcelShield into your shipping workflow.

Prerequisites

Installation

Basic Setup

import { ParcelShieldClient } from '@parcelshield/sdk';

const client = new ParcelShieldClient({
  apiKey: process.env.PARCELSHIELD_API_KEY,
  environment: 'production' // or 'sandbox' for testing
});

Your First Shipment

1

Create a Package

const package = await client.packages.create({
  weight: 2.5,
  dimensions: {
    length: 12,
    width: 8,
    height: 6
  },
  value: 500,
  requireSignature: true
});
2

Get Shipping Rates

const rates = await client.shipping.getRates({
  packageId: package.id,
  origin: {
    zipCode: '12345'
  },
  destination: {
    zipCode: '67890'
  }
});
3

Create Shipment

const shipment = await client.shipments.create({
  packageId: package.id,
  rateId: rates[0].id,
  recipient: {
    name: 'John Doe',
    address: '123 Main St'
  }
});

Next Steps