Client for JavaScript and Node.js
Mini JavaScript library in one file (ES module): methods rates, create, cancel, tracking, get, balance, buyCheapest, and verifyWebhook. Uses built-in fetch.
Downloadable files
- shippickup.js API client in Node.js, single file, no dependencies
What you’ll need
- Node.js 18 or newer.
- A ShipPickup account and a live API key (
sk_live_…) with the permissions specified in the instructions. The key is created in the dashboard under “API” and stored in your system settings or environment variable.
Step-by-step instructions
- Download
shippickup.jsand place it next to your script (project requires"type": "module"or.mjsextension). - Set the key in the environment variable
SHIPPICKUP_API_KEY(API address inSHIPPICKUP_API_URLif needed). - Import the class and call methods, example below. API errors throw
ShipPickupErrorwith status, code, and details.
Example
Node.js
import { ShipPickup } from "./shippickup.js";
const api = new ShipPickup(); // key: SHIPPICKUP_API_KEY environment variable
const rates = await api.rates({
from: { country: "US", postal_code: "10001" },
to: { country: "DE", postal_code: "10117" },
parcel: { weight_g: 800, length_mm: 250, width_mm: 180, height_mm: 80 },
});
const shipment = await api.create({ ...body, rate_id: rates.data[0].rate_id }, ShipPickup.idempotencyKey("order-10452"));
const tracking = await api.tracking(shipment.data.id);
await api.cancel(shipment.data.id, "Customer cancelled");
// in your webhook handler (raw body string and the X-Shipto-Signature header):
const ok = ShipPickup.verifyWebhook(rawBody, req.get("X-Shipto-Signature"), process.env.SHIPPICKUP_WEBHOOK_SECRET);Important to know
ShipPickup.idempotencyKey("order-10452")converts your order number into a valid idempotency key.
Files contain no keys or passwords: all secrets are set by you in environment settings. Do not publish files with your values.