Back

Blog details

AIOZ Stream Node.js SDK: A Complete Getting Started Guide

AIOZ Network
6 min readAugust 07, 2026
aioz-streamguidedeveloper-apis
Getting Started: Node.js SDK, AIOZ Stream knowledge hub

To get started with the AIOZ Stream Node.js SDK, install @aiozstream/nodejs-client, create a client with your public and secret key, then call client.media.create and client.uploadVideo. The client splits large files into parts and calls complete for you.

This guide uses version 1.0.16, the latest on npm on Nov 4, 2026. It covers install, your first upload, the media methods you'll use next, errors, rate-limit headers and webhooks.

TL;DR:

  • Install with npm install @aiozstream/nodejs-client and pass publicKey and secretKey (or a bearerToken) to new StreamClient().
  • Upload in two calls, client.media.create then client.uploadVideo, or three with media.uploadPart and media.uploadMediaComplete.
  • Video methods live on client.media: getDetail, getMediaList, update, delete and more.
  • Errors are StreamError objects with the HTTP status in code and the API body in problemDetails.

Updated Nov 4, 2026: rechecked every method against the docs and the 1.0.16 package (video methods now live on client.media), and added real error output, the correct webhook fields, question headings and a diagram.

How do you install the AIOZ Stream Node.js SDK?

Install the package from npm with either npm or yarn, whichever your project already uses:

npm install @aiozstream/nodejs-client
# or
yarn add @aiozstream/nodejs-client

You can confirm the current version yourself. We ran this on Nov 4, 2026, and it printed 1.0.16:

npm view @aiozstream/nodejs-client version

Then create a client with the public and secret key of an API key from your dashboard. An upload-only key is enough for this guide, and our post on upload-only vs full-access API keys explains the difference:

import StreamClient from '@aiozstream/nodejs-client'

const client = new StreamClient({
  publicKey: process.env.STREAM_PUBLIC_KEY,
  secretKey: process.env.STREAM_SECRET_KEY
})

The constructor also accepts bearerToken instead of the key pair, and chunkSize in bytes. Keep your keys in environment variables rather than in code, so they never land in a repository.

How do you upload your first video?

An upload starts with a video object that holds only metadata, and then uploadVideo reads the file, splits it into parts, sends them and calls complete:

try {
  const video = await client.media.create({ title: 'First video', type: 'video' })
  await client.uploadVideo(video.data.id, './video.mp4', (p) =>
    console.log(`part ${p.currentChunk + 1}/${p.chunksCount}: ${p.uploadedBytes}/${p.totalBytes} bytes`)
  )
  console.log('uploaded', video.data.id)
} catch (e) {
  console.error(e.code, e.problemDetails)
}

The third argument is optional and reports progress per part, which you can feed straight into a progress bar. The Video API docs say a create request without type: 'video' is rejected, so we set it even though the SDK's own sample leaves it out.

Diagram of the AIOZ Stream Node.js client: media.create, uploadVideo splitting parts and calling complete, and the REST endpoints behind each method
What each Node.js client call sends to the AIOZ Stream API.

If you want a step between the upload and the complete call, use the three-call version instead:

await client.media.uploadPart(video.data.id, './video.mp4')
await client.media.uploadMediaComplete(video.data.id)

uploadPart also splits the file for you, so the only difference is that you decide when to call complete. Our chunked video upload tutorial shows the raw create, part and complete requests these methods send.

What the client does with your file

The docs say "chunking files is handled for you", and the 1.0.16 source shows how. By default the client cuts 50 MiB parts, and you can set chunkSize from 5 MiB to 128 MiB. It hashes each part with MD5, sets Content-Range, and uploadVideo sends up to five parts at once.

Two details differ from the raw API docs: the client numbers parts from 1, while the Video API example uses index 0. It also leaves whatever is left over as a short last part, so a 120 MiB file goes up as 50, 50 and 20 MiB. The docs don't explain either difference, so keep both in mind when you compare the SDK with your own loop.

The docs also say the client handles pagination and token refresh, but in 1.0.16 getMediaList takes offset and limit like the REST endpoint, so you still page through results yourself. We found no refresh logic in the source either, so pass a fresh bearerToken if you use one.

Working with your videos after upload

Everything else in the video lifecycle sits on client.media, and each method maps to one endpoint in the Node.js client docs:

  • getDetail(id): GET /media/{id}, the current state, qualities and asset URLs of one video.
  • getMediaList({ offset, limit, search }): POST /media, list and search the videos on your account.
  • getMediaPlayerInfo({ id }): GET /media/{id}/player.json, the data a player needs.
  • update(id, input): PATCH /media/{id}, change the title, description or other metadata.
  • delete(id): DELETE /media/{id}.
  • uploadThumbnail, createCaption and getCost cover thumbnails, captions and a transcoding price estimate.

