import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const event = await client.events.create({
account_id: 'account_id',
event_name: 'course_completed',
});
console.log(event.id);curl --request POST \
--url https://api.whop.com/api/v1/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "<string>",
"event_name": "course_completed",
"context": {
"ad_campaign_id": "<string>",
"ad_id": "<string>",
"ad_set_id": "<string>",
"fbc": "<string>",
"fbclid": "<string>",
"fbp": "<string>",
"fingerprint": "<string>",
"fingerprint_confidence": 6.9,
"ga": "<string>",
"gbraid": "<string>",
"gclid": "<string>",
"ig_sid": "<string>",
"ip_address": "<string>",
"language": "<string>",
"li_fat_id": "<string>",
"msclkid": "<string>",
"rdt_cid": "<string>",
"sccid": "<string>",
"screen_resolution": "<string>",
"timezone": "<string>",
"ttclid": "<string>",
"ttp": "<string>",
"twclid": "<string>",
"user_agent": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_id": "<string>",
"utm_medium": "<string>",
"utm_source": "<string>",
"utm_term": "<string>",
"wbraid": "<string>"
},
"custom_name": "<string>",
"duration": 42,
"event_id": "evnt_xxxxxxxxxxxxx",
"event_time": "2023-12-01T05:00:00.401Z",
"plan_id": "plan_xxxxxxxxxxxxx",
"product_id": "prod_xxxxxxxxxxxxx",
"referrer_url": "<string>",
"resumed": true,
"source": "<string>",
"title": "<string>",
"url": "<string>",
"user": {
"anonymous_id": "<string>",
"birthdate": "1990-01-15",
"city": "<string>",
"country": "<string>",
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"linked_anonymous_id": "<string>",
"linked_wuid": "<string>",
"member_id": "mber_xxxxxxxxxxxxx",
"membership_id": "mem_xxxxxxxxxxxxxx",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"user_id": "user_xxxxxxxxxxxxx",
"username": "<string>"
},
"value": 6.9
}
'import requests
url = "https://api.whop.com/api/v1/events"
payload = {
"account_id": "<string>",
"event_name": "course_completed",
"context": {
"ad_campaign_id": "<string>",
"ad_id": "<string>",
"ad_set_id": "<string>",
"fbc": "<string>",
"fbclid": "<string>",
"fbp": "<string>",
"fingerprint": "<string>",
"fingerprint_confidence": 6.9,
"ga": "<string>",
"gbraid": "<string>",
"gclid": "<string>",
"ig_sid": "<string>",
"ip_address": "<string>",
"language": "<string>",
"li_fat_id": "<string>",
"msclkid": "<string>",
"rdt_cid": "<string>",
"sccid": "<string>",
"screen_resolution": "<string>",
"timezone": "<string>",
"ttclid": "<string>",
"ttp": "<string>",
"twclid": "<string>",
"user_agent": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_id": "<string>",
"utm_medium": "<string>",
"utm_source": "<string>",
"utm_term": "<string>",
"wbraid": "<string>"
},
"custom_name": "<string>",
"duration": 42,
"event_id": "evnt_xxxxxxxxxxxxx",
"event_time": "2023-12-01T05:00:00.401Z",
"plan_id": "plan_xxxxxxxxxxxxx",
"product_id": "prod_xxxxxxxxxxxxx",
"referrer_url": "<string>",
"resumed": True,
"source": "<string>",
"title": "<string>",
"url": "<string>",
"user": {
"anonymous_id": "<string>",
"birthdate": "1990-01-15",
"city": "<string>",
"country": "<string>",
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"linked_anonymous_id": "<string>",
"linked_wuid": "<string>",
"member_id": "mber_xxxxxxxxxxxxx",
"membership_id": "mem_xxxxxxxxxxxxxx",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"user_id": "user_xxxxxxxxxxxxx",
"username": "<string>"
},
"value": 6.9
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/events",
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([
'account_id' => '<string>',
'event_name' => 'course_completed',
'context' => [
'ad_campaign_id' => '<string>',
'ad_id' => '<string>',
'ad_set_id' => '<string>',
'fbc' => '<string>',
'fbclid' => '<string>',
'fbp' => '<string>',
'fingerprint' => '<string>',
'fingerprint_confidence' => 6.9,
'ga' => '<string>',
'gbraid' => '<string>',
'gclid' => '<string>',
'ig_sid' => '<string>',
'ip_address' => '<string>',
'language' => '<string>',
'li_fat_id' => '<string>',
'msclkid' => '<string>',
'rdt_cid' => '<string>',
'sccid' => '<string>',
'screen_resolution' => '<string>',
'timezone' => '<string>',
'ttclid' => '<string>',
'ttp' => '<string>',
'twclid' => '<string>',
'user_agent' => '<string>',
'utm_campaign' => '<string>',
'utm_content' => '<string>',
'utm_id' => '<string>',
'utm_medium' => '<string>',
'utm_source' => '<string>',
'utm_term' => '<string>',
'wbraid' => '<string>'
],
'custom_name' => '<string>',
'duration' => 42,
'event_id' => 'evnt_xxxxxxxxxxxxx',
'event_time' => '2023-12-01T05:00:00.401Z',
'plan_id' => 'plan_xxxxxxxxxxxxx',
'product_id' => 'prod_xxxxxxxxxxxxx',
'referrer_url' => '<string>',
'resumed' => true,
'source' => '<string>',
'title' => '<string>',
'url' => '<string>',
'user' => [
'anonymous_id' => '<string>',
'birthdate' => '1990-01-15',
'city' => '<string>',
'country' => '<string>',
'email' => '<string>',
'external_id' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'linked_anonymous_id' => '<string>',
'linked_wuid' => '<string>',
'member_id' => 'mber_xxxxxxxxxxxxx',
'membership_id' => 'mem_xxxxxxxxxxxxxx',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'user_id' => 'user_xxxxxxxxxxxxx',
'username' => '<string>'
],
'value' => 6.9
]),
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.whop.com/api/v1/events"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\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.whop.com/api/v1/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/events")
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 \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}Create Event
Tracks a conversion or engagement event for an account.
import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
const event = await client.events.create({
account_id: 'account_id',
event_name: 'course_completed',
});
console.log(event.id);curl --request POST \
--url https://api.whop.com/api/v1/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "<string>",
"event_name": "course_completed",
"context": {
"ad_campaign_id": "<string>",
"ad_id": "<string>",
"ad_set_id": "<string>",
"fbc": "<string>",
"fbclid": "<string>",
"fbp": "<string>",
"fingerprint": "<string>",
"fingerprint_confidence": 6.9,
"ga": "<string>",
"gbraid": "<string>",
"gclid": "<string>",
"ig_sid": "<string>",
"ip_address": "<string>",
"language": "<string>",
"li_fat_id": "<string>",
"msclkid": "<string>",
"rdt_cid": "<string>",
"sccid": "<string>",
"screen_resolution": "<string>",
"timezone": "<string>",
"ttclid": "<string>",
"ttp": "<string>",
"twclid": "<string>",
"user_agent": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_id": "<string>",
"utm_medium": "<string>",
"utm_source": "<string>",
"utm_term": "<string>",
"wbraid": "<string>"
},
"custom_name": "<string>",
"duration": 42,
"event_id": "evnt_xxxxxxxxxxxxx",
"event_time": "2023-12-01T05:00:00.401Z",
"plan_id": "plan_xxxxxxxxxxxxx",
"product_id": "prod_xxxxxxxxxxxxx",
"referrer_url": "<string>",
"resumed": true,
"source": "<string>",
"title": "<string>",
"url": "<string>",
"user": {
"anonymous_id": "<string>",
"birthdate": "1990-01-15",
"city": "<string>",
"country": "<string>",
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"linked_anonymous_id": "<string>",
"linked_wuid": "<string>",
"member_id": "mber_xxxxxxxxxxxxx",
"membership_id": "mem_xxxxxxxxxxxxxx",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"user_id": "user_xxxxxxxxxxxxx",
"username": "<string>"
},
"value": 6.9
}
'import requests
url = "https://api.whop.com/api/v1/events"
payload = {
"account_id": "<string>",
"event_name": "course_completed",
"context": {
"ad_campaign_id": "<string>",
"ad_id": "<string>",
"ad_set_id": "<string>",
"fbc": "<string>",
"fbclid": "<string>",
"fbp": "<string>",
"fingerprint": "<string>",
"fingerprint_confidence": 6.9,
"ga": "<string>",
"gbraid": "<string>",
"gclid": "<string>",
"ig_sid": "<string>",
"ip_address": "<string>",
"language": "<string>",
"li_fat_id": "<string>",
"msclkid": "<string>",
"rdt_cid": "<string>",
"sccid": "<string>",
"screen_resolution": "<string>",
"timezone": "<string>",
"ttclid": "<string>",
"ttp": "<string>",
"twclid": "<string>",
"user_agent": "<string>",
"utm_campaign": "<string>",
"utm_content": "<string>",
"utm_id": "<string>",
"utm_medium": "<string>",
"utm_source": "<string>",
"utm_term": "<string>",
"wbraid": "<string>"
},
"custom_name": "<string>",
"duration": 42,
"event_id": "evnt_xxxxxxxxxxxxx",
"event_time": "2023-12-01T05:00:00.401Z",
"plan_id": "plan_xxxxxxxxxxxxx",
"product_id": "prod_xxxxxxxxxxxxx",
"referrer_url": "<string>",
"resumed": True,
"source": "<string>",
"title": "<string>",
"url": "<string>",
"user": {
"anonymous_id": "<string>",
"birthdate": "1990-01-15",
"city": "<string>",
"country": "<string>",
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"linked_anonymous_id": "<string>",
"linked_wuid": "<string>",
"member_id": "mber_xxxxxxxxxxxxx",
"membership_id": "mem_xxxxxxxxxxxxxx",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"user_id": "user_xxxxxxxxxxxxx",
"username": "<string>"
},
"value": 6.9
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/events",
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([
'account_id' => '<string>',
'event_name' => 'course_completed',
'context' => [
'ad_campaign_id' => '<string>',
'ad_id' => '<string>',
'ad_set_id' => '<string>',
'fbc' => '<string>',
'fbclid' => '<string>',
'fbp' => '<string>',
'fingerprint' => '<string>',
'fingerprint_confidence' => 6.9,
'ga' => '<string>',
'gbraid' => '<string>',
'gclid' => '<string>',
'ig_sid' => '<string>',
'ip_address' => '<string>',
'language' => '<string>',
'li_fat_id' => '<string>',
'msclkid' => '<string>',
'rdt_cid' => '<string>',
'sccid' => '<string>',
'screen_resolution' => '<string>',
'timezone' => '<string>',
'ttclid' => '<string>',
'ttp' => '<string>',
'twclid' => '<string>',
'user_agent' => '<string>',
'utm_campaign' => '<string>',
'utm_content' => '<string>',
'utm_id' => '<string>',
'utm_medium' => '<string>',
'utm_source' => '<string>',
'utm_term' => '<string>',
'wbraid' => '<string>'
],
'custom_name' => '<string>',
'duration' => 42,
'event_id' => 'evnt_xxxxxxxxxxxxx',
'event_time' => '2023-12-01T05:00:00.401Z',
'plan_id' => 'plan_xxxxxxxxxxxxx',
'product_id' => 'prod_xxxxxxxxxxxxx',
'referrer_url' => '<string>',
'resumed' => true,
'source' => '<string>',
'title' => '<string>',
'url' => '<string>',
'user' => [
'anonymous_id' => '<string>',
'birthdate' => '1990-01-15',
'city' => '<string>',
'country' => '<string>',
'email' => '<string>',
'external_id' => '<string>',
'first_name' => '<string>',
'last_name' => '<string>',
'linked_anonymous_id' => '<string>',
'linked_wuid' => '<string>',
'member_id' => 'mber_xxxxxxxxxxxxx',
'membership_id' => 'mem_xxxxxxxxxxxxxx',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'user_id' => 'user_xxxxxxxxxxxxx',
'username' => '<string>'
],
'value' => 6.9
]),
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.whop.com/api/v1/events"
payload := strings.NewReader("{\n \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\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.whop.com/api/v1/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whop.com/api/v1/events")
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 \"account_id\": \"<string>\",\n \"event_name\": \"course_completed\",\n \"context\": {\n \"ad_campaign_id\": \"<string>\",\n \"ad_id\": \"<string>\",\n \"ad_set_id\": \"<string>\",\n \"fbc\": \"<string>\",\n \"fbclid\": \"<string>\",\n \"fbp\": \"<string>\",\n \"fingerprint\": \"<string>\",\n \"fingerprint_confidence\": 6.9,\n \"ga\": \"<string>\",\n \"gbraid\": \"<string>\",\n \"gclid\": \"<string>\",\n \"ig_sid\": \"<string>\",\n \"ip_address\": \"<string>\",\n \"language\": \"<string>\",\n \"li_fat_id\": \"<string>\",\n \"msclkid\": \"<string>\",\n \"rdt_cid\": \"<string>\",\n \"sccid\": \"<string>\",\n \"screen_resolution\": \"<string>\",\n \"timezone\": \"<string>\",\n \"ttclid\": \"<string>\",\n \"ttp\": \"<string>\",\n \"twclid\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_id\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"wbraid\": \"<string>\"\n },\n \"custom_name\": \"<string>\",\n \"duration\": 42,\n \"event_id\": \"evnt_xxxxxxxxxxxxx\",\n \"event_time\": \"2023-12-01T05:00:00.401Z\",\n \"plan_id\": \"plan_xxxxxxxxxxxxx\",\n \"product_id\": \"prod_xxxxxxxxxxxxx\",\n \"referrer_url\": \"<string>\",\n \"resumed\": true,\n \"source\": \"<string>\",\n \"title\": \"<string>\",\n \"url\": \"<string>\",\n \"user\": {\n \"anonymous_id\": \"<string>\",\n \"birthdate\": \"1990-01-15\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"linked_anonymous_id\": \"<string>\",\n \"linked_wuid\": \"<string>\",\n \"member_id\": \"mber_xxxxxxxxxxxxx\",\n \"membership_id\": \"mem_xxxxxxxxxxxxxx\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"user_id\": \"user_xxxxxxxxxxxxx\",\n \"username\": \"<string>\"\n },\n \"value\": 6.9\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}Authorizations
A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************
Headers
A unique key that makes this request safe to retry. See Idempotent requests.
255"d9105228-4a08-46b1-8b91-42fed586d383"
Body
Parameters for CreateConversion
The account to associate with this event.
The type of event.
Use a standard event (lead, submit_application, contact, complete_registration, schedule, view_content, add_to_cart) or pass your own name directly for a custom event.
"course_completed"
Where the event originated.
email, website, app, phone_call, chat, physical_store, system_generated, business_messaging, other Tracking and attribution context.
Show child attributes
Show child attributes
ISO 4217 currency code.
usd, sgd, inr, aud, brl, cad, dkk, eur, nok, gbp, sek, chf, hkd, huf, jpy, mxn, myr, pln, czk, nzd, aed, eth, ape, cop, ron, thb, bgn, idr, dop, php, try, krw, twd, vnd, pkr, clp, uyu, ars, zar, dzd, tnd, mad, kes, kwd, jod, all, xcd, amd, bsd, bhd, bob, bam, khr, crc, xof, egp, etb, gmd, ghs, gtq, gyd, ils, jmd, mop, mga, mur, mdl, mnt, nad, ngn, mkd, omr, pyg, pen, qar, rwf, sar, rsd, lkr, tzs, ttd, uzs, rub, btc, cny, usdt, kzt, awg, whop_usd, xau Custom event name when event_name is 'custom'. Maximum 35 chars for this value.
For 'leave' events: milliseconds the visitor spent on the page.
42
Client-provided identifier for deduplication. Generated if omitted.
"evnt_xxxxxxxxxxxxx"
When the event occurred. Defaults to now.
"2023-12-01T05:00:00.401Z"
The plan associated with the event.
"plan_xxxxxxxxxxxxx"
The product associated with the event.
"prod_xxxxxxxxxxxxx"
The referring URL.
For 'page' events: true when the page was restored from the back/forward cache.
For 'identify' events: where the identity was captured (url, form, manual, iframe).
For 'page' events: the document title.
The URL where the event occurred.
User identity and profile data.
Show child attributes
Show child attributes
Monetary value associated with the event.
6.9
Response
event created

