Adventurer's Quest API v2.0

Welcome to the RPG-lite REST API with database persistence and authentication!

Authentication

Important: Most endpoints now require authentication!

When you create a player, you'll receive an apiToken. Save this token!

Include it in the Authorization header for all protected endpoints:
Authorization: Bearer YOUR_API_TOKEN

Getting Started

Step 1: Create a player (no auth required)

POST https://quest.projectgnome.org/api/players { "name": "Aragorn" }

Step 2: Save your API token from the response!

Step 3: Use your token for all other requests:

https://quest.projectgnome.org/api/players/me Authorization: Bearer YOUR_API_TOKEN

Player Endpoints

POST /api/players No Auth
Create a new player and receive your API token
POST /api/players { "name": "Aragorn" }
GET /api/players/me Auth Required
Get your player details
GET /api/players/me/stats Auth Required
View your statistics
GET /api/players/me/inventory Auth Required
View your inventory and equipped items
POST /api/players/me Auth Required
Update your player name
PATCH /api/players/me Authorization: Bearer YOUR_API_TOKEN { "name": "NewName" }
DELETE /api/players/me Auth Required
Delete your player account

Battle Endpoints

All battle endpoints require authentication

Tip: You have two options for battles:
POST /api/battles/start Auth Required
Start a new battle (enemy based on current location)
POST /api/battles/start Authorization: Bearer YOUR_API_TOKEN
GET /api/battles/current Auth Required
Get your current active battle status (no battle ID needed!)
POST /api/battles/current/action Auth Required
Perform action on your current battle (no battle ID needed!)
POST /api/battles/current/action Authorization: Bearer YOUR_API_TOKEN { "action": "attack" // or "defend" or "flee" }
GET /api/battles/:battleID Auth Required
Get specific battle status (requires battle ID)
POST /api/battles/:battleID/action Auth Required
Perform action on specific battle. Equipped weapons/armor affect damage!
POST /api/battles/{battleID}/action Authorization: Bearer YOUR_API_TOKEN { "action": "attack" // or "defend" or "flee" }

Quest Endpoints

All quest endpoints require authentication

GET /api/quests/available Auth Required
List quests you can accept (based on your level)
GET /api/quests/active Auth Required
List your active and completed quests with progress
POST /api/quests/:questID/accept Auth Required
Accept a quest (sets status to in_progress)
POST /api/quests/:questID/complete Auth Required
Complete a quest (only if requirements are met)

World Endpoints

GET /api/world/locations No Auth
List all locations and their connections
GET /api/world/locations/:locationName No Auth
Get details about a specific location
POST /api/world/travel Auth Required
Travel to a new location (must be connected to current location)
POST /api/world/travel Authorization: Bearer YOUR_API_TOKEN { "destination": "Dark Forest" }
POST /api/world/rest Auth Required
Rest at the inn (only at Village Square, costs 20 gold, restores full health)
GET /api/world/shop Auth Required
View shop items (only at Village Square)
POST /api/world/shop/buy Auth Required
Buy an item from the shop (only at Village Square)
POST /api/world/shop/buy Authorization: Bearer YOUR_API_TOKEN { "itemName": "Health Potion" }
POST /api/world/shop/sell Auth Required
Sell an item for 75% of its value (only at Village Square)
POST /api/world/shop/sell Authorization: Bearer YOUR_API_TOKEN { "itemId": "your-item-uuid" }
POST /api/world/items/use Auth Required
Use/equip an item from your inventory
POST /api/world/items/use Authorization: Bearer YOUR_API_TOKEN { "itemId": "uuid-here" }

Game Mechanics

Death Penalty:

When you die in battle:

Battle Lock:

While in an active battle, you CANNOT:

You MUST finish or flee from the battle first!

Important Notes

Made with ❤️ using Swift Vapor + Fluent | Health Check