npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zonos/typescript-sdk

v0.1.7

Published

Streamline international ecommerce with the Zonos TypeScript SDK

Readme

Zonos TypeScript SDK

The Zonos TypeScript SDK offers a seamless way to interact with the Zonos Graph, providing a streamlined interface for the most commonly used queries and mutations. This SDK is designed to help developers easily access and manipulate data related to international ecommerce transactions, including product catalog items, classifications, and full landed cost calculations.

Installation

To use the Zonos TypeScript SDK in your project, install it via npm:

npm install @zonos/typescript-sdk

Or, if you prefer using Yarn:

yarn add @zonos/typescript-sdk

Quick Start

First, import the SDK and initialize it with your Zonos API credentials:

import { zonosClient } from '@zonos/typescript-sdk';

// Replace 'your_credential_token' with your actual Zonos API credential token
const credentialToken = 'your_credential_token';

Common Queries and Mutations

Fetching a Catalog Item

To fetch a catalog item, use the catalogItem method. This method requires a credentialToken and a variables object containing the id or the productId, and sku of the catalog item you want to retrieve.

Example:

const variables = {
  id: 'catalog_item_7a628c98-9ded-48c8-8831-b227f919e25d',
  productId: 'test',
  sku: 'test',
};

const { json, errors } = await zonosClient.catalogItem({
  credentialToken,
  variables,
});

Zonos Graph Documentation:

For more details on the catalogItem query and its parameters, visit the Query.catalogItem documentation.

Classifying an item

To classify an item, use the classificationsCalculate method. This method requires a credentialToken and a variables object containing the inputs array. Each item in the inputs array should have a name property.

Example:

const variables = {
  inputs: [{ name: 'backpack' }],
};

const { json, errors } = await zonosClient.classificationsCalculate({
  credentialToken,
  variables,
});

Zonos Graph Documentation:

For more details on the classificationsCalculate mutation and its parameters, visit the Mutation.classificationsCalculate documentation.

Full Landed Cost

To calculate the full landed cost of items, use the fullLandedCost method. This method requires a credentialToken and a variables object containing the itemCreateWorkflowInput array, the landedCostCalculateWorkflowInput object, and the partyCreateWorkflowInput array.

Example:

const variables = {
  itemCreateWorkflowInput: [
    {
      amount: 20,
      countryOfOrigin: 'CN',
      currencyCode: 'USD',
      description: 'Backpack',
      hsCode: '4202.92',
      productId: 'e89861c0-f04e-11ee-bc4f-4b0822420556',
      quantity: 1,
    },
    {
      amount: 1,
      countryOfOrigin: 'CN',
      currencyCode: 'USD',
      description: 'Fancy pen',
      hsCode: '4202.92',
      productId: 'g12345d1-f04e-11ee-bc4f-8c1393819393',
      quantity: 4,
    },
  ],
  landedCostCalculateWorkflowInput: {
    calculationMethod: 'DDP',
    endUse: 'NOT_FOR_RESALE',
    tariffRate: 'ZONOS_PREFERRED',
  },
  partyCreateWorkflowInput: [
    {
      location: {
        administrativeArea: '',
        administrativeAreaCode: 'QC',
        countryCode: 'CA',
        line1: '4398 St Laurent av',
        line2: ' ',
        locality: 'Montreal',
        postalCode: 'H2W 1Z5',
      },
      type: 'ORIGIN',
    },
    {
      location: {
        administrativeArea: '',
        administrativeAreaCode: '',
        countryCode: 'GB',
        line1: 'location line 1',
        locality: '',
        postalCode: 'SW1W 0NY',
      },
      type: 'DESTINATION',
    },
  ],
};

const { errors, json } = await zonosClient.fullLandedCost({
  credentialToken,
  variables,
});

Zonos Graph Documentation:

For more details on the itemCreateWorkflowInput, visit the Input.ItemCreateWorkflowInput documentation.

For more details on the landedCostCalculateWorkflowInput, visit the Input.LandedCostCalculateWorkflowInput documentation.

For more details on the partyCreateWorkflowInput, visit the Input.PartyCreateWorkflowInput documentation.

Creating an Order

To create an order from a landed cost calculation, use the orderCreate method. This method requires a credentialToken and a variables object containing the input object with the landedCostId and other order details.

Example:

const variables = {
  input: {
    accountOrderNumber: 'order-123',
    currencyCode: 'USD',
    landedCostId: 'landed_cost_123',
  },
};

const { errors, json } = await zonosClient.orderCreate({
  credentialToken,
  variables,
});

Zonos Graph Documentation:

For more details on the orderCreate mutation and its parameters, visit the OrderCreateInput documentation.

Zonos Client optional parameters

The Zonos Client provides methods for executing queries and mutations, and it handles the underlying HTTP requests to the Zonos API. It requires a credentialToken and a variables object as input parameters. In addition, it supports optional parameters such as customUrl, headers, and customFetch.

  /** @param credentialToken The token used to authenticate with the Zonos Graph */
  credentialToken: string;
  /**
   * @param customFetch Optional custom fetch function to send your own request,
   * or insert middleware between the generated query and the request.
   * */
  customFetch?: typeof fetch;
  /** @param customUrl Optional custom URL to use for the request instead of the built-in URL */
  customUrl?: string;
  /** @param headers Optional additional headers for the request */
  headers?: HeadersInit;

API Reference

For a detailed API reference, including the full list of queries and mutations available, as well as their corresponding input parameters and return types, please refer to the TypeScript type definitions included in the SDK.

License

The Zonos TypeScript SDK is licensed under the MIT License. See the LICENSE file for more details.