<aside> ⚡ Hyperbeam is an API that makes it easy for developers to embed cloud computers in their websites.

</aside>

Want to chat? Join our Discord or send us an email at [email protected].

Table of Contents

Getting started

What is Hyperbeam?

Totally lost? Check out the video below 👇

https://hbdev-vids.hyperbeam.com/hb_api2.mp4

Cloud computers from the command line

Run the following commands in the terminal to start and stop cloud computers:

# Start a cloud computer session running Chromium
curl -X POST -H 'Authorization: Bearer <your-api-key>' \\
	<https://engine.hyperbeam.com/v0/vm>

# You will get a response similar to the one below. 
# You can visit embed_url in your browser to access the cloud computer.
# 
# {
#   "session_id": "52f968cb-6739-4197-83d7-2305fe5d6f54",
#   "embed_url": "<https://vwdrccwgpv181powg61ggyvy.hyperbeam.com/Uvloy2c5QZeD1yMF_l1vVA?token=c8iw3SmQglOU0ugfLr3dWY2LalSKI_WOGUldEt8knbw>",
#   "admin_token": "51JOZEEcMp4trCwbpTS3jjQc0lSmeAZpPfxioDqe73U"
# }

# End a cloud computer session
curl -X DELETE -H 'Authorization: Bearer <your-api-key>' \\
	<https://engine.hyperbeam.com/v0/vm/><session-id>

# List all active sessions
curl -H 'Authorization: Bearer <your-api-key>' \\
	<https://engine.hyperbeam.com/v0/vm>

Creating a simple application

Below is a simple application featuring a NodeJS backend that hits the REST API to start the cloud computer, and a frontend that leverages the NPM package to programmatically control it.

<aside> 💡 Check out our hello-world repository on GitHub for full the example

</aside>

const express = require('express')
const axios = require('axios')
const app = express()
let computer

// Get a cloud computer object. If no object exists, create it.
app.get('/computer', async (req, res) => {
  if (computer) {
    res.send(computer)
    return
  }
  const resp = await axios.post('<https://engine.hyperbeam.com/v0/vm>', {}, {
    headers: { 'Authorization': `Bearer ${process.env.HB_API_KEY}` }
  })
  computer = resp.data
  res.send(computer)
})
app.listen(8080, () => console.log('Server start at <http://localhost:8080>'))
<div style="font-family: sans-serif">
  <button id="gotoYouTubeBtn">Open Youtube.com</button>
  <p>Current website: <span id="currentSite"></p>
</div>
<div id="cloudComputerDiv" style="height:720px;width:1280px"></div>
<script type="module">
  import Hyperbeam from "<https://unpkg.com/@hyperbeam/iframe@latest/dist/index.js>"
  const resp = await fetch("/computer")
  const data = await resp.json()
  const hb = await Hyperbeam(cloudComputerDiv, data.embed_url)
  gotoYouTubeBtn.addEventListener("click", () => {
    hb.tabs.update({ url: "<https://youtube.com>" }) // Programmatic navigation
  })
  hb.tabs.onUpdated.addListener((tabId, changeInfo) => {
    if (changeInfo.title)
      currentSite.innerText = changeInfo.title // Listen to tab changes
  })
</script>

Features