D&D 5e API
Open API for Dungeons & Dragons 5e — spells, monsters, classes and rules.
What it does
The D&D 5e API serves the Dungeons & Dragons 5th-edition SRD (System Reference Document) as structured JSON: spells, monsters, classes, subclasses, races, feats, equipment, magic items, conditions, rules sections and more — everything in the open-licensed SRD.
Base URL
Authentication
None. A collection endpoint (/spells) returns {count, results:[{index,name,url}]}; fetch /spells/{index} (e.g. /spells/fireball) for the full entry. A GraphQL endpoint is available at /graphql.
Code examples
curl -s https://www.dnd5eapi.co/api/2014/spells/fireball curl -s "https://www.dnd5eapi.co/api/2014/monsters/adult-red-dragon"
import requests
B = "https://www.dnd5eapi.co/api/2014"
lst = requests.get(f"{B}/classes/wizard/spells", timeout=10).json()
print(lst["count"], "wizard spells; first few:")
for s in lst["results"][:5]:
print(" ", s["name"])Rate limits & quotas
No documented rate limit; the SRD is static, so cache everything. Note the API is now version-pathed (/api/2014/...) to allow for future rules sets — the bare /api/... path still redirects for now.
Key response fields
| count / results[] | Collection listing: {index, name, url} |
| (spell) level / school.name / casting_time / range / components / desc[] | Spell detail |
| (monster) armor_class / hit_points / actions[] / challenge_rating | Stat block |
| (class) hit_die / proficiencies[] / spellcasting | Class chassis |
| index | The stable slug used in URLs (fireball, adult-red-dragon) |
Common errors
| 404 "Not found" | Unknown index — list the collection first to get valid slugs. |
| (SRD scope only) | Only open-licensed SRD content is present — no non-SRD subclasses, adventures or setting material. |
When to use it (and alternatives)
The backbone for character builders, spell-card generators, encounter tools and DM screens — anything working with the free 5e ruleset. Because it is static SRD data, bundle it or cache it rather than calling live.
FAQ
Why only some spells and subclasses?
The API contains exactly the SRD 5.1 — the subset of D&D rules Wizards of the Coast released under an open licence. Content from published books outside the SRD is not included and cannot be.
What is the /api/2014 in the path?
A version segment added so the project can host multiple rules editions. Pin /api/2014 explicitly rather than relying on the redirect from the bare path.
Is there a way to query relationships?
Yes — the GraphQL endpoint at /graphql lets you fetch, say, a class with its spells and proficiencies in one query instead of walking many REST links.
New to APIs?
Short guides for working with this API — and any other.