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.
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: Upload your first video
Once you have your API key, you can upload your first video using an API call. Here's a basic example in JavaScript using the fetch
API:
const formData = new FormData();
formData.append('file', videoFile);
formData.append('resolutions', '144p,240p,480p');
formData.append('isPublic', 'true');
fetch(`https://dev.api.hyperserve.io/api/video`, {
method: 'POST',
headers: {
'X-API-KEY': YOUR_HYPERSERVE_API_KEY,
},
body: formData
});
See the Create Video Api for more detailed information
Step 3: 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 4: 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
If you setup webhooks, you can save your public video url(s) when receiving the processing complete webhook, and you could skip this step.
fetch(`https://dev.api.hyperserve.io/api/video/${YOUR_HYPERSERVE_VIDEO_ID}`, {
method: 'GET',
headers: {
'X-API-KEY': YOUR_HYPERSERVE_API_KEY
}
})
.then(response => response.json())
.then(data => {
console.log(data);
// The video URL can be found in the data object
const videoUrl = data.url;
// Use the videoUrl at runtime
});
See the Get Public Video Api for more detailed information
Private video
Private video requires retrieving signed url(s) at runtime with a specific expiration time
const EXPIRATION_SECONDS = '3600'; // Set to your desired value
fetch(`https://dev.api.hyperserve.io/api/video/${YOUR_HYPERSERVE_VIDEO_ID}/private/${EXPIRATION_SECONDS}`, {
method: 'GET',
headers: {
'X-API-KEY': YOUR_HYPERSERVE_API_KEY
}
})
.then(response => response.json())
.then(data => {
console.log(data);
// The video URL can be found in the data object
// This is a temporary, signed URL with an expiration time
const videoUrl = data.url;
// Use the videoUrl at runtime
});
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.