TypeScript SDK for ShipStation API v2 - Type-safe REST client with full API coverage
npm install @lecxa/shipstation-sdkTypeScript SDK for ShipStation API v2.
``bash`
npm install @lecxa/shipstation-sdk
`typescript
import { ShipStationClient } from '@lecxa/shipstation-sdk';
const client = new ShipStationClient({
token: 'your-api-token',
});
// List shipments
const shipments = await client.shipments.list({ page: 1 });
// Create a label
const label = await client.labels.create({
shipment: {
ship_to: {
name: 'John Doe',
address_line1: '123 Main St',
city: 'Austin',
state_province: 'TX',
postal_code: '78701',
country_code: 'US',
},
ship_from: {
name: 'Your Store',
address_line1: '456 Warehouse Ave',
city: 'Austin',
state_province: 'TX',
postal_code: '78702',
country_code: 'US',
},
packages: [{
weight: { value: 1.5, unit: 'pound' },
}],
},
carrier_code: 'stamps_com',
service_code: 'usps_priority_mail',
});
// Calculate rates
const rates = await client.rates.calculate({
shipment: { / ... / },
});
`
The client organizes methods by resource:
- client.batches - Batch operationsclient.carriers
- - Carrier managementclient.labels
- - Label creation and managementclient.rates
- - Rate calculationclient.shipments
- - Shipment operationsclient.warehouses
- - Warehouse managementclient.webhooks
- - Webhook configuration
Additional resources available via direct module imports.
You can also import generated functions directly:
`typescript`
import { listShipments, createLabel } from '@lecxa/shipstation-sdk';
All types are exported:
`typescript``
import type {
CreateLabelRequestBody,
ListShipmentsParams,
Shipment,
} from '@lecxa/shipstation-sdk';
MIT