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

shiprocket-sdk

v1.0.1

Published

SDK for Shiprocket integration

Readme

A TypeScript-first SDK for seamless interaction with the Shiprocket API. Designed for Node.js environments with full type safety and modern async/await support.

✨ Features

  • Full TypeScript Support - Type-safe API interactions with auto-completion
  • Complete API Coverage - All major Shiprocket resources and endpoints
  • Automatic Token Management - Handles authentication automatically
  • Modular Resource Structure - Organized resources (Orders, Shipments, Tracking, etc.)
  • Axios-based Client - With interceptors for error handling and logging
  • Comprehensive Type Definitions - Full TypeScript interfaces for all API responses

📦 Installation

Install the package using your preferred package manager:

# Using pnpm (recommended)
pnpm add shiprocket-sdk

# Using npm
npm install shiprocket-sdk

# Using yarn
yarn add shiprocket-sdk

⚡ Quick Start

Initialization

import { Shiprocket } from "shiprocket-sdk";

const shiprocket = new Shiprocket({
  token: "your-shiprocket-auth-token", // Get from auth.generateToken()
  logger: true, // Optional: Enable request/response logging
});

Basic Usage Examples

Authentication

// Generate authentication token
const authResponse = await shiprocket.auth.generateToken({
  email: "[email protected]",
  password: "your-password"
});

Create an Order

const newOrder = await shiprocket.orders.create({
  order_id: "order_123",
  order_date: "2024-01-15",
  pickup_location: "Primary",
  billing_customer_name: "John Doe",
  billing_last_name: "Doe",
  billing_address: "123 Main St",
  billing_city: "Mumbai",
  billing_pincode: "400001",
  billing_state: "Maharashtra",
  billing_country: "India",
  billing_email: "[email protected]",
  billing_phone: "9876543210",
  shipping_is_billing: true,
  order_items: [{
    name: "Product 1",
    sku: "PROD001",
    units: 1,
    selling_price: 100,
    discount: "",
    tax: "",
    hsn: 441122
  }],
  payment_method: "Prepaid",
  sub_total: 100,
  length: 10,
  breadth: 10,
  height: 10,
  weight: 0.5
});

Track a Shipment

// Track by AWB code
const trackingInfo = await shiprocket.tracking.trackByAWB("AWB123456");

// Track by order ID
const orderTracking = await shiprocket.tracking.trackByOrderId(12345);

📚 API Resources

The SDK provides access to all major Shiprocket API resources:

| Resource | Methods Available | Description | |------------|----------------------------------------------------------|---------------------------------------| | Auth | generateToken, logout | Authentication management | | Orders | create | Order creation and management | | Couriers | generateAWB, getList, checkServiceability, requestPickup | Courier operations and AWB generation | | Shipments | getAll, getById, cancel | Shipment tracking and management | | Tracking | trackByAWB, trackMultipleAWBs, trackByShipmentId, trackByOrderId | Comprehensive tracking operations | | Returns | create, createExchange, update, getAll, checkServiceability, generateAWB | Return and exchange handling | | Labels | generateManifest, printManifest, generateLabel, generateInvoice | Label and document generation | | Pickups | getAll, add | Pickup location management | | Products | getAll, getById, add, convertToQC, bulkImport, getSampleCSV | Product catalog management |

🔐 Authentication

The SDK handles token-based authentication. You'll need to:

  1. Create a Shiprocket account and get your email/password
  2. Use the auth.generateToken() method to get your access token
  3. Initialize the SDK with the received token
// Step 1: Generate token
const authResponse = await shiprocket.auth.generateToken({
  email: "[email protected]",
  password: "your-password"
});

// Step 2: Initialize SDK with token
const shiprocket = new Shiprocket({
  token: authResponse.token
});

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Useful Links