FiveM Radar API Documentation

API Documentation: FiveMRadar Player Insights

Base URL

https://radar.fivem.ph/api/player_insights

Headers

  • x-auth-key: (string, required) - API key for authentication.

1. Get Active Server Information

Retrieve the active server information for a specific player.

Endpoint

GET /player_insights?dataType=activeServer

Query Parameters

  • identifier: (string, required) - The unique player identifier, e.g., license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f.
  • country: (string, required) - The country code, e.g., ph.

Response

{
    "servername": "Outlaws City: Season..."
}

Example Request

GET https://radar.fivem.ph/api/player_insights?dataType=activeServer&identifier=license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f&country=ph

2. Get Server Insights

Retrieve insights such as playtime and the number of registered servers for a specific player.

Endpoint

GET /player_insights?dataType=serverinsight

Query Parameters

  • identifier: (string, required) - The unique player identifier, e.g., license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f.
  • country: (string, required) - The country code, e.g., ph.
  • serverId: (string, required) - The unique server identifier, e.g., ol3o7v.

Response

{
    "playtime": "1,693H",
    "registeredServers": "15"
}

Example Request

GET https://radar.fivem.ph/api/player_insights?dataType=serverinsight&identifier=license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f&country=ph&serverId=ol3o7v

3. Deep Search by Identifier

Retrieve a deep search result for a specific identifier, listing all associated identifiers.

Endpoint

GET /player_insights?dataType=deepsearchidentifier

Query Parameters

  • identifier: (string, required) - The unique player identifier, e.g., license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f.
  • country: (string, required) - The country code, e.g., ph.

Response

{
    "count": 4,
    "identifiers": [
        "steam:11000015b1954dc",
        "license2:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f",
        "license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f",
        "discord:1049528100452573194"
    ]
}

Example Request

GET https://radar.fivem.ph/api/player_insights?dataType=deepsearchidentifier&identifier=license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f&country=ph

4. Get Server History

Retrieve the server history for a specific player, including the servers they’ve joined, playtime, and last seen date.

Endpoint

GET /player_insights?dataType=serverhistory

Query Parameters

  • identifier: (string, required) - The unique player identifier, e.g., license:000175b461187c106c85062ea89e8247c0afd6da.
  • country: (string, required) - The country code, e.g., ph.

Response

[
    {
        "name": "[300] H.7",
        "serverid": "mmxzaq",
        "servername": "? Olympus City ? | ?...",
        "playtime": "0H",
        "lastSeen": "Mon, Sep 12, 2022 21:29"
    }
]

Example Request

GET https://radar.fivem.ph/api/player_insights?dataType=serverhistory&identifier=license:000175b461187c106c85062ea89e8247c0afd6da&country=ph

Authentication

All API requests must include the x-auth-key header for authentication.

Example Header

x-auth-key: your_api_key_here

Example: Using PerformHttpRequest in FiveM

-- Define your API endpoint and the x-auth-key
local apiUrl = "https://radar.fivem.ph/api/player_insights"
local apiKey = "your_api_key_here"

-- Example function to get active server information
function getActiveServerInfo(identifier, country)
    -- Construct the full URL with query parameters
    local requestUrl = apiUrl .. "?dataType=activeServer&identifier=" .. identifier .. "&country=" .. country

    -- Make the HTTP request
    PerformHttpRequest(requestUrl, function(statusCode, response, headers)
        -- Check if the request was successful
        if statusCode == 200 then
            -- Parse the JSON response
            local data = json.decode(response)
            
            -- Print the server name to the console
            print("Server Name: " .. data.servername)
        else
            -- Handle any errors
            print("Failed to get server info. Status code: " .. statusCode)
        end
    end, "GET", "", { ["x-auth-key"] = apiKey })
end

-- Example usage of the function
local playerIdentifier = "license:df75fb0c8ee65a2ba80b45533aec48a0df8fd83f"
local playerCountry = "ph"

getActiveServerInfo(playerIdentifier, playerCountry)

Explanation

  1. API Endpoint and API Key:

    • The apiUrl variable holds the base URL of the API.
    • The apiKey variable contains the value for the x-auth-key header required for authentication.
  2. Construct the Request URL:

    • The function getActiveServerInfo takes in two parameters, identifier and country, which are used to build the full URL with the necessary query parameters.
  3. Perform the HTTP Request:

    • PerformHttpRequest is called with the constructed URL, a callback function, the request method (“GET”), an empty body (as it’s a GET request), and the headers including the x-auth-key.
  4. Handling the Response:

    • Inside the callback function, the status code is checked to determine if the request was successful.
    • If successful, the JSON response is parsed, and relevant data (like the server name) is printed to the console.
  5. Example Usage:

    • The function getActiveServerInfo is then called with a sample player identifier and country code to demonstrate how it works.

This example demonstrates a basic implementation of how to use PerformHttpRequest to interact with the FiveMRadar API from a FiveM server script.