The shipengine/js-api
library instantiates a batteries-included, vanilla JavaScript client for interacting with the ShipEngine API. The client provides a set of fully-typed methods that map directly to ShipEngine API operations[^1], bound to a user specified via platform token.
snake_case
for consumption by the ShipEngine API.camelCase
for use in JS.401 Unauthorized
responses, followed by retrying the original request.In addition to the client, the shipengine/js-api
lib provides TypeScript types for all ShipEngine API entities.
import { ShipEngineAPI } from "@shipengine/js-api";
const client = new ShipEngineAPI("your-platform-token", {
// Used when attempting to refresh the token on 401 responses
getToken: async () => {
return "your-platform-token";
},
});
client.shipments.list().then((response) => {
console.log(response.data);
// > an object matching the response schema of https://shipengine.github.io/shipengine-openapi/#operation/list_shipments
});
Generated using TypeDoc