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

@itwin/itwins-client

v2.5.3

Published

iTwins client for the iTwin platform

Readme

iTwins Client Library

npm version

A comprehensive TypeScript library for Bentley Systems' iTwins API, providing type-safe access to infrastructure digital twins, repositories, exports, and image management.

Table of Contents

Quick Start

Get up and running with iTwins Client in just a few steps:

npm install @itwin/itwins-client
import { ITwinsClient } from "@itwin/itwins-client";

const client = new ITwinsClient();
const accessToken = "your-access-token-string";
const response = await client.getITwins(accessToken, { subClass: "Project" });
console.log(`Found ${response.data!.iTwins.length} iTwins`);

Installation

# Using npm
npm install @itwin/itwins-client

# Using yarn
yarn add @itwin/itwins-client

# Using pnpm
pnpm add @itwin/itwins-client

Basic Usage

Authentication

All API methods require an access token string. See the iTwin Platform documentation for authentication setup.

Environment Configuration

Configure different deployment environments using globalThis.IMJS_URL_PREFIX:

// Development environment
globalThis.IMJS_URL_PREFIX = "dev-";

// QA environment
globalThis.IMJS_URL_PREFIX = "qa-";

// Production (default)
globalThis.IMJS_URL_PREFIX = undefined;

Configure max redirect limit for federated architecture (default: 5):

globalThis.IMJS_MAX_REDIRECTS = 10; // Increase if needed for multi-hop redirects

Documentation

Core Documentation

| Document | Purpose | |----------|---------| | Getting Started Guide | Complete setup and first steps | | API Examples | Comprehensive usage examples | | Migration Guide v1→v2 | Upgrading from v1.x to v2.x | | Contributing Guide | Development and contribution workflow | | AI Coding Instructions | Guidelines for AI assistants |

API Reference

Core Classes

  • ITwinsClient - Main client for all iTwins operations
  • BaseITwinsApiClient - Base client with common HTTP functionality

Key Features

  • Complete CRUD operations for iTwins and repositories
  • HAL specification compliance for navigation links
  • Image upload and processing capabilities
  • Export functionality for bulk data operations

Quick Reference

import { ITwinsClient } from "@itwin/itwins-client";
import type {
  BentleyAPIResponse,
  ITwinMinimal,
  MultiITwinMinimalResponse
} from "@itwin/itwins-client";

const client = new ITwinsClient();
const accessToken = "your-access-token-string";

// Get iTwins
const response = await client.getITwins(accessToken, {
  subClass: "Project",
  top: 10,
  resultMode: "minimal"
});

// Create iTwin
const newITwin = await client.createITwin(accessToken, {
  displayName: "My New iTwin",
  subClass: "Asset",
  class: "Thing"
});

// Work with repositories
const repos = await client.getRepositories(accessToken, iTwinId);

About this Repository

The @itwin/itwins-client package provides a modern, type-safe interface to Bentley Systems' iTwins platform APIs. It manages infrastructure digital twins (iTwins), repositories, exports, images, and related resources.

For more information about the iTwins platform and APIs, visit:

Development

Prerequisites

  • Node.js 18+ and pnpm
  • TypeScript 4.5+
  • Valid iTwin Platform credentials

Building from Source

git clone https://github.com/iTwin/itwins-client.git
cd itwins-client
pnpm install
pnpm build

Running Tests

.env file setup is required for tests view Getting Started for more information.

# Run all tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Run linting
pnpm lint

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • How to submit issues and feature requests
  • Development workflow and coding standards
  • Pull request process and review guidelines
  • Testing requirements and conventions
  • How to use changesets for versioning

Versioning

This project uses Changesets for version management. For more information view Contributing Guide.

License

Copyright © Bentley Systems, Incorporated. All rights reserved.

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