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

@crossmint/rest-js

v0.2.0

Published

Crossmint REST SDK for JavaScript and TypeScript

Readme

Crossmint REST SDK for JavaScript and TypeScript

A typed client for the Crossmint REST API. Supports Node.js 18+ and browsers with native Fetch, with ESM and CommonJS exports and no runtime dependencies.

Install

npm install @crossmint/rest-js

Create a client

import { createCrossmintSdk } from "@crossmint/rest-js";

const crossmint = createCrossmintSdk({
    environment: "staging",
    apiKey: process.env.CROSSMINT_API_KEY,
});

const { data: wallet } = await crossmint.wallets.create({
    body: { chainType: "evm", type: "mpc" },
    throwOnError: true,
});

The default environment is staging. Set environment: "production" to use the production API. The client routes each operation to its API host automatically, including Vault operations. Endpoints available only in staging reject requests in production.

To call through your own backend proxy or a local API, set baseUrl to an absolute URL. It replaces the API host and its /api path for every operation except Vault operations:

const crossmint = createCrossmintSdk({ baseUrl: "https://your-app.example/api/crossmint" });

Vault operations (payment method creation) send raw card and bank details, and only the Vault host tokenizes them. They stay on the Vault host when you set baseUrl. To move them too, set vaultBaseUrl. A server that receives these requests receives the raw card data, so it comes into your PCI DSS scope.

Keep server API keys on your server. In browsers, use a client API key with the appropriate scopes and supply userJwt when the endpoint requires user authentication. For order endpoints that accept an order client secret, use clientSecret. Each request uses a complete authentication alternative declared by the API; explicitly supplied request headers take precedence.

Requests and responses

Methods are grouped by resource, such as crossmint.wallets.create(...) and crossmint.orders.get(...). Request options keep body, path, query, and headers separate. Pass an AbortSignal through signal to cancel a request, or provide a custom Fetch implementation when creating the client.

const { data, error, response } = await crossmint.orders.get({
    path: { orderId: "your-order-id" },
});

if (error !== undefined) {
    console.error(response?.status, error);
} else {
    console.log(data);
}

HTTP failures return error by default. With throwOnError: true, the client throws the error instead. Network failures also return error unless throwOnError is enabled. Returned errors are not necessarily JavaScript Error instances.

Some APIs expose multiple versions explicitly, for example crossmint.paymentMethods.v20260916.create(...) and crossmint.paymentMethods.unstable.create(...). Use the version documented for your integration; unstable APIs may change.

Streaming

Streaming methods return an async iterator:

const abortController = new AbortController();
const { stream } = await crossmint.agentCheckouts.messages.stream({
    path: { id: "your-checkout-id" },
    signal: abortController.signal,
});

for await (const event of stream) {
    console.log(event);
}

React Query

Use SDK methods in query functions and mutations. Include the environment and project or user identity in your cache scope, so requests from different clients do not share cached results. Never put API keys or tokens in query keys.

import { useQuery } from "@tanstack/react-query";

const walletQuery = useQuery({
    queryKey: ["crossmint", cacheScope, "wallet", walletLocator],
    queryFn: async ({ signal }) => {
        const { data } = await crossmint.wallets.get({
            path: { walletLocator },
            signal,
            throwOnError: true,
        });
        return data;
    },
});

React Query is installed separately. The SDK does not depend on React.

Compatibility

The SDK is generated from Crossmint's public OpenAPI specification. Its endpoint coverage and request and response types follow that specification. TypeScript types do not perform runtime response validation.

The package supports bundlers that consume ESM and sideEffects: false. Completely unused imports can be removed; creating a resource client currently includes the full operation registry. Per-resource bundle splitting is not provided. React Native and other Fetch-compatible runtimes have not been validated.

See the API reference for endpoint behavior, permissions, and API limits.

Licensed under Apache 2.0. See THIRD_PARTY_NOTICES for the bundled Hey API transport's MIT license.