Rest API
The RemoteHQ REST API allows you to programmatically interact with resources within the RemoteHQ domain. Complete API documentation can be found here.
First things first!
To begin using the RemoteHQ REST API, please email contact@remotehq.com to obtain an API Bearer token. Once a bearer token is obtained you can begin using the REST API.
Authentication
In order to safely and securely communicate with the REST API bearer authentication is used. This works by leveraging the HTTP Authorization header. Set this header value to Bearer 'your-token' and the API will safely authenticate your request.
WARNING
Make sure you do not expose the Bearer token to your users. Use it only in your backend API service. Your application frontend should never call api.remotehq.com directly. Always use your backend API service proxy.
See the examples below for specific usages for different programming languages.
Examples
The below examples demonstrate creating a Remote Browser embed instance via the REST API. Replace TOKEN with your API bearer token to successfully authenticate.
cURL
curl -X POST https://api.remotehq.com/v1/embed/remote-browser
-H "Authorization: Bearer {TOKEN}"
-H 'Content-Type: application/json'
-d '{"browserURL":"https://google.com","region":"us-east-1","resolution":"medium","features":["privacyMode", "drawingAnnotations"]}'
JavaScript
async function createRemoteBrowser() {
const response = await fetch("https://api.remotehq.com/v1/embed/remote-browser", {
method: "POST",
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${TOKEN}`
},
body: JSON.stringify({
browserURL: "https://google.com",
region: "us-east-1",
resolution: "medium",
features: ["privacyMode", "drawingAnnotations"]
})
});
return response.json();
}
Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
type createRemoteBrowserRequest struct {
BrowserURL string `json:"browserURL"`
Region string `json:"region"`
Resolution string `json:"resolution"`
Features []string `json:"features"`
}
func main() {
reqData := &createRemoteBrowserRequest{
BrowserURL: "https://google.com",
Region: "us-east-1",
Resolution: "medium",
Features: ["privacyMode", "drawingAnnotations"]
}
data, err := json.Marshal(reqData)
if err != nil {
log.Printf("error marshalling request data %v \n", err)
return
}
req, err := http.NewRequest(http.MethodPost, "https://api.remotehq.com/v1/embed/remote-browser", bytes.NewBuffer(data))
if err != nil {
log.Println("error creating request", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", "TOKEN"))
httpClient := new(http.Client)
res, err := httpClient.Do(req)
if err != nil {
log.Println("error executing request", err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Println("error reading response", err)
return
}
log.Println(string(body))
}
TIP
Once you have an instance created, you can play with your Remote Browser here: https://playground.remotehq.com
WARNING
In order to test interactions between multiple users on a single computer you must either use incognito mode or different browser for each user. This is due to the fact that we support a single unique user per browser.