The original post: /r/php by /u/AshleyJSheridan on 2025-03-10 19:30:57.

For the past couple of months I’ve been building out an API to create and manage D&D characters using the 5E rules. I originally created it just as a learning tool (I’m a developer by profession, but out of work at the moment, the market hasn’t been great recently) but I envisage it as an alternative (one day) to many of the bigger paid-for services out there, as it’s completely free and has no restrictions.

Currently, the API allows you to:

  • Create characters, and set their class, background, race, languages, stats, spells
  • Get race-specific name suggestions (not AI, but a custom Markov chain generator)
  • Roll dice from the standard 6 types (d4 - d20)
  • Generate creature encounters based on a party of characters (limited to a party of a single user currently, but I can adapt this to allow a mix of characters from many users in the future)
  • Generate random items, from armor and weapons, to books and gemstones. There is even a small chance to generate magical items!

There are also endpoints for listing out general things like classes, races, languages, spells, and more.

The whole API has a Postman collection to help make it easier to work with as well, and I’ve documented it on the homepage of the API website.

The API is available at: https://dndapi.ashleysheridan.co.uk/