BetterAuth API Documentation
Complete reference for the BetterAuth licensing platform API. This RESTful API enables you to integrate authentication, license validation, user management, and more into your applications.
https://betterauth.online/api/v2/
Introduction
BetterAuth is a self-hosted software licensing platform that provides HWID-locked authentication, license key management, encrypted file delivery, user variables, webhooks, and real-time chat. The API follows REST conventions and returns JSON for all responses.
The typical authentication flow is:
- Call
POST /auth/initwith yourapp_secretto create a session. - Use the returned
session_idfor all subsequent requests. - Call
POST /auth/login,POST /auth/register, orPOST /auth/licenseto authenticate a user. - Access protected resources using the authenticated session.
Base URL
All endpoint paths in this documentation are relative to this base URL.
Authentication
Most endpoints require authentication via a session ID. Sessions are created by calling POST /auth/init with your application secret. The session ID can be passed in three ways:
| Method | Example |
|---|---|
| Request body parameter | {"session_id": "..."} |
X-Session-Id header | X-Session-Id: ... |
| Query parameter | ?session_id=... |
Common Headers
| Header | Description | Alternative |
|---|---|---|
X-App-Secret | Your application secret key | app_secret parameter |
X-Session-Id | Active session identifier | session_id parameter |
X-HWID | Hardware ID of the client | hwid parameter |
Content-Type | application/json for POST requests | — |
Response Format
All API responses follow a consistent JSON structure:
{
"success": true,
"message": "Operation completed successfully",
"data": { ... },
"timestamp": 1700000000
}Error Codes
| Code | Name | Description |
|---|---|---|
400 | BAD_REQUEST | Missing or invalid parameters |
401 | UNAUTHORIZED | Invalid or expired session |
403 | FORBIDDEN | Insufficient permissions or blacklisted |
404 | NOT_FOUND | Resource not found |
405 | METHOD_NOT_ALLOWED | Wrong HTTP method |
429 | RATE_LIMITED | Too many requests |
500 | INTERNAL_ERROR | Server-side error |
Rate Limiting
API requests are rate-limited per IP and per application. If you exceed the limit, the API returns a 429 status with a message indicating when you can retry. Rate limit headers are included in responses:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Remaining requests in current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
POST /auth/init
Initialize a new session with the application. This is the first call you must make before any other API operation. Returns a session_id that is required for all subsequent requests.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
app_secret | string | Required | Your application's secret key |
version | string | Optional | Client version string |
hwid | string | Optional | Hardware ID of the client machine |
Response
{
"success": true,
"message": "Session initialized",
"data": {
"session_id": "sess_abc123...",
"enckey": "encryption_key",
"app": {
"name": "My Application",
"version": "2.0"
}
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/auth/init \
-H "Content-Type: application/json" \
-d '{
"app_secret": "your_app_secret_here",
"version": "1.0.0",
"hwid": "user_hwid_here"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/auth/init",
json={
"app_secret": "your_app_secret_here",
"version": "1.0.0",
"hwid": "user_hwid_here"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/auth/init", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
app_secret: "your_app_secret_here",
version: "1.0.0",
hwid: "user_hwid_here"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
app_secret = "your_app_secret_here",
version = "1.0.0",
hwid = "user_hwid_here"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/auth/init", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"app_secret\":\"your_app_secret_here\","
"\"version\":\"1.0.0\",\"hwid\":\"user_hwid_here\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/auth/init");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/auth/init");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"app_secret\":\"your_app_secret_here\","
+ "\"version\":\"1.0.0\",\"hwid\":\"user_hwid_here\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"app_secret": "your_app_secret_here",
"version": "1.0.0",
"hwid": "user_hwid_here",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/auth/init",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/auth/init");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"app_secret" => "your_app_secret_here",
"version" => "1.0.0",
"hwid" => "user_hwid_here"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/auth/init")
.json(&serde_json::json!({
"app_secret": "your_app_secret_here",
"version": "1.0.0",
"hwid": "user_hwid_here"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/auth/init")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
app_secret: "your_app_secret_here",
version: "1.0.0",
hwid: "user_hwid_here"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)POST /auth/login
Authenticate a user with username and password. Requires an active session (from /auth/init). Optionally pass hwid for HWID-locked sessions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Session ID from /auth/init |
username | string | Required | User's username |
password | string | Required | User's password |
hwid | string | Optional | Hardware ID for HWID locking |
Response
{
"success": true,
"message": "Logged in successfully",
"data": {
"user": {
"username": "user123",
"email": "[email protected]",
"role": "user"
},
"subscription": {
"plan": "premium",
"expires": 1735689600
}
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/auth/login \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"username": "user123",
"password": "securepassword",
"hwid": "user_hwid_here"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/auth/login",
json={
"session_id": "your_session_id",
"username": "user123",
"password": "securepassword",
"hwid": "user_hwid_here"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
username: "user123",
password: "securepassword",
hwid: "user_hwid_here"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
username = "user123",
password = "securepassword",
hwid = "user_hwid_here"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/auth/login", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"username\":\"user123\","
"\"password\":\"securepassword\","
"\"hwid\":\"user_hwid_here\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/auth/login");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/auth/login");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"username\":\"user123\","
+ "\"password\":\"securepassword\","
+ "\"hwid\":\"user_hwid_here\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"username": "user123",
"password": "securepassword",
"hwid": "user_hwid_here",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/auth/login",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/auth/login");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"username" => "user123",
"password" => "securepassword",
"hwid" => "user_hwid_here"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/auth/login")
.json(&serde_json::json!({
"session_id": "your_session_id",
"username": "user123",
"password": "securepassword",
"hwid": "user_hwid_here"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/auth/login")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
username: "user123",
password: "securepassword",
hwid: "user_hwid_here"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)POST /auth/register
Register a new user account. Optionally associate with a license key and set email. Requires an active session.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Session ID from /auth/init |
username | string | Required | Desired username |
password | string | Required | Desired password |
key | string | Optional | License key to associate |
email | string | Optional | Email address |
hwid | string | Optional | Hardware ID |
Response
{
"success": true,
"message": "Account created successfully",
"data": {
"user": {
"username": "newuser",
"email": "[email protected]"
},
"subscription": {
"plan": "basic",
"expires": 1735689600
}
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/auth/register \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"username": "newuser",
"password": "securepassword",
"key": "XXXX-XXXX-XXXX-XXXX",
"email": "[email protected]",
"hwid": "user_hwid_here"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/auth/register",
json={
"session_id": "your_session_id",
"username": "newuser",
"password": "securepassword",
"key": "XXXX-XXXX-XXXX-XXXX",
"email": "[email protected]",
"hwid": "user_hwid_here"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/auth/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
username: "newuser",
password: "securepassword",
key: "XXXX-XXXX-XXXX-XXXX",
email: "[email protected]",
hwid: "user_hwid_here"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
username = "newuser",
password = "securepassword",
key = "XXXX-XXXX-XXXX-XXXX",
email = "[email protected]",
hwid = "user_hwid_here"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/auth/register", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"username\":\"newuser\","
"\"password\":\"securepassword\","
"\"key\":\"XXXX-XXXX-XXXX-XXXX\","
"\"email\":\"[email protected]\","
"\"hwid\":\"user_hwid_here\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/auth/register");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/auth/register");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"username\":\"newuser\","
+ "\"password\":\"securepassword\","
+ "\"key\":\"XXXX-XXXX-XXXX-XXXX\","
+ "\"email\":\"[email protected]\","
+ "\"hwid\":\"user_hwid_here\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"username": "newuser",
"password": "securepassword",
"key": "XXXX-XXXX-XXXX-XXXX",
"email": "[email protected]",
"hwid": "user_hwid_here",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/auth/register",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/auth/register");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"username" => "newuser",
"password" => "securepassword",
"key" => "XXXX-XXXX-XXXX-XXXX",
"email" => "[email protected]",
"hwid" => "user_hwid_here"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/auth/register")
.json(&serde_json::json!({
"session_id": "your_session_id",
"username": "newuser",
"password": "securepassword",
"key": "XXXX-XXXX-XXXX-XXXX",
"email": "[email protected]",
"hwid": "user_hwid_here"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/auth/register")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
username: "newuser",
password: "securepassword",
key: "XXXX-XXXX-XXXX-XXXX",
email: "[email protected]",
hwid: "user_hwid_here"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)POST /auth/license
Authenticate using a license key only (no username/password). Useful for headless or automated scenarios. Optionally pass hwid for HWID verification.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Session ID from /auth/init |
key | string | Required | License key |
hwid | string | Optional | Hardware ID for HWID locking |
Response
{
"success": true,
"message": "License authenticated",
"data": {
"subscription": {
"key": "XXXX-XXXX-XXXX-XXXX",
"plan": "premium",
"expires": 1735689600,
"status": "active"
}
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/auth/license \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX",
"hwid": "user_hwid_here"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/auth/license",
json={
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX",
"hwid": "user_hwid_here"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/auth/license", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
key: "XXXX-XXXX-XXXX-XXXX",
hwid: "user_hwid_here"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
key = "XXXX-XXXX-XXXX-XXXX",
hwid = "user_hwid_here"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/auth/license", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"key\":\"XXXX-XXXX-XXXX-XXXX\","
"\"hwid\":\"user_hwid_here\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/auth/license");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/auth/license");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"key\":\"XXXX-XXXX-XXXX-XXXX\","
+ "\"hwid\":\"user_hwid_here\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX",
"hwid": "user_hwid_here",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/auth/license",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/auth/license");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"key" => "XXXX-XXXX-XXXX-XXXX",
"hwid" => "user_hwid_here"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/auth/license")
.json(&serde_json::json!({
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX",
"hwid": "user_hwid_here"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/auth/license")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
key: "XXXX-XXXX-XXXX-XXXX",
hwid: "user_hwid_here"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)POST /auth/logout
Destroy an active session. After calling this endpoint, the session_id is no longer valid.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Session ID to destroy |
Response
{
"success": true,
"message": "Logged out successfully",
"data": null,
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/auth/logout \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/auth/logout",
json={
"session_id": "your_session_id"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/auth/logout", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new { session_id = "your_session_id" };
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/auth/logout", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/auth/logout");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/auth/logout");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/auth/logout",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/auth/logout");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/auth/logout")
.json(&serde_json::json!({
"session_id": "your_session_id"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/auth/logout")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = { session_id: "your_session_id" }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)GET /auth/check
Verify whether a session is still valid. Useful for checking if a user needs to re-authenticate.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Session ID to verify |
Response
{
"success": true,
"message": "Session is valid",
"data": {
"authenticated": true,
"expires": 1700086400
},
"timestamp": 1700000000
}GET /api/v2/auth/check?session_id=your_session_id or use the X-Session-Id header.
GET /user
Get the authenticated user's profile information. Requires a valid, authenticated session.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Authenticated session ID |
Response
{
"success": true,
"message": "User profile retrieved",
"data": {
"username": "user123",
"email": "[email protected]",
"role": "user",
"created_at": 1690000000
},
"timestamp": 1700000000
}GET /api/v2/user?session_id=your_session_id or use the X-Session-Id header.
GET /user/subscriptions
List all subscriptions for the authenticated user. Returns an array of subscription objects with plan details and expiration dates.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Authenticated session ID |
Response
{
"success": true,
"message": "Subscriptions retrieved",
"data": [
{
"plan": "premium",
"status": "active",
"expires": 1735689600,
"key": "XXXX-XXXX-XXXX-XXXX"
}
],
"timestamp": 1700000000
}GET /api/v2/user/subscriptions?session_id=your_session_id or use the X-Session-Id header.
GET /license/{key}
Retrieve information about a specific license key. Requires both the application secret and an authenticated session.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | License key (in URL path) |
app_secret | string | Required | Application secret (header or param) |
session_id | string | Required | Authenticated session ID |
Response
{
"success": true,
"message": "License info retrieved",
"data": {
"key": "XXXX-XXXX-XXXX-XXXX",
"status": "active",
"plan": "premium",
"expires": 1735689600,
"created_at": 1690000000,
"hwid": "locked_hwid_or_null"
},
"timestamp": 1700000000
}GET /api/v2/license/XXXX-XXXX-XXXX-XXXX?session_id=your_session_id with X-App-Secret header.
POST /license/validate
Validate a license key and check its status. Returns whether the license is valid, active, and not expired.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Authenticated session ID |
key | string | Required | License key to validate |
Response
{
"success": true,
"message": "License is valid",
"data": {
"valid": true,
"status": "active",
"expires": 1735689600
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/license/validate \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/license/validate",
json={
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/license/validate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
key: "XXXX-XXXX-XXXX-XXXX"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
key = "XXXX-XXXX-XXXX-XXXX"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/license/validate", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"key\":\"XXXX-XXXX-XXXX-XXXX\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/license/validate");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/license/validate");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"key\":\"XXXX-XXXX-XXXX-XXXX\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/license/validate",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/license/validate");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"key" => "XXXX-XXXX-XXXX-XXXX"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/license/validate")
.json(&serde_json::json!({
"session_id": "your_session_id",
"key": "XXXX-XXXX-XXXX-XXXX"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/license/validate")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
key: "XXXX-XXXX-XXXX-XXXX"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)GET /variable/{name}
Retrieve a global or user-specific variable. Global variables are set by the application owner. User variables are per-user. Requires an authenticated session.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Variable name (in URL path) |
session_id | string | Required | Authenticated session ID |
Response
{
"success": true,
"message": "Variable retrieved",
"data": {
"name": "config_url",
"value": "https://example.com/config.json",
"scope": "global"
},
"timestamp": 1700000000
}GET /api/v2/variable/config_url?session_id=your_session_id
POST /variable/{name}
Set or update a user-specific variable. The value is stored per-user and can be retrieved later with GET /variable/{name}.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Variable name (in URL path) |
session_id | string | Required | Authenticated session ID |
data | string | Required | Variable value to store |
Response
{
"success": true,
"message": "Variable set successfully",
"data": {
"name": "my_var",
"value": "some_value"
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/variable/my_var \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"data": "some_value"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/variable/my_var",
json={
"session_id": "your_session_id",
"data": "some_value"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/variable/my_var", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
data: "some_value"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
data = "some_value"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/variable/my_var", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"data\":\"some_value\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/variable/my_var");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/variable/my_var");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"data\":\"some_value\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"data": "some_value",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/variable/my_var",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/variable/my_var");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"data" => "some_value"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/variable/my_var")
.json(&serde_json::json!({
"session_id": "your_session_id",
"data": "some_value"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/variable/my_var")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
data: "some_value"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)GET /file/{id}
Download an encrypted file associated with the application. The file must be accessible to the user's subscription tier. Returns the file contents as a binary download.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | File ID (in URL path) |
session_id | string | Required | Authenticated session ID |
Response
Content-Disposition: attachment header. Check Content-Type for the file's MIME type.
enckey from your session to decrypt it client-side.
GET /api/v2/file/file_abc123?session_id=your_session_id
POST /log
Submit a log entry to the application's log system. Useful for tracking client-side events, errors, or user activity.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
session_id | string | Required | Authenticated session ID |
message | string | Required | Log message content |
Response
{
"success": true,
"message": "Log recorded",
"data": null,
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/log \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"message": "User logged in from 192.168.1.1"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/log",
json={
"session_id": "your_session_id",
"message": "User logged in from 192.168.1.1"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/log", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
message: "User logged in from 192.168.1.1"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
message = "User logged in from 192.168.1.1"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/log", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"message\":\"User logged in from 192.168.1.1\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/log");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/log");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"message\":\"User logged in from 192.168.1.1\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"message": "User logged in from 192.168.1.1",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/log",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/log");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"message" => "User logged in from 192.168.1.1"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/log")
.json(&serde_json::json!({
"session_id": "your_session_id",
"message": "User logged in from 192.168.1.1"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/log")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
message: "User logged in from 192.168.1.1"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)POST /webhook/{id}
Execute a pre-configured webhook. The webhook ID is set in the dashboard. Pass custom parameters to be included in the webhook payload.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Webhook ID (in URL path) |
session_id | string | Required | Authenticated session ID |
params | object | Optional | Custom parameters to pass |
Response
{
"success": true,
"message": "Webhook executed",
"data": {
"webhook_id": "wh_abc123",
"response_code": 200
},
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/webhook/wh_abc123 \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"params": {
"custom_field": "value"
}
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/webhook/wh_abc123",
json={
"session_id": "your_session_id",
"params": {
"custom_field": "value"
}
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/webhook/wh_abc123", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
params: {
custom_field: "value"
}
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
@params = new { custom_field = "value" }
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/webhook/wh_abc123", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"params\":{\"custom_field\":\"value\"}}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/webhook/wh_abc123");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/webhook/wh_abc123");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"params\":{\"custom_field\":\"value\"}}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"params": map[string]interface{}{
"custom_field": "value",
},
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/webhook/wh_abc123",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/webhook/wh_abc123");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"params" => ["custom_field" => "value"]
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/webhook/wh_abc123")
.json(&serde_json::json!({
"session_id": "your_session_id",
"params": { "custom_field": "value" }
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/webhook/wh_abc123")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
params: { custom_field: "value" }
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)GET /chat/{channel}
Retrieve recent chat messages from a channel. Messages are returned in chronological order with author info and timestamps.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
channel | string | Required | Channel name (in URL path) |
session_id | string | Required | Authenticated session ID |
Response
{
"success": true,
"message": "Messages retrieved",
"data": [
{
"author": "user123",
"message": "Hello!",
"timestamp": 1700000000
}
],
"timestamp": 1700000000
}GET /api/v2/chat/general?session_id=your_session_id
POST /chat/{channel}
Send a message to a chat channel. The message will be visible to all users in the channel.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
channel | string | Required | Channel name (in URL path) |
session_id | string | Required | Authenticated session ID |
message | string | Required | Message content |
Response
{
"success": true,
"message": "Message sent",
"data": null,
"timestamp": 1700000000
}curl -X POST https://betterauth.online/api/v2/chat/general \
-H "Content-Type: application/json" \
-d '{
"session_id": "your_session_id",
"message": "Hello everyone!"
}'import requests
response = requests.post(
"https://betterauth.online/api/v2/chat/general",
json={
"session_id": "your_session_id",
"message": "Hello everyone!"
}
)
print(response.json())const response = await fetch("https://betterauth.online/api/v2/chat/general", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: "your_session_id",
message: "Hello everyone!"
})
});
const data = await response.json();
console.log(data);using var client = new HttpClient();
var payload = new {
session_id = "your_session_id",
message = "Hello everyone!"
};
var response = await client.PostAsJsonAsync(
"https://betterauth.online/api/v2/chat/general", payload
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);// Requires libcurl
CURL *curl = curl_easy_init();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
const char *json = "{\"session_id\":\"your_session_id\","
"\"message\":\"Hello everyone!\"}";
curl_easy_setopt(curl, CURLOPT_URL, "https://betterauth.online/api/v2/chat/general");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);URL url = new URL("https://betterauth.online/api/v2/chat/general");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String json = "{\"session_id\":\"your_session_id\","
+ "\"message\":\"Hello everyone!\"}";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = json.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}payload := map[string]interface{}{
"session_id": "your_session_id",
"message": "Hello everyone!",
}
body, _ := json.Marshal(payload)
resp, err := http.Post(
"https://betterauth.online/api/v2/chat/general",
"application/json",
bytes.NewBuffer(body),
)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)$ch = curl_init("https://betterauth.online/api/v2/chat/general");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"session_id" => "your_session_id",
"message" => "Hello everyone!"
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;let client = reqwest::Client::new();
let res = client
.post("https://betterauth.online/api/v2/chat/general")
.json(&serde_json::json!({
"session_id": "your_session_id",
"message": "Hello everyone!"
}))
.send()
.await?;
let body: serde_json::Value = res.json().await?;
println!("{:?}", body);require "net/http"
require "json"
uri = URI("https://betterauth.online/api/v2/chat/general")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
session_id: "your_session_id",
message: "Hello everyone!"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(request)
}
puts JSON.parse(response.body)GET /blacklist/check
Check if an IP address or Hardware ID is on the application's blacklist. Pass at least one of ip or hwid.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ip | string | Optional* | IP address to check |
hwid | string | Optional* | Hardware ID to check |
* At least one of ip or hwid must be provided.
Response
{
"success": true,
"message": "Not blacklisted",
"data": {
"blacklisted": false
},
"timestamp": 1700000000
}GET /api/v2/blacklist/check?ip=192.168.1.1&hwid=user_hwid
GET /app/status
Get the current status of the application, including whether it's online/offline and the current version.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
app_secret | string | Required | Application secret (header or param) |
Response
{
"success": true,
"message": "Application online",
"data": {
"name": "My Application",
"status": "online",
"version": "2.0.0",
"users_online": 42
},
"timestamp": 1700000000
}GET /api/v2/app/status with X-App-Secret header.
GET /ping
Health check endpoint. Returns a simple pong response. No authentication required. Use this to verify the API is reachable.
Response
{
"success": true,
"message": "pong",
"data": null,
"timestamp": 1700000000
}GET https://betterauth.online/api/v2/ping.
v1 API (Legacy)
The v1 API is the legacy version and is maintained for backward compatibility. New integrations should use v2. The v1 API uses a slightly different request/response format.
Available Endpoints
| Endpoint | Method | Description |
|---|---|---|
/init | POST | Initialize session (same as v2 /auth/init) |
/login | POST | Login with credentials |
/register | POST | Register new user |
/license | POST | Login with license key |
/user | GET | Get user profile |
/subscriptions | GET | List user subscriptions |
/var | GET/POST | Get or set variables |
/file | GET | Download file |
/log | POST | Submit log entry |
/ping | GET | Health check |
/ban | GET | Check ban status |
/reset | POST | Reset HWID or password |
BetterAuth API Documentation — © 2026 BetterAuth. All rights reserved.
Questions? Visit betterauth.online