The same client also exposes players, playlist, webhook, analytics, liveStream and mediaChapter, all with the same keys. If you'd rather work in Go, the AIOZ Stream Go client guide covers the same flow. The video streaming glossary explains terms like rendition and manifest that show up in these responses. If you let a coding assistant read the docs for you, our audit of whether an API is agent-friendly checks how AIOZ Stream's llms.txt files hold up.

How do you handle errors in the Node.js SDK?

A failed call throws a StreamError, whose code property holds the HTTP status, and problemDetails holds the JSON body the API returned. We ran the upload example above with placeholder keys on Nov 4, 2026, using Node.js 22 and client 1.0.16, and this is what it printed:

401 {
  status: 'error',
  reason: 'api-key-not-found',
  message: 'API key not found.',
  request_id: '01a1a608-885d-7333-9b6a-f3df11cf54c9'
}

Use code to decide what to do next. A 429 or a 5xx is usually worth retrying with backoff, while a 4xx such as this 401 means the request itself needs fixing:

try {
  await client.media.create({ title: 'First video', type: 'video' })
} catch (e) {
  if (e.code === 429 || e.code >= 500) {
    // back off and retry
  } else {
    // log e.problemDetails and surface the error
  }
}

Check e.code, not e.status, which is undefined on a StreamError.

Reading rate-limit headers

Each method returns only the response body by default, but most have a WithResponseHeaders variant that returns the headers too, as the docs show on the webhook client:

const { headers, body } = await client.webhook.listWithResponseHeaders()

The docs list X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Retry-After. The limits are 100 requests per minute for uploads, 200 for writes and 500 for reads. Our guide to handling 429s and rate-limit headers shows how to back off cleanly.

How AIOZ Stream handles it

Instead of polling getDetail after every upload, register a webhook once and let AIOZ Stream call you when encoding ends. The SDK's create request takes the event flags as camelCase booleans, which it sends as encoding_finished and encoding_failed:

await client.webhook.create({
  name: 'encoding-status',
  url: 'https://your-app.example.com/webhooks/aioz',
  encodingFinished: true,
  encodingFailed: true
})

Your endpoint is a normal route in your own server, and you should treat each delivery as possibly repeated. The webhook-driven video pipelines guide covers payloads and idempotency, and the AIOZ Stream developer guide maps the whole API.

What the docs don't cover yet: the client's parallel part uploads, its 1-based part index, and how token refresh works. The package README on npm still shows the older client.video names, so follow the docs page when the two disagree and start with the Node.js client docs.

Frequently Asked Questions

What is the npm package name for the AIOZ Stream Node.js SDK?
It's @aiozstream/nodejs-client, and version 1.0.16 was the latest on npm on Nov 4, 2026.

Do I need to handle chunked uploads myself?
No. Both uploadVideo and media.uploadPart split the file into parts, hash each one and set Content-Range for you.

Why does client.video return undefined?
In 1.0.16, video methods live on client.media, while older samples, including the package README, still use client.video.

How do I list all my videos?
Call client.media.getMediaList with offset and limit, and repeat with a higher offset until you have them all.

How do I check how close I am to a rate limit?
Use the WithResponseHeaders version of a method, which returns the X-RateLimit headers along with the body.

Should I retry every failed SDK call?
No. Retry a 429 or 5xx with backoff, and fix the request for any other 4xx, because sending it again unchanged will fail the same way.

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

What Is MPEG-DASH? How the MPD Manifest File Works

MPEG-DASH streams adaptive video over HTTP from an XML MPD file. See a real MPD: Periods, AdaptationSets, Representations, segment addressing and live MPDs.

aioz-stream
8 min readDecember 04, 2026
blog thumbnail

What Is CMAF? The Common Media Application Format Explained

What is CMAF? The ISO format that packages video as fragmented MP4 so one set of files serves HLS and DASH, with its chunks, brands and low-latency role.

aioz-stream
8 min readDecember 01, 2026
blog thumbnail

CBR vs VBR vs CRF and When to Use Each Rate Control Mode

CBR vs VBR vs CRF explained: what each video rate control mode holds fixed, how maxrate and bufsize cap it, our x264 test results, and which mode to use where.

aioz-stream
7 min readNovember 27, 2026
blog thumbnail

Live Streaming API Tutorial for Sessions and Real-Time Stats

A live streaming API tutorial for AIOZ Stream: create a session, push RTMP, poll real-time stats every 5 to 30 seconds, then list the saved recordings.

aioz-stream
7 min readNovember 24, 2026
blog thumbnail

Restream to Multiple Platforms With AIOZ Stream Multicast

Restream to multiple platforms by sending one feed to a relay. Learn the bandwidth math, platform rules and how AIOZ Stream multicast forwards your RTMP stream.

aioz-stream
6 min readNovember 20, 2026
blog thumbnail

MPEG-TS vs fMP4 for HLS Segments and When to Use Each

MPEG-TS vs fMP4 for HLS: how 188-byte TS packets and fMP4 init segments differ, what each costs in overhead, which codecs need fMP4, and when TS still fits.

aioz-stream
7 min readNovember 17, 2026