curl --request POST \
--url https://api.hexclave.com/api/v1/browser-actions \
--header 'Content-Type: application/json' \
--data '
{
"type": "impersonation",
"origin": "https://app.example.com",
"expires_in_millis": 300000,
"session_expires_in_millis": 7200000,
"user_id": "user_123"
}
'import requests
url = "https://api.hexclave.com/api/v1/browser-actions"
payload = {
"type": "impersonation",
"origin": "https://app.example.com",
"expires_in_millis": 300000,
"session_expires_in_millis": 7200000,
"user_id": "user_123"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'impersonation',
origin: 'https://app.example.com',
expires_in_millis: 300000,
session_expires_in_millis: 7200000,
user_id: 'user_123'
})
};
fetch('https://api.hexclave.com/api/v1/browser-actions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hexclave.com/api/v1/browser-actions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'impersonation',
'origin' => 'https://app.example.com',
'expires_in_millis' => 300000,
'session_expires_in_millis' => 7200000,
'user_id' => 'user_123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hexclave.com/api/v1/browser-actions"
payload := strings.NewReader("{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hexclave.com/api/v1/browser-actions")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hexclave.com/api/v1/browser-actions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}"
response = http.request(request)
puts response.read_body{
"id": "browser_action_code",
"url": "https://app.example.com/?hexclave_action_id=browser_action_code",
"expires_at_millis": 1800000000000
}Create a browser action
Creates a single-use link to one of the project’s trusted origins that, when opened, makes the Hexclave SDK on that page perform an action in the browser: signing in as a given user (impersonation) or showing the clickmap overlay. Requires server or higher access.
curl --request POST \
--url https://api.hexclave.com/api/v1/browser-actions \
--header 'Content-Type: application/json' \
--data '
{
"type": "impersonation",
"origin": "https://app.example.com",
"expires_in_millis": 300000,
"session_expires_in_millis": 7200000,
"user_id": "user_123"
}
'import requests
url = "https://api.hexclave.com/api/v1/browser-actions"
payload = {
"type": "impersonation",
"origin": "https://app.example.com",
"expires_in_millis": 300000,
"session_expires_in_millis": 7200000,
"user_id": "user_123"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'impersonation',
origin: 'https://app.example.com',
expires_in_millis: 300000,
session_expires_in_millis: 7200000,
user_id: 'user_123'
})
};
fetch('https://api.hexclave.com/api/v1/browser-actions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hexclave.com/api/v1/browser-actions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'impersonation',
'origin' => 'https://app.example.com',
'expires_in_millis' => 300000,
'session_expires_in_millis' => 7200000,
'user_id' => 'user_123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hexclave.com/api/v1/browser-actions"
payload := strings.NewReader("{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hexclave.com/api/v1/browser-actions")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hexclave.com/api/v1/browser-actions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"impersonation\",\n \"origin\": \"https://app.example.com\",\n \"expires_in_millis\": 300000,\n \"session_expires_in_millis\": 7200000,\n \"user_id\": \"user_123\"\n}"
response = http.request(request)
puts response.read_body{
"id": "browser_action_code",
"url": "https://app.example.com/?hexclave_action_id=browser_action_code",
"expires_at_millis": 1800000000000
}Body
The action the SDK performs after the link is opened. impersonation signs the browser in as user_id; clickmap-overlay mounts the clickmap overlay.
impersonation, clickmap-overlay "impersonation"
The project's trusted origin where the link opens. The action can only be consumed by a request whose Origin header matches this value.
"https://app.example.com"
How long the single-use link remains redeemable, in milliseconds.
300000
Lifetime of the impersonation session, measured from link creation. Ignored for clickmap-overlay actions.
7200000
ID of the user to impersonate. Required when type is impersonation and ignored for clickmap-overlay.
"user_123"
Response
Successful response
Opaque, single-use browser action ID.
"browser_action_code"
URL at the requested trusted origin containing the browser action ID. Open it in the target browser to perform the action.
"https://app.example.com/?hexclave_action_id=browser_action_code"
Unix timestamp in milliseconds after which the browser action can no longer be consumed.
1800000000000