Back
AuthorizedAuthorizedDocs
API Reference

User Accounts

End-user account system — let your users register, login, and redeem license keys directly inside your application or website using the Authorized API.

Note:All endpoints require your application API key via the x-api-key header. After login, use the returned token as the x-user-token header for authenticated requests.

Register

POST/api/v1/users/register

Create a new end-user account for your application.

x-api-keyrequired
header
Your application API key
emailrequired
string
User's email address (unique per application)
passwordrequired
string
Password — minimum 6 characters
username
string
Optional display name
Response
{
  "success": true,
  "message": "Account created",
  "user_id": "uuid-here"
}
C++ Example
// Register a new user
json body = {
  {"email", userEmail},
  {"password", userPassword},
  {"username", displayName}
};
auto res = http.Post("/api/v1/users/register", body.dump(), "application/json");

Login

POST/api/v1/users/login

Authenticate a user and receive a session token valid for 24 hours.

x-api-keyrequired
header
Your application API key
emailrequired
string
User's email
passwordrequired
string
User's password
Response
{
  "success": true,
  "token": "abc123...",
  "expires_at": "2026-03-19T12:00:00.000Z",
  "user": {
    "id": "uuid",
    "email": "user@example.com",
    "username": "john",
    "licenses": [
      {
        "license_key": "XXXX-XXXX-XXXX",
        "expires_at": "2027-01-01T00:00:00.000Z",
        "product_id": "uuid",
        "redeemed_at": "2026-03-18T10:00:00.000Z"
      }
    ]
  }
}
C++ Example
json body = {{"email", email}, {"password", password}};
auto res = http.Post("/api/v1/users/login", body.dump(), "application/json");
auto data = json::parse(res->body);

if (data["success"]) {
  std::string token = data["token"];
  // Store token for subsequent requests
}

Redeem License Key

POST/api/v1/users/redeem

Redeem a license key to the authenticated user's account. Each key can only be redeemed once.

x-api-keyrequired
header
Your application API key
x-user-tokenrequired
header
Token from login response
license_keyrequired
string
The license key to redeem
Response
{
  "success": true,
  "message": "License redeemed successfully",
  "license_key": "XXXX-XXXX-XXXX",
  "expires_at": "2027-01-01T00:00:00.000Z",
  "product_id": "uuid"
}
C++ Example
json body = {{"license_key", licenseKey}};
httplib::Headers headers = {
  {"x-api-key", APP_API_KEY},
  {"x-user-token", userToken}
};
auto res = http.Post("/api/v1/users/redeem", headers, body.dump(), "application/json");

Get Profile

GET/api/v1/users/me

Fetch the authenticated user's profile and all redeemed licenses.

x-api-keyrequired
header
Your application API key
x-user-tokenrequired
header
Token from login response
Response
{
  "success": true,
  "user": {
    "id": "uuid",
    "email": "user@example.com",
    "username": "john",
    "is_active": true,
    "created_at": "2026-03-18T10:00:00.000Z",
    "licenses": [
      {
        "license_key": "XXXX-XXXX-XXXX",
        "expires_at": "2027-01-01T00:00:00.000Z",
        "product_id": "uuid",
        "product_name": "Pro Plan",
        "redeemed_at": "2026-03-18T10:00:00.000Z"
      }
    ]
  }
}

Full Loader Flow Example

Tip:This is the recommended flow for building a loader or website auth using Authorized user accounts.
C++ Loader Flow
// 1. Show login form, collect email + password
// 2. Login
json loginBody = {{"email", email}, {"password", password}};
auto loginRes = http.Post("/api/v1/users/login", loginBody.dump(), "application/json");
auto loginData = json::parse(loginRes->body);

if (!loginData["success"]) {
  ShowError(loginData["message"]);
  return;
}

std::string userToken = loginData["token"];

// 3. Fetch profile to check redeemed licenses
httplib::Headers headers = {
  {"x-api-key", APP_API_KEY},
  {"x-user-token", userToken}
};
auto meRes = http.Get("/api/v1/users/me", headers);
auto meData = json::parse(meRes->body);

auto& licenses = meData["user"]["licenses"];
if (licenses.empty()) {
  // Prompt user to enter a license key and redeem it
  json redeemBody = {{"license_key", enteredKey}};
  http.Post("/api/v1/users/redeem", headers, redeemBody.dump(), "application/json");
}

// 4. User is authenticated with valid license — launch app