Skip to main content

Getting started with hyperserve

Welcome to Hyperserve! We're excited to help you easily serve video to your users.

Step 1: Obtain your api key

To use our API, you first need an API key. You can get one by signing up to our dashboard and creating a new API key.

warning

We will only show you your API key one time just after creating it, make sure you save it privately and do not store it in version control.

Step 2: Install the SDK

npm install hyperserve-sdk

Then initialize the client on your server (never expose your API key to the browser):

import { HyperserveClient } from 'hyperserve-sdk';

const client = new HyperserveClient({ apiKey: process.env.HYPERSERVE_API_KEY });

Step 3: Upload your first video

Uploading a video is a three-step process: create the video record on the backend, upload the file directly to storage from the client, then confirm the upload is complete from the backend.

Step 3a: Create the video record

Call createVideo() on your server. It returns a presigned upload URL so the client can upload directly to storage without ever seeing your API key.

// On your server
const { id, uploadUrl, contentType } = await client.createVideo({
filename: 'my-video.mp4',
fileSizeBytes: videoFile.size,
resolutions: ['480p', '1080p'],
isPublic: true,
});
tip

See the Create Video API for more detailed information

Step 3b: Upload the file directly to storage

The client uploads the file directly to storage using the presigned URL. No API key is needed — it never touches your server.

// In the browser
import { putVideoToStorage } from 'hyperserve-sdk/browser';

await putVideoToStorage({
uploadUrl,
contentType,
file: videoFile,
onProgress: (percent) => console.log(`${percent}% uploaded`),
});

Step 3c: Confirm the upload

Once the file is uploaded, notify the API from your server so it can verify the file and start transcoding.

// On your server
await client.completeUpload(id);
tip

See the Complete Upload API for more detailed information

Step 4: Wait for processing to complete

Videos usually take seconds to process, but larger videos can take some time. You'll have to wait for the video to complete processing before you can access the urls to view the hosted videos. You can check if the video is ready by viewing the status on the GET public/private video api responses. We can also notify your application automatically with webhooks, see our webhook guide for more information.

Step 5: Retrieve your video at runtime

After your video has been uploaded and you've confirmed video processing is complete, you can retrieve the video at runtime using another API call:

Public video

info

If you setup webhooks, you can save your public video url(s) when receiving the processing complete webhook, and you could skip this step.

const video = await client.getVideo(YOUR_HYPERSERVE_VIDEO_ID);
const videoUrl = video.resolutions['480p']?.videoUrl;
tip

See the Get Public Video API for more detailed information

Private video

info

Private video requires retrieving signed url(s) at runtime with a specific expiration time

const video = await client.getVideo(YOUR_HYPERSERVE_VIDEO_ID, {
private: true,
expirationSeconds: 3600,
});
const videoUrl = video.resolutions['480p']?.videoUrl;
tip

See the Get Private Video API for more detailed information

That's it! You're now ready to start using our Hyperserve. If you have any questions, feel free to reach out to our support team.