Validation API

Used for custom implimentations instead of using the default version.

Make sure your using the same SCRIPT_ID throughout the entire api

First, send a GET request to fetch script metadata and determine which validation checks are required.

lua
local GET_RES = request({
    Url = "https://rat.lat/scripts/SCRIPT_ID",
    Method = "GET",
    Headers = {
        ["Content-Type"] = "application/json"
    }
})

You can expect a response similar to the following:

json
{
  "name": "Example Script",
  "requireHWID": true,
  "requireIP": true
}

Using the response, build your validation payload based on the required checks.

lua
local info = HttpService:JSONDecode(GET_RES.Body)

local payload = {
    key = USER_KEY,
    executor = getexecutorname()
}

-- HWID check
if info.requireHWID then
    local hwid = getHWID()
    if not hwid then
        return "Missing HWID"
    end
    payload.hwid = hwid
end

-- IP validation is handled automatically by the request

Once the payload is prepared, send a POST request to validate the key and receive the execution response.

lua
local POST_RES = request({
    Url = "https://rat.lat/scripts/SCRIPT_ID",
    Method = "POST",
    Headers = {
        ["Content-Type"] = "application/json"
    },
    Body = HttpService:JSONEncode(payload)
})

Example validation response:

json
{
  "success": true,
  "executions": 2,
  "executionLimit": 5,
  "execute": "print('Hello World')"
}

Finally, verify access and execute the returned script payload.

lua
local validation = HttpService:JSONDecode(POST_RES.Body)

if not validation.success then
    return "Access denied"
end

loadstring(validation.execute)()