REST API V1 // DEVELOPER & GAME SERVER SYNC

Panduan Lengkap Game API & REST API v1

Dokumentasi menyeluruh setiap endpoint NoSatu beserta skema JSON, validasi payload, contoh siap pakai dalam format JSON, JavaScript/TypeScript, Lua Roblox, Lua FiveM, Python, dan cURL.

Autentikasi & Base URL

Gunakan API Key dari menu Billing, Voucher & API di Dashboard (paket Pro / White-Label). Kirim lewat header Authorization atau x-api-key.

Base: https://nosatu.my.id
Authorization: Bearer nst_live_xxx
x-api-key: nst_live_xxx

Rate Limit & Sinkronisasi Redis

  • Batas Permintaan120 req / menit
  • Format Bodyapplication/json
  • Event BroadcastBot PNG + OBS Overlay

Kode Status & Error

  • 200 / 201 — Sukses tersimpan ke DB
  • 400 — INVALID_PAYLOAD (cek issues[])
  • 401 — API_KEY_REQUIRED / INVALID_API_KEY
  • 403 — API_ACCESS_REQUIRES_PRO
  • 404 — BOARD_NOT_FOUND / TOURNAMENT_NOT_FOUND

Referensi Endpoint Detail

GET/api/v1/boardsAUTH: BEARER API KEY

Daftar Leaderboard Guild

