What is this?
The SwordFight API provides pre-calculated outcomes for every possible move combination in the SwordFight game engine. All outcomes are deterministic and pre-generated as static JSON files.
This API is:
- Stateless - No server-side computation, just file lookups
- Fast - Served from CDN, cached indefinitely
- Open Source - Built with the SwordFight Engine
Quick Start
Get all characters:
fetch('https://api.swordfight.me/characters/index.json')
.then(r => r.json())
.then(data => console.log(data.characters));
Get a specific character:
fetch('https://api.swordfight.me/characters/human-fighter.json')
.then(r => r.json())
.then(character => console.log(character));
Get a round outcome:
fetch('https://api.swordfight.me/rounds/human-fighter/goblin/24/30.json')
.then(r => r.json())
.then(outcome => console.log(outcome));
API Endpoints
Character List:
GET /characters/index.json
Character Details:
GET /characters/{slug}.json
Round Outcome:
GET /rounds/{char1}/{char2}/{move1}/{move2}.json
Documentation
📚 Interactive API Documentation - Explore the complete API with Swagger UI
📄 OpenAPI Specification - Download the formal API spec
Resources
- GitHub Repository - Engine source code and documentation
- API Client Guide - How to use this API
- Engine Documentation - Full game engine docs
- NPM Package - Install the engine