L3S DRM Developer Guide
Check if a User Has an Active Key for a Project
This Edge Function allows you to verify if a specific username currently holds an active activation key for a given project.
It will only work after the user has used the aircraft at least once in MSFS
Endpoint
POST /functions/v1/check-username-activeRequest Body
Send a JSON object with:
username(string): The MSFS/XBOX username to check (case-sensitive, needs EXACT match, including non-ascii chars).project_id(string): The project's unique ID (UUID).
{
"username": "XBOXUsername#101",
"project_id": "YOUR_PROJECT_ID"
}What It Does
- Database Lookup: Searches the
activation keystable for a record where:project_idmatches the given project,curr_usermatches the username (case-sensitive).
- Result:
- If a match is found, returns
{ "success": true }(HTTP 200). - If no match, returns
{ "error": "User not found for project" }(HTTP 499). - On error, returns an error message and appropriate HTTP status.
- If a match is found, returns
Generally, it's usually enough to check for a HTTP 200 response to determine if the user has an active key for the project.
Example cURL
curl --location 'https://kdlkczwmscovjiftqlwq.supabase.co/functions/v1/check-username-active' \
--header 'Content-Type: application/json' \
--data '{
"username": "XBOXUsername#101",
"project_id": "YOUR_PROJECT_ID"
}'Responses
- 200 OK
{ "success": true } - 499 User Not Found
{ "error": "User not found for project" } - 400 Bad Request
{ "error": "Missing username or project_id" } - 500 Database Error
{ "error": "Database error" }