Mengambil seluruh papan peringkat (Highscore, Classic, Time Speedrun, League, Levels, Pick'em) yang terdaftar di server Discord pemilik API Key.

// Endpoint GET — kirim tanpa request body
// Headers wajib:
{
  "Authorization": "Bearer nst_live_your_api_key"
}
CONTOH RESPONSE SUKSES
{
  "boards": [
    {
      "id": "b71c9c2e-941a-4b11-94c8-21a7d39f1011",
      "title": "FiveM Midnight Time Trial",
      "slug": "speedrun-trials",
      "type": "TIME",
      "eloConfig": { "startingElo": 1000, "kFactor": 32, "allowDraw": false },
      "createdAt": "2026-11-20T09:00:00.000Z"
    }
  ]
}
CONTOH RESPONSE ERROR
// 401 Unauthorized
{
  "error": "INVALID_API_KEY"
}
GET/api/v1/boards/:slugAUTH: BEARER API KEY

Baca Top 100 Peringkat Board

Mengambil metadata board beserta maksimal 100 entri peringkat teratas. Pengurutan otomatis mengikuti tipe board (timeMs ASC untuk TIME, bestScore DESC untuk HIGHSCORE/CLASSIC, rating DESC untuk LEAGUE/LEVELS).

FieldTipeStatusKeterangan
:slugpath stringWAJIBSlug unik board (contoh: speedrun-trials, aimlab-highscore).
// URL: GET /api/v1/boards/speedrun-trials
// Tanpa request body
{
  "Authorization": "Bearer nst_live_your_api_key"
}
CONTOH RESPONSE SUKSES
{
  "board": {
    "id": "b71c9c2e-941a-4b11-94c8-21a7d39f1011",
    "title": "FiveM Midnight Time Trial",
    "slug": "speedrun-trials",
    "type": "TIME"
  },
  "entries": [
    {
      "id": "f42e...",
      "discordId": "348192019283110022",
      "username": "RACER_01",
      "rating": 1000,
      "wins": 4,
      "draws": 0,
      "losses": 1,
      "bestScore": 42185,
      "updatedAt": "2026-11-27T10:15:00.000Z"
    }
  ]
}
CONTOH RESPONSE ERROR
// 404 Not Found
{
  "error": "BOARD_NOT_FOUND"
}
POST/api/v1/boards/:slug/entriesAUTH: BEARER API KEY

Push Skor, Lap Time (ms), Liga & XP Levels

Mengirim pembaruan skor atau aktivitas pemain langsung dari skrip game. Mendukung Highscore (ambil nilai tertinggi), Classic (akumulasi), Time (lap tercepat dalam ms), League (delta rating + W/D/L), serta Levels (tambah XP dan hitung level otomatis).

FieldTipeStatusKeterangan
discordIdstringWAJIBDiscord User ID pemain. Jika belum ada di DB, user dibuat otomatis.
usernamestring (max 64)OpsionalNama tampilan pemain saat record dibuat pertama kali.
scoreintegerOpsionalDipakai untuk HIGHSCORE (best peak) atau CLASSIC (akumulatif).
timeMsinteger (>= 1)OpsionalDipakai untuk tipe TIME / Racing Speedrun (milidetik, makin kecil makin cepat).
ratingDeltainteger (-500..500)OpsionalPerubahan poin untuk tipe LEAGUE / klasemen musiman.
outcome"WIN" | "DRAW" | "LOSS"OpsionalMenambah statistik Menang / Seri / Kalah entri board.
xpDeltainteger (1..50000)OpsionalTambahan XP untuk board tipe LEVELS; sekaligus memperbarui level user di guild.
// Contoh A: Highscore / Classic
{
  "discordId": "348192019283110022",
  "username": "RAKA_VLR",
  "score": 98420,
  "outcome": "WIN"
}

// Contoh B: Time Trial / Racing (ms)
{
  "discordId": "348192019283110022",
  "username": "RACER_01",
  "timeMs": 42185
}

// Contoh C: Levels XP
{
  "discordId": "348192019283110022",
  "xpDelta": 150
}
CONTOH RESPONSE SUKSES
{
  "entry": {
    "id": "9a1c3f41-...",
    "leaderboardId": "b71c9c2e-...",
    "userId": "c209...",
    "rating": 1000,
    "wins": 1,
    "draws": 0,
    "losses": 0,
    "bestScore": 42185,
    "updatedAt": "2026-11-27T11:02:11.000Z"
  }
}
CONTOH RESPONSE ERROR
// 400 Validation Error (Zod)
{
  "error": "INVALID_PAYLOAD",
  "issues": [
    { "path": ["discordId"], "message": "Required" }
  ]
}
GET/api/v1/tournamentsAUTH: BEARER API KEY

Daftar Turnamen Server

Mengambil seluruh turnamen yang dimiliki oleh server Discord terhubung API Key beserta genre, format bagan, dan status turnamen.

// GET /api/v1/tournaments
{
  "Authorization": "Bearer nst_live_your_api_key"
}
CONTOH RESPONSE SUKSES
{
  "tournaments": [
    {
      "id": "e182a451-...",
      "title": "NoSatu Open Season 1",
      "slug": "nosatu-open-s1",
      "genre": "FPS",
      "format": "SINGLE_ELIMINATION",
      "status": "LIVE",
      "maxParticipants": 16
    }
  ]
}
CONTOH RESPONSE ERROR
// 403 Forbidden (Tier Free/Starter)
{
  "error": "API_ACCESS_REQUIRES_PRO",
  "tier": "FREE"
}
GET/api/v1/tournaments/:slugAUTH: BEARER API KEY

Detail Turnamen, Roster & Daftar Match

Membaca metadata turnamen lengkap, daftar peserta terdaftar (untuk mencocokkan nama tim / seed di server game), serta list match saat ini.

FieldTipeStatusKeterangan
:slugpath stringWAJIBSlug turnamen target (contoh: nosatu-open-s1).
// GET /api/v1/tournaments/nosatu-open-s1
CONTOH RESPONSE SUKSES
{
  "tournament": { "id": "e182...", "title": "NoSatu Open Season 1", "status": "LIVE" },
  "participants": [
    { "id": "p1...", "teamName": "GARUDA FIVE", "seed": 1, "status": "CHECKED_IN" },
    { "id": "p2...", "teamName": "ARCHIPELAGO", "seed": 2, "status": "CHECKED_IN" }
  ],
  "matches": [
    { "id": "m1...", "round": 1, "matchFormat": "HEAD_TO_HEAD", "status": "PENDING" }
  ]
}
CONTOH RESPONSE ERROR
// 404 Not Found
{
  "error": "TOURNAMENT_NOT_FOUND"
}
POST/api/v1/tournaments/:slug/matchesAUTH: BEARER API KEY

Webhook Kirim Hasil Match Otomatis dari Game Server

Endpoint utama untuk integrasi game server (Roblox, FiveM, Minecraft, Valorant, Custom). Mendukung duel Head-to-Head maupun Multi-Lobby Racing/Battle Royale (hingga 100 peserta). Saat diterima, bot Discord langsung mem-broadcast pembaruan bracket PNG dan OBS Live Overlay via Redis.

FieldTipeStatusKeterangan
matchIduuidOpsionalIsi dengan UUID match jika ingin memperbarui match bracket yang sudah ada.
roundinteger (1..32)OpsionalNomor ronde / heat turnamen (default: 1).
externalMatchRefstring (max 120)OpsionalID unik match di server game Anda untuk jejak audit.
gameSource"ROBLOX" | "FIVEM" | "MINECRAFT" | "VALORANT" | "CUSTOM"OpsionalAsal engine game (default: CUSTOM).
participantsarray (1..100)WAJIBDaftar hasil tiap tim/pemain: { teamName, discordId?, inGameId?, score, placement?, kills?, timeMs?, isWinner }.
{
  "gameSource": "FIVEM",
  "round": 1,
  "externalMatchRef": "race-lobby-09",
  "participants": [
    {
      "teamName": "GARUDA FIVE",
      "score": 100,
      "placement": 1,
      "kills": 14,
      "timeMs": 74210,
      "isWinner": true
    },
    {
      "teamName": "ARCHIPELAGO",
      "score": 80,
      "placement": 2,
      "kills": 9,
      "timeMs": 75890,
      "isWinner": false
    }
  ]
}
CONTOH RESPONSE SUKSES
{
  "ok": true,
  "tournamentId": "e182a451-...",
  "matchId": "7d10b822-...",
  "gameSource": "FIVEM",
  "syncedToDiscordAndOverlay": true
}
CONTOH RESPONSE ERROR
// 400 Invalid Payload
{
  "error": "INVALID_PAYLOAD",
  "issues": [{ "path": ["participants"], "message": "Array must contain at least 1 element(s)" }]
}
GET/api/v1/pickem/eventsPUBLIK (TANPA KEY)

Daftar Event Pick'em & Klasemen Penonton

Mengambil daftar turnamen yang sedang terbuka untuk Pick'em beserta Top 25 klasemen poin prediksi penonton (dapat dipanggil tanpa API Key).

// GET /api/v1/pickem/events (Publik)
CONTOH RESPONSE SUKSES
{
  "events": [
    { "id": "e182...", "title": "NoSatu Open Season 1", "slug": "nosatu-open-s1", "genre": "FPS", "status": "LIVE" }
  ],
  "standings": [
    { "username": "Kenzo_Watch", "championPick": "GARUDA FIVE", "points": 215, "correctCount": 6 }
  ]
}
CONTOH RESPONSE ERROR
// Selalu mengembalikan HTTP 200 dengan array events & standings.
POST/api/v1/pickem/:slug/predictAUTH: DISCORD SESSION

Kirim / Update Prediksi Bracket Penonton

Menyimpan atau memperbarui prediksi pemenang per match dan juara Grand Final penonton yang sudah login dengan Discord OAuth2 cookie.

FieldTipeStatusKeterangan
picksRecord<string, string>WAJIBPeta ID/slot match ke nama tim pemenang (contoh: { 'QF-0': 'GARUDA FIVE' }).
championPickstring (1..80)WAJIBNama tim/peserta yang diprediksi menjadi Juara 1.
{
  "picks": {
    "QF-0": "GARUDA FIVE",
    "QF-1": "ARCHIPELAGO",
    "SF-0": "GARUDA FIVE",
    "FINAL": "GARUDA FIVE"
  },
  "championPick": "GARUDA FIVE"
}
CONTOH RESPONSE SUKSES
{
  "prediction": {
    "id": "p81c...",
    "tournamentId": "e182...",
    "championPick": "GARUDA FIVE",
    "points": 0,
    "correctCount": 0
  }
}
CONTOH RESPONSE ERROR
// 401 jika pengunjung belum login Discord
{
  "error": "UNAUTHORIZED"
}
GET/api/public/overlay/:guildId/:modePUBLIK (TANPA KEY)

Live JSON Feed OBS Overlay & Public Bracket

Mengambil payload real-time pertandingan aktif dan top klasemen guild untuk scene OBS Browser Source (`active-match`, `scoreboard`, `live-bracket`) maupun widget website komunitas Anda.

FieldTipeStatusKeterangan
:guildIdpath stringWAJIBDiscord Guild ID server turnamen.
:mode"active-match" | "scoreboard" | "live-bracket"WAJIBMode visualisasi broadcast target.
// GET /api/public/overlay/123456789012345678/active-match
// Juga tersedia:
// GET /api/public/tournaments/:slug
// GET /api/public/leaderboards
CONTOH RESPONSE SUKSES
{
  "guildName": "NoSatu Arena ID",
  "mode": "active-match",
  "activeMatch": {
    "title": "NoSatu Open Season 1",
    "teamA": "GARUDA FIVE",
    "teamB": "ARCHIPELAGO",
    "scoreA": 2,
    "scoreB": 0
  },
  "standings": []
}
CONTOH RESPONSE ERROR
// 404 Not Found
{
  "error": "GUILD_NOT_FOUND"
}

Template Modul Siap Pakai (Roblox, FiveM & Node.js)

Salin modul lengkap berikut ke proyek server game Anda untuk menghubungkan skor, lap time, dan hasil turnamen otomatis.

LUAU // HTTPSERVICE

Roblox Studio — Complete ModuleScript (ServerScriptService)

Membungkus autentikasi Bearer Key, pencatatan Highscore / Lap Time, dan laporan hasil turnamen dengan proteksi pcall agar server Roblox tidak crash saat jaringan lag.

Simpan sebagai ReplicatedStorage/NoSatuSDK (ModuleScript), panggil hanya dari Server Script.

local HttpService = game:GetService("HttpService")

local NoSatu = {}
NoSatu.BASE_URL = "https://nosatu.my.id"
NoSatu.API_KEY = "nst_live_your_api_key" -- Jangan simpan di LocalScript!

local function request(method, path, bodyTable)
  local ok, response = pcall(function()
    return HttpService:RequestAsync({
      Url = NoSatu.BASE_URL .. path,
      Method = method,
      Headers = {
        ["Authorization"] = "Bearer " .. NoSatu.API_KEY,
        ["Content-Type"] = "application/json",
      },
      Body = bodyTable and HttpService:JSONEncode(bodyTable) or nil,
    })
  end)

  if not ok then
    warn("[NoSatu] HTTP error:", response)
    return false, nil
  end

  local decoded = nil
  pcall(function()
    decoded = HttpService:JSONDecode(response.Body)
  end)
  return response.Success, decoded
end

function NoSatu.PushScore(boardSlug, discordId, username, score, timeMs)
  return request("POST", "/api/v1/boards/" .. boardSlug .. "/entries", {
    discordId = tostring(discordId),
    username = username,
    score = score,
    timeMs = timeMs,
  })
end

function NoSatu.PushMatchResult(tournamentSlug, gameSource, roundNum, participants)
  return request("POST", "/api/v1/tournaments/" .. tournamentSlug .. "/matches", {
    gameSource = gameSource or "ROBLOX",
    round = roundNum or 1,
    participants = participants,
  })
end

return NoSatu
LUA // PERFORMHTTPREQUEST

FiveM Server — Complete Sync Script (server.lua)

Mengirim hasil balapan multi-pemain (placement, timeMs) ke turnamen NoSatu sekaligus mengupdate papan Time Trial secara otomatis.

Letakkan di resource server-side Anda dan pastikan API Key diambil dari server.cfg ConVar.

local API_URL = "https://nosatu.my.id"
local API_KEY = GetConvar("nosatu_api_key", "")

local function nosatuPost(path, payload, cb)
  if API_KEY == "" then
    print("^1[NoSatu] API key belum diset di server.cfg (set nosatu_api_key ...)^0")
    return
  end

  PerformHttpRequest(
    API_URL .. path,
    function(statusCode, body)
      if cb then cb(statusCode, body) end
    end,
    "POST",
    json.encode(payload),
    {
      ["Authorization"] = "Bearer " .. API_KEY,
      ["Content-Type"] = "application/json",
    }
  )
end

-- Panggil saat 1 heat/race turnamen selesai
exports("SyncRaceTournament", function(slug, raceId, driverRows)
  nosatuPost("/api/v1/tournaments/" .. slug .. "/matches", {
    gameSource = "FIVEM",
    round = 1,
    externalMatchRef = tostring(raceId),
    participants = driverRows,
  }, function(code, body)
    print(("[NoSatu] Tournament sync HTTP %s: %s"):format(code, body))
  end)
end)
TYPESCRIPT // FETCH

Node.js / TypeScript Client Wrapper (SDK Ready)

Client wrapper ringan tanpa dependensi tambahan dengan penanganan status HTTP 400/401/403/429.

Cocok untuk backend game custom, Discord bot tambahan, atau server Minecraft bridge.

export class NoSatuClient {
  constructor(
    private readonly apiKey: string,
    private readonly baseUrl = "https://nosatu.my.id",
  ) {}

  private async call<T>(path: string, init: RequestInit = {}): Promise<T> {
    const res = await fetch(`${this.baseUrl}${path}`, {
      ...init,
      headers: {
        Authorization: `Bearer ${this.apiKey}`,
        "Content-Type": "application/json",
        ...(init.headers ?? {}),
      },
    });
    const data = await res.json();
    if (!res.ok) {
      throw new Error(`NoSatu API ${res.status}: ${data.error ?? "UNKNOWN"}`);
    }
    return data as T;
  }

  pushBoardEntry(slug: string, body: {
    discordId: string;
    username?: string;
    score?: number;
    timeMs?: number;
    ratingDelta?: number;
    outcome?: "WIN" | "DRAW" | "LOSS";
    xpDelta?: number;
  }) {
    return this.call(`/api/v1/boards/${slug}/entries`, {
      method: "POST",
      body: JSON.stringify(body),
    });
  }

  pushTournamentMatch(slug: string, body: {
    round?: number;
    gameSource?: "ROBLOX" | "FIVEM" | "MINECRAFT" | "VALORANT" | "CUSTOM";
    participants: Array<{
      teamName: string;
      score: number;
      placement?: number;
      kills?: number;
      timeMs?: number;
      isWinner: boolean;
    }>;
  }) {
    return this.call(`/api/v1/tournaments/${slug}/matches`, {
      method: "POST",
      body: JSON.stringify(body),
    });
  }
}