Skip to main content

Retrieving User Session on Subdomains

Date: 02/10/2026

Updated over a month ago

To enable the creation of more inventive campaign landing pages, it is now possible to retrieve the username and ID of the logged-in user on your landing and campaign pages.

  • Only subdomain pages are supported.

  • The subdomain must be whitelisted by us.

Please submit a ticket for the subdomain you wish to whitelist, and we will assist you with the setup process.

A sample script for fetching the user session after whitelisting is provided below:

(async () => {
const apiUrl = "https://api.mycasino.io";

try {
const response = await fetch(`${apiUrl}/v1/whoami`, {
method: "GET",
credentials: "include",
headers: { "Content-Type": "application/json" },
});

console.log(`%c Status: ${response.status} `, 'background: #222; color: #bada55; font-weight: bold;');

if (response.ok) {
const data = await response.json();
console.log("✅ Session data:", data);
} else {
console.warn("⚠️ Response:", await response.text());
}
} catch (error) {
console.error("❌ Fetch error:", error);
}
})();

You can use the user Id from the response in combination with the other endpoints under https://api.mycasino.io/v1/openapi and the Operator site data api (insert link to HC article) to build creative campaign landing pages.

Did this answer your question?