> ## Documentation Index
> Fetch the complete documentation index at: https://developers.fireblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://developers.fireblocks.com/feedback

```json
{
  "path": "/reference/typescript-sdk",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# TypeScript SDK

<Note>
  **Install the Fireblocks Documentation MCP first.** Whether you're using an AI assistant or not, this makes it easy to search, reference, and keep your Fireblocks work grounded in the official docs. The setup steps are in [Getting Started](/docs/quickstart).
</Note>

# Overview

A Typescript developer can use the Fireblocks API easily with the official TypeScript SDK:

[The Fireblocks TypeScript SDK.](https://github.com/fireblocks/ts-sdk)

In this guide, you'll set up the Fireblocks SDK and see an example of a basic API script to create a vault and retrieve its data.

Additionally if you are developing on EVM chains - you might be using some of the familiar libraries, such as `web3.js` or `ethers.js` - Fireblocks is well intergrated into these libraries as described in the [Ethereum Development](doc:ethereum-development).

# Using the Fireblocks SDK

## Install Node v16 or newer

The Fireblocks JavaScript SDK requires **Node v16 or newer**. You can check which version of Node you already have installed by running the following command.

`node -v`

[Learn how to install or update Node to a newer version.](https://nodejs.org/en/download/)

## Install fireblocks/ts-sdk

The Fireblocks TypeScript SDK is open-source and is hosted on GitHub.

* **Source code:** [GitHub](https://github.com/fireblocks/ts-sdk)
* **JavaScript Package:** [NPM](https://www.npmjs.com/package/@fireblocks/ts-sdk)

Installing the latest SDK is easy with `npm`:

`npm install @fireblocks/ts-sdk`

## Your First Fireblocks TypeScript code example!

Now that you're set up, run a quick check for the API. The examples below will show you how to initialize the Fireblocks SDK, create a new vault account, query Fireblocks to get the vault accounts list and create a basic transfer transaction.

> **Use the correct API Base URL**
>
> In the following script, make sure you're using the correct value for `baseUrl` for your environment:
>
> * For US Sandbox workspaces: `https://sandbox-api.fireblocks.io`
> * For US Mainnet or Testnet workspaces: `https://api.fireblocks.io`
> * For EU Mainnet or Testnet workspaces: `https://eu-api.fireblocks.io`
> * For EU2 Mainnet or Testnet workspaces: `https://eu2-api.fireblocks.io`
>
> [Learn more about workspace differences](doc:workspace-environments).

```
import { readFileSync } from 'fs';
import { Fireblocks, BasePath, TransferPeerPathType } from "@fireblocks/ts-sdk";

const FIREBLOCKS_API_SECRET_PATH = "./fireblocks_secret.key";

// Initialize a Fireblocks API instance with local variables
const fireblocks = new Fireblocks({
    apiKey: "my-api-key",
    basePath: BasePath.Sandbox, // or assign directly to "https://sandbox-api.fireblocks.io/v1";
    secretKey: readFileSync(FIREBLOCKS_API_SECRET_PATH, "utf8"),
});

// creating a new vault account
async function createVault() {
    try {
        const vault = await fireblocks.vaults.createVaultAccount({
            createVaultAccountRequest: {
                name: 'My First Vault Account',
                hiddenOnUI: false,
                autoFuel: false
            }
        });
        console.log(JSON.stringify(vault.data, null, 2))
    } catch (e) {
        console.log(e);
    }
}

//retrive vault accounts
async function getVaultPagedAccounts(limit: number) {
    try {
        const vaults = await fireblocks.vaults.getPagedVaultAccounts({
            limit
        });
        console.log(JSON.stringify(vaults.data, null, 2))
    } catch (e) {
        console.log(e);
    }
}

// create a transaction
async function createTransaction(assetId, amount, srcId, destId) {
    let payload = {
        assetId,
        amount,
        source: {
            type: TransferPeerPathType.VaultAccount,
            id: String(srcId)
        },
        destination: {
            type: TransferPeerPathType.VaultAccount,
            id: String(destId)
        },
        note: "Your first transaction!"
    };
    const result = await fireblocks.transactions.createTransaction({ transactionRequest: payload });
    console.log(JSON.stringify(result, null, 2));
}

// createVault()
// getVaultPagedAccounts(10)
// createTransaction("ETH_TEST5", "0.1", "0", "1")
```
