Skip to content
Pinner.xyz

Getting Started

Set up the Pinner SDK and pin your first file in about five minutes.

Prerequisites

Install the package

Initialize Pinner

The SDK needs an API key to authenticate. In a browser, pass it directly. On the server, read it from the environment.

import { Pinner } from "@lumeweb/pinner";
 
const pinner = new Pinner({
  jwt: "YOUR_JWT"
});

Upload your first file

uploadAndWait pins the file and waits for the pin to settle. It returns an UploadResult with the CID (may be undefined for TUS uploads until the server assigns it), name, size, and more.

const file = new File(["Hello, Pinner!"], "hello.txt", { type: "text/plain" });
const result = await pinner.uploadAndWait(file);
 
console.log("CID:", result.cid);

uploadAndWait handles the full cycle: it uploads the file, waits for pinning to complete, and returns an UploadResult with the CID (may be undefined for TUS uploads until the server assigns it), name, size, and more.

Verify the connection

Upload a small file and confirm you get a CID back. This proves both authentication and connectivity work end-to-end.

const file = new File(["ping"], "ping.txt", { type: "text/plain" });
const result = await pinner.uploadAndWait(file);
 
if (result.cid) {
  console.log("Connected! CID:", result.cid);
} else {
  console.log("Upload sent, operation ID:", result.id);
}

Type your config

If you prefer explicit types, import PinnerConfig:

import { Pinner, PinnerConfig } from "@lumeweb/pinner";
 
const config: PinnerConfig = {
  jwt: "YOUR_JWT",
  endpoint: "https://ipfs.pinner.xyz"
};
 
const pinner = new Pinner(config);

Ready to customize? See Configuration for endpoints, gateways, storage backends, and environment-specific setup.