Skip to main content

JavaScript (Node.js)


Our JavaScript SDK, blockfrost-js is a Node.js application and therefore typically requires a backend.


npm version

To run the SDK you need Node.js version 14 and higher.


We recommend setting up your own Node.js backend. Exposing your API keys in a frontend application is almost always a bad idea.

The SDK is hosted on, so you can directly import it using your favorite package manager.

npm i @blockfrost/blockfrost-js
yarn add @blockfrost/blockfrost-js

While you may find a way to run it directly in a browser, we don't actively support it or provide any type of assistance with such integrations.


Using the SDK is pretty straight-forward!


const Blockfrost = require("@blockfrost/blockfrost-js");
// import { BlockFrostAPI } from '@blockfrost/blockfrost-js'; // using import syntax

const API = new Blockfrost.BlockFrostAPI({
projectId: "YOUR API KEY HERE", // see:

async function runExample() {
try {
const latestBlock = await API.blocksLatest();
const networkInfo = await;
const latestEpoch = await API.epochsLatest();
const health = await;
const address = await API.addresses(
const pools = await API.pools({ page: 1, count: 10, order: "asc" });

console.log("pools", pools);
console.log("address", address);
console.log("networkInfo", networkInfo);
console.log("latestEpoch", latestEpoch);
console.log("latestBlock", latestBlock);
console.log("health", health);
} catch (err) {
console.log("error", err);



const Blockfrost = require("@blockfrost/blockfrost-js");
// import { BlockFrostIPFS } from '@blockfrost/blockfrost-js'; // using import syntax

const IPFS = new Blockfrost.BlockFrostIPFS({
projectId: "YOUR IPFS KEY HERE", // see:

async function runExample() {
try {
const added = await IPFS.add(`${__dirname}/img.svg`);
console.log("added", added);

const pinned = await;
console.log("pinned", pinned);
} catch (err) {
console.log("error", err);