curl --request POST \
--url https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audience": "public",
"expires_in_hours": 168,
"instructions": "<string>",
"max_seats": 2,
"max_votes_per_voter": 2,
"name": "<string>",
"spend_cap_credits": 2,
"total_vote_limit": 2
}
'import requests
url = "https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions"
payload = {
"audience": "public",
"expires_in_hours": 168,
"instructions": "<string>",
"max_seats": 2,
"max_votes_per_voter": 2,
"name": "<string>",
"spend_cap_credits": 2,
"total_vote_limit": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audience: 'public',
expires_in_hours: 168,
instructions: '<string>',
max_seats: 2,
max_votes_per_voter: 2,
name: '<string>',
spend_cap_credits: 2,
total_vote_limit: 2
})
};
fetch('https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions', 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.heybee.app/v1/experiments/{experiment_id}/voting-sessions",
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([
'audience' => 'public',
'expires_in_hours' => 168,
'instructions' => '<string>',
'max_seats' => 2,
'max_votes_per_voter' => 2,
'name' => '<string>',
'spend_cap_credits' => 2,
'total_vote_limit' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.heybee.app/v1/experiments/{experiment_id}/voting-sessions"
payload := strings.NewReader("{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.heybee.app/v1/experiments/{experiment_id}/voting-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"experiment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"max_seats": 123,
"max_votes_per_voter": 123,
"name": "<string>",
"revoked_at": "2023-11-07T05:31:56Z",
"token": "<string>",
"total_votes": 123,
"unique_voters": 123,
"voting_url": "<string>",
"audience": "public",
"instructions": "<string>",
"non_choice_responses": 0,
"paused_at": "2023-11-07T05:31:56Z",
"spend_cap_credits": 123,
"spend_spent_credits": 0,
"spend_used": 0,
"status": "active",
"total_vote_limit": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Voting Session
Create a shareable voting session for an experiment.
Only experiment owner/team members can create sessions. Returns a unique token that can be used to generate a shareable voting link.
curl --request POST \
--url https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audience": "public",
"expires_in_hours": 168,
"instructions": "<string>",
"max_seats": 2,
"max_votes_per_voter": 2,
"name": "<string>",
"spend_cap_credits": 2,
"total_vote_limit": 2
}
'import requests
url = "https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions"
payload = {
"audience": "public",
"expires_in_hours": 168,
"instructions": "<string>",
"max_seats": 2,
"max_votes_per_voter": 2,
"name": "<string>",
"spend_cap_credits": 2,
"total_vote_limit": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audience: 'public',
expires_in_hours: 168,
instructions: '<string>',
max_seats: 2,
max_votes_per_voter: 2,
name: '<string>',
spend_cap_credits: 2,
total_vote_limit: 2
})
};
fetch('https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions', 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.heybee.app/v1/experiments/{experiment_id}/voting-sessions",
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([
'audience' => 'public',
'expires_in_hours' => 168,
'instructions' => '<string>',
'max_seats' => 2,
'max_votes_per_voter' => 2,
'name' => '<string>',
'spend_cap_credits' => 2,
'total_vote_limit' => 2
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.heybee.app/v1/experiments/{experiment_id}/voting-sessions"
payload := strings.NewReader("{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.heybee.app/v1/experiments/{experiment_id}/voting-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heybee.app/v1/experiments/{experiment_id}/voting-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audience\": \"public\",\n \"expires_in_hours\": 168,\n \"instructions\": \"<string>\",\n \"max_seats\": 2,\n \"max_votes_per_voter\": 2,\n \"name\": \"<string>\",\n \"spend_cap_credits\": 2,\n \"total_vote_limit\": 2\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"experiment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"max_seats": 123,
"max_votes_per_voter": 123,
"name": "<string>",
"revoked_at": "2023-11-07T05:31:56Z",
"token": "<string>",
"total_votes": 123,
"unique_voters": 123,
"voting_url": "<string>",
"audience": "public",
"instructions": "<string>",
"non_choice_responses": 0,
"paused_at": "2023-11-07T05:31:56Z",
"spend_cap_credits": 123,
"spend_spent_credits": 0,
"spend_used": 0,
"status": "active",
"total_vote_limit": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
255Path Parameters
Body
Request to create a voting session.
public links allow anonymous voters; internal links require authenticated vote permission
public, internal Hours until link expires (defaults to 7 days)
1 <= x <= 8760Optional instructions shown to anonymous participants
4000Participant limit (null = unlimited)
x >= 1Votes per participant limit (null = unlimited)
x >= 1Optional name (auto-generated if not provided)
255Spend cap in credits for this voting link (null = unlimited). Preferred over total_vote_limit.
x >= 1Counted vote limit for this voting link (null = unlimited)
x >= 1Response
Successful Response
Response for a voting session.
public, internal 
