API Reference

Documentation

Everything you need to integrate your game with the Hoorks API. Follow these examples to start sending purchase notifications.

Authentication

All API requests must include your API key in the X-API-KEY header. Generate an API key from the admin dashboard.

Header
X-API-KEY: rdb_a1b2c3d4e5f6...
POST
/api/make-buy

Record a new purchase transaction and send a Discord notification.

Request Body

Required
FieldTypeDescription
userIdstringUser ID of the buyer
productIdstringProduct or item identifier
gamepassIdstring | nullGamepass ID, if applicable
isAGiftbooleanWhether the purchase is a gift
gifterIdstring | nullUser ID of the gifter
amountnumberAmount in Robux
universeIdstringUniverse ID
placeIdstringPlace ID
transactionIdstringUnique transaction identifier
timestampstringISO timestamp of the purchase
itemTypestringGamepass or DeveloperProduct

Request

POST /api/make-buy
POST /api/make-buy HTTP/1.1
Host: your-app.vercel.app
Content-Type: application/json
X-API-KEY: rdb_a1b2c3d4e5f6...

{
  "userId": "123456789",
  "productId": "sword-of-fire",
  "gamepassId": "GP-001",
  "isAGift": false,
  "gifterId": null,
  "amount": 499,
  "universeId": "987654321",
  "placeId": "111222333",
  "transactionId": "TXN-abc-123-def",
  "timestamp": "2025-01-15T14:30:00Z",
  "itemType": "Gamepass"
}

Response 201 Created

Response
{
  "success": true,
  "data": {
    "id": "uuid-generated",
    "userId": "123456789",
    "productId": "sword-of-fire",
    "transactionId": "TXN-abc-123-def",
    "amount": 499,
    "createdAt": "2025-01-15T14:30:01Z"
  }
}

Error 401

Error Response
{
  "error": "Invalid or missing API key"
}
GET
/api/items

Overview

Retrieve paginated transaction records.

Query Parameters

Optional
Pagination
ParamDefaultDescription
limit50Max 200
offset0Pagination offset
Filters
ParamDefaultDescription
userIdFilter by user
gifterIdFilter by gifter user ID
transactionIdFilter by transaction ID (unique)
itemTypeFilter by item type: Gamepass or DeveloperProduct

Tip: if transactionId is provided, other filters are ignored.

Request

GET /api/items
GET /api/items?limit=10&offset=0&userId=123456789&gifterId=987654321&itemType=Gamepass HTTP/1.1
Host: your-app.vercel.app
X-API-KEY: rdb_a1b2c3d4e5f6...

Response 200 OK

Response
{
  "success": true,
  "data": [ ... ],
  "pagination": {
    "total": 42,
    "limit": 10,
    "offset": 0
  }
}
Lua Integration

Ready-to-use Lua snippet for your game. Drop this into a server Script.

ServerScript.lua
local HttpService = game:GetService("HttpService")
local MarketplaceService = game:GetService("MarketplaceService")

local API_URL: string = "https://your-app.vercel.app/api/make-buy"
local API_KEY: string = "rdb_your_key_here"

export type ItemType = "Gamepass" | "DeveloperProduct"

type PurchaseData = {
    userId: string,
    productId: string,
    gamepassId: string?,
    isAGift: boolean,
    gifterId: string?,
    amount: number,
    universeId: string,
    placeId: string,
    transactionId: string,
    timestamp: string,
    itemType: ItemType,
}

local function recordPurchase(
    player: Player,
    productId: string,
    amount: number,
    itemType: ItemType,
    gamepassId: string?
)
    local data: PurchaseData = {
        userId = tostring(player.UserId),
        productId = productId,
        gamepassId = gamepassId,
        isAGift = false,
        gifterId = nil,
        amount = amount,
        universeId = tostring(game.GameId),
        placeId = tostring(game.PlaceId),
        transactionId = HttpService:GenerateGUID(false),
        timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ"),
        itemType = itemType,
    }

    local success: boolean, response = pcall(function()
        return HttpService:RequestAsync({
            Url = API_URL,
            Method = "POST",
            Headers = {
                ["Content-Type"] = "application/json",
                ["X-API-KEY"] = API_KEY
            },
            Body = HttpService:JSONEncode(data)
        })
    end)

    if success then
        print("[Hoorks] Purchase recorded:", response.StatusCode)
    else
        warn("[Hoorks] Failed to record purchase:", response)
    end
end

-- Gamepass purchase callback
MarketplaceService.PromptGamePassPurchaseFinished:Connect(
    function(player: Player, gamepassId: number, wasPurchased: boolean)
        if not wasPurchased then return end
        local info = MarketplaceService:GetProductInfo(gamepassId, Enum.InfoType.GamePass)
        recordPurchase(
            player,
            info.Name or tostring(gamepassId),
            info.PriceInRobux or 0,
            "Gamepass",
            tostring(gamepassId)
        )
    end
)

-- Developer Product purchase callback
MarketplaceService.ProcessReceipt = function(receiptInfo: {
    PlayerId: number,
    ProductId: number,
    PurchaseId: string,
})
    local player: Player? = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then return Enum.ProductPurchaseDecision.NotProcessedYet end

    local info = MarketplaceService:GetProductInfo(receiptInfo.ProductId, Enum.InfoType.Product)
    recordPurchase(
        player,
        info.Name or tostring(receiptInfo.ProductId),
        info.PriceInRobux or 0,
        "DeveloperProduct",
        nil
    )

    return Enum.ProductPurchaseDecision.PurchaseGranted
end