API Documentation

This page lists the current server API routes implemented in the codebase. Use the dashboard to manage games & API keys and the OAuth flow for authentication.

Implementation in Godot

ShibaDB provides a GDScript implementation for simple use. The GDScript can be found here. Simply download the script, drag it into your scripts folder and register it as an autoload / global (Project > Project Settings > Globals). To implement the script, use the following code:

func _ready() -> void:
	# Connect the signal for loading saves to a function in your code
	ShibaDB.save_loaded.connect(_on_save_loaded)
	# Initialize ShibaDB with your Game ID from the dashboard
	await ShibaDB.init_shibadb("GAMEID_HERE")
	# Load the user's saved progress
	ShibaDB.load_progress()
	
func _on_save_loaded(saveData) -> void:
	# Set your variables here! Don't forget to null check these or they might fail
	# Example:
	if saveData.has("coins"):
		coins = int(saveData.coins)
		
func save_progress() -> void:
	# Finally save your progress by calling this function.
	# You can pass as many arguments as you like. Otherwise, you can also pass a Dictionary[String, Variant]
	ShibaDB.save_progress({ "coins": coins })
	
func reset_progress() -> void:
	# If you want to reset the players' progress, use this method:
	# The name currently defaults to "Untitled Save"
	ShibaDB.reset_progress("MY SAVE NAME")

API Routes

GET

/api/v1

API root / status

{"message":"ShibaDB API","version":0.1}
Source: /src/app/api/v1/route.ts
GET

/api/v1/auth/me

Returns the authenticated user (requires cookie or Authorization header).

Source: /src/app/api/v1/auth/me/route.ts
GET

/api/v1/games

List games for the authenticated user (pagination & filters supported).

Source: /src/app/api/v1/games/route.ts
POST

/api/v1/games/new

Create a new game for the authenticated user. Body: { name, description }

{"name":"My Game","description":"My amazing game!"}
Source: /src/app/api/v1/games/new/route.ts
GET | PUT | DELETE

/api/v1/games/:id

Get, update or delete a single game. PUT accepts { name, description, config }.

Source: /src/app/api/v1/games/[id]/route.ts
POST

/api/v1/games/:id/keys (validate)

DEPRECATED! Validate an API key for a game (public validation). Body: { key }

{"key":"SHIBADB-..."} 
Source: /src/app/api/v1/games/[id]/keys/route.ts
DELETE

/api/v1/games/:id/keys

DEPRECATED! Remove an API key (owner only). Body: { key }

Source: /src/app/api/v1/games/[id]/keys/route.ts
GET

/api/v1/games/:id/players

List players for a game (pagination, sort).

Source: /src/app/api/v1/games/[id]/players/route.ts
POST

/api/v1/games/:id/players

Create or update a player record (owner only). Body: { playerId, slackId?, gameData?, totalPlayTime? }

{"playerId":"player1","gameData": {"score":100}}
Source: /src/app/api/v1/games/[id]/players/route.ts
GET | POST

/api/v1/games/:id/players/:playerId

Get or create a specific player. POST can add a new player (owner only).

Source: /src/app/api/v1/games/[id]/players/[playerId]/route.ts

Authentication notes

Routes that require a logged-in user check for the shibaCookie session cookie or a Bearer token in the Authorization header. Sessions are created in the Slack callback flow.