> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# FastPix Node.js SDK

The FastPix Node.js SDK is a type-safe Node.js client for the FastPix video API. From any Node.js application you can upload and manage videos, run live streams and simulcasts, create and secure playback IDs, manage playlists and signing keys, pull video analytics, verify webhooks, and use in-video AI features. It ships TypeScript types and works with both ES modules (ESM) and CommonJS.

\


> **Find more in the SDK reference**
>
> For all methods, runnable examples, and advanced usage, see the [FastPix Node.js SDK](https://github.com/FastPix/node-sdk) on GitHub.

\


## Before you begin

Make sure you have:

* Node.js 18 or later
* npm
* A FastPix account
* A FastPix Access Token and Secret Key, generated from the [FastPix Dashboard](https://dashboard.fastpix.com). See [Activate your account](/getting-started/activate-your-account).

FastPix uses HTTP Basic Authentication. The SDK maps your credentials as follows:

| SDK value  | FastPix credential |
| ---------- | ------------------ |
| `username` | Access Token       |
| `password` | Secret Key         |

> **Security:** Never commit your Access Token or Secret Key to source control. Use environment variables or a secure credential-management system.

Follow the steps below in order, and do not skip the verification steps. If installation, the ES module configuration, authentication, client initialization, or the first API request fails, fix that problem before continuing.

\


## Check your Node.js version

```bash
node --version
```

The output is similar to `v20.19.0` or a later version. The SDK supports Node.js 18 and later. If your version is earlier than 18, install a supported version before continuing.

You can also check your npm version:

```bash
npm --version
```

\


## Create a Node.js project

Create a directory for your application and initialize a Node.js project:

```bash
mkdir fastpix-node-sdk-demo
cd fastpix-node-sdk-demo
npm init -y
```

`npm init -y` creates a `package.json` file. Configure the project to use ES modules by adding `"type": "module"` to `package.json`:

```json
{
  "name": "fastpix-node-sdk-demo",
  "version": "1.0.0",
  "type": "module",
  "main": "example.js",
  "scripts": {
    "start": "node example.js"
  }
}
```

The `"type": "module"` setting tells Node.js to treat `.js` files as ES modules, so you can use `import { Fastpix } from "@fastpix/fastpix-node";` instead of `require(...)`.

\


## Install the FastPix SDK

Install the FastPix Node.js SDK with npm:

```bash
npm install @fastpix/fastpix-node
```

The SDK is added to your project's dependencies and installed in `node_modules`. You can confirm the installed package:

```bash
npm list @fastpix/fastpix-node
```

\


## Verify the SDK installation

Confirm that Node.js can import the SDK. Create a file named `example.js`:

```javascript
import { Fastpix } from "@fastpix/fastpix-node";

console.log("FastPix SDK imported successfully");
```

Run it:

```bash
node example.js
```

The expected output is `FastPix SDK imported successfully`. If it fails, confirm that Node.js 18 or later is installed, `"type": "module"` is set in `package.json`, `@fastpix/fastpix-node` is installed, and you are running the command from the project directory.

\


## Configure authentication

FastPix uses HTTP Basic Authentication, where `username` is your Access Token and `password` is your Secret Key. For local development, set these as environment variables so they stay out of your source code:

```bash
# macOS and Linux
export FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
export FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"
```

```powershell
# Windows PowerShell
$env:FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
$env:FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"
```

\


## Verify that your credentials are set

Check that both variables are set without printing their values:

```bash
node -e 'console.log("Access Token:", process.env.FASTPIX_USERNAME ? "set" : "missing"); console.log("Secret Key:", process.env.FASTPIX_PASSWORD ? "set" : "missing")'
```

Both should report `set`. If either is `missing`, set the corresponding environment variable before continuing.

\


## Initialize the FastPix client

Replace the contents of `example.js` with:

```javascript
import { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: process.env.FASTPIX_USERNAME,
    password: process.env.FASTPIX_PASSWORD,
  },
});

console.log("FastPix client initialized");
```

Run it:

```bash
node example.js
```

The expected output is `FastPix client initialized`. Initializing the client does not make an API request; a request happens only when you call an SDK operation such as `fastpix.inputVideo.create(...)`.

\


## Make your first API request

The easiest way to verify the integration is to create media from a publicly accessible video URL. FastPix provides a sample video at `https://static.fastpix.com/fp-sample-video.mp4`.

Replace the contents of `example.js` with:

```javascript
import { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: process.env.FASTPIX_USERNAME,
    password: process.env.FASTPIX_PASSWORD,
  },
});

async function run() {
  const response = await fastpix.inputVideo.create({
    inputs: [
      {
        type: "video",
        url: "https://static.fastpix.com/fp-sample-video.mp4",
      },
    ],
    metadata: {
      source: "fastpix-node-sdk-demo",
    },
  });

  console.log(JSON.stringify(response, null, 2));
}

run().catch((error) => {
  console.error("FastPix API request failed");
  console.error(error);
  process.exit(1);
});
```

Run it:

```bash
node example.js
```

A successful request returns information about the newly created media asset, similar to:

```json
{
  "success": true,
  "data": {
    "id": "5157e363-5abb-414d-83c7-520ecdc9f5fd",
    "status": "Created"
  }
}
```

The exact fields depend on the API response and the installed SDK version. A `media_id` is not the same as a `playback_id`. They identify different resources and are used for different operations.

\


## Retrieve the media asset

Use the media ID returned by the create operation to retrieve the media asset. Replace the contents of `example.js` with:

```javascript
import { Fastpix } from "@fastpix/fastpix-node";

const fastpix = new Fastpix({
  security: {
    username: process.env.FASTPIX_USERNAME,
    password: process.env.FASTPIX_PASSWORD,
  },
});

async function run() {
  console.log("Creating media...");

  const createResult = await fastpix.inputVideo.create({
    inputs: [
      {
        type: "video",
        url: "https://static.fastpix.com/fp-sample-video.mp4",
      },
    ],
    metadata: {
      source: "fastpix-node-sdk-demo",
    },
  });

  console.log("CREATE MEDIA", JSON.stringify(createResult, null, 2));

  const mediaId = createResult.data.id;
  console.log("\nMEDIA ID:", mediaId);

  console.log("\nRetrieving media...");

  const mediaResult = await fastpix.manageVideos.get({ mediaId });

  console.log("\nGET MEDIA", JSON.stringify(mediaResult, null, 2));
}

run().catch((error) => {
  console.error("\nFastPix API request failed");
  console.error(error);
  process.exit(1);
});
```

Run it:

```bash
node example.js
```

A successful response from the get-media operation confirms that the SDK authenticated, the media was created, a media ID was returned, and the media ID can be used in a subsequent API operation.

\


## Verify the integration

A successful create-then-get flow confirms that Node.js is installed and supported, your project is configured to use ES modules, the SDK is installed and importable, your credentials are configured, the client can authenticate, and you can create and retrieve a media asset.

Creating media is usually the first step in a FastPix on-demand workflow: you create the media, poll it until processing finishes, then create a playback ID to play it. The initial SDK integration is now complete.

\


## Resources, error handling, and reference

The SDK is generated from the FastPix API specification, so the complete and always-current reference lives in the repo and the API docs:

* **All resources, operations, error handling, retries, server selection, custom HTTP clients, standalone (tree-shakeable) functions, webhooks, and debugging**: the [FastPix Node.js SDK on GitHub](https://github.com/FastPix/node-sdk), with runnable code in the [examples](https://github.com/FastPix/node-sdk/tree/main/examples) directory.
* **Media** (upload, manage, playback, playlists, signing keys, DRM): [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).
* **Live** (streams, simulcasts, live playback): [Live Stream API](https://fastpix.com/docs/live-stream-api/overview).
* **Video Data** (metrics, views, dimensions, errors): [Video Data API](https://fastpix.com/docs/video-data-api/overview).
* **In-video AI** (summaries, chapters, named entities, moderation): [In-Video AI](/in-video-ai/overview).

\


#### Frequently asked questions

The SDK is a type-safe Node.js wrapper around the same FastPix REST API. It handles authentication, request serialization, and response parsing for you, so you call methods like `fastpix.inputVideo.create(...)` instead of building raw HTTP requests. Anything the SDK does, you can also do by calling the REST API directly. See [Make your first API request](#make-your-first-api-request).

Run `npm install @fastpix/fastpix-node` in your project, or the pnpm, yarn, or bun equivalent. See [Install the FastPix SDK](#install-the-fastpix-sdk).

FastPix uses HTTP Basic Authentication. Pass your Access Token as the `username` and your Secret Key as the `password` in the `security` object when constructing the client. See [Initialize the FastPix client](#initialize-the-fastpix-client).

Yes. The package ships TypeScript type definitions and works with both ES modules and CommonJS. For ESM, set `"type": "module"` in `package.json`. See [Create a Node.js project](#create-a-nodejs-project).

Create media from a URL or a direct upload through the input-video resource on the client, for example `fastpix.inputVideo.create(...)`. See [Make your first API request](#make-your-first-api-request).

FastPix uploads are not limited by your Node.js process memory. When you pull from a URL, FastPix fetches the file directly, and when you upload from a device, the SDK gives you a signed URL that the file goes to directly, so the bytes never pass through your Node.js application. Large multi-gigabyte files upload without extra configuration. See the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

Use the Live API resources to create and manage streams, simulcasts, and live playback IDs. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk) and the [Live Stream API](https://fastpix.com/docs/live-stream-api/overview).

Generate playback IDs and manage signing keys and DRM configurations through the Media API resources. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk) and the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

Create the media with a private access policy, then generate a signed playback ID so only holders of a valid token can play it. For stronger protection, enable DRM on the playback ID. You revoke access by deleting the playback ID. Handle all of this through the Media API resources. See the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

The SDK includes webhook signature verification through the `webhooks` resource, which verifies the signature and returns the parsed, trusted event in one call. The signing secret is separate from your API credentials. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk).

The Video Data API exposes metrics, views, dimensions, and errors for quality-of-experience monitoring. See the [Video Data API](https://fastpix.com/docs/video-data-api/overview).

Wrap calls in `try`/`catch` and check for the typed `FastpixError`, which exposes the message, status code, headers, and body. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk) for the error types each operation can throw.

Pass a retry configuration per call or at client initialization to control the backoff strategy. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk).

Every method is also available as a standalone function, so bundlers can tree-shake away everything you do not import. This is useful in serverless and browser-adjacent runtimes. See the [SDK reference on GitHub](https://github.com/FastPix/node-sdk).

Node.js 18 and later. See [Before you begin](#before-you-begin).

\


## What's next

Want to go further? Browse runnable, end-to-end samples for the FastPix Node.js SDK in the [examples folder](https://github.com/FastPix/node-sdk/tree/main/examples) of the GitHub repository.

\


## Release notes

For a complete history of releases, improvements, and fixes, see the [FastPix Node.js SDK CHANGELOG on GitHub](https://github.com/FastPix/node-sdk/blob/main/CHANGELOG.md).