Skip to main content

Error response format

{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "API Key is invalid or inactive",
    "timestamp": "2026-03-06T12:00:00.000Z"
  }
}

HTTP error codes

CodeHTTPDescription
BAD_REQUEST400Request body validation failed (missing required fields, format error)
INVALID_API_KEY401API Key missing, invalid, or inactive game
RATE_LIMITED429Request rate limit exceeded
SESSION_NOT_FOUND404Game session not found (expired/deleted)
SESSION_ENDED410Game session already terminated
SESSION_ENDING410Game session termination in progress (grace period)
ALREADY_ENDED409Duplicate termination attempt on already-ended session
INTERNAL_ERROR500Internal server error

Business status codes

Returned as HTTP 200, delivered via the reason or result field in the response body.

verify response — reason

reasonDescriptionGame server action
OTT_EXPIREDOTT expired (over 1 min)Tell user to relaunch from the launcher
OTT_ALREADY_USEDOTT already consumedPrevent duplicate connections — kick user
GAME_MISMATCHOTT game / API Key game mismatchInvalid OTT — kick user
NOT_CHARGEABLEBilling not possible (insufficient G-coin)Tell user to recharge G-coin

heartbeat response — result

resultDescriptionGame server action
OKNormalWait until next heartbeat
CHARGE_EXHAUSTEDG-coin depletedNotify user. Server auto-terminates after 2 min grace period
SESSION_REPLACEDAnother session started on same PCStop heartbeat. Do not call session end

Error handling patterns

Retryable errors

-- Network errors and 5xx errors are retried on the next heartbeat cycle
if err == "NETWORK_ERROR" or string.sub(err, 1, 5) == "HTTP_5" then
    warn("[Playwave] Temporary error, will retry:", err)
    -- Auto-retry on next loop cycle
end

Session-lost errors

-- 404/410 errors mean the session is gone — stop heartbeat + kick user
if err == "HTTP_404" or err == "HTTP_410" then
    activeSessions[userId] = nil
    local player = Players:GetPlayerByUserId(userId)
    if player then
        player:Kick("PlayWave session expired")
    end
end

Ignorable errors

-- 404/409 on session end means already cleaned up — safe to ignore
if err == "HTTP_404" or err == "HTTP_409" then
    -- Normal operation — session already cleaned up
    return
end