Dnd5eapi

D&D 5e API

Introduction Welcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API! This documentation should help you familiarize yourself with the resources…

Data & analytics#openapi#open-data

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

Introduction

Welcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API!
This documentation should help you familiarize yourself with the resources
available and how to consume them with HTTP requests. Read through the getting
started section before you dive in. Most of your problems should be solved
just by reading through it.

Getting Started

Let's make our first API request to the D&D 5th Edition API!

Open up a terminal and use curl or httpie
to make an API request for a resource. You can also scroll through the
definitions below and send requests directly from the endpoint documentation!

For example, if you paste and run this curl command:

curl -X GET "https://www.dnd5eapi.co/api/ability-scores/cha" -H "Accept: application/json"

We should see a result containing details about the Charisma ability score:

{
  "index": "cha",
  "name": "CHA",
  "full_name": "Charisma",
  "desc": [
    "Charisma measures your ability to interact effectively with others. It
      includes such factors as confidence and eloquence, and it can represent
      a charming or commanding personality.",
    "A Charisma check might arise when you try to influence or entertain
      others, when you try to make an impression or tell a convincing lie,
      or when you are navigating a tricky social situation. The Deception,
      Intimidation, Performance, and Persuasion skills reflect aptitude in
      certain kinds of Charisma checks."
  ],
  "skills": [
    {
      "name": "Deception",
      "index": "deception",
      "url": "/api/skills/deception"
    },
    {
      "name": "Intimidation",
      "index": "intimidation",
      "url": "/api/skills/intimidation"
    },
    {
      "name": "Performance",
      "index": "performance",
      "url": "/api/skills/performance"
    },
    {
      "name": "Persuasion",
      "index": "persuasion",
      "url": "/api/skills/persuasion"
    }
  ],
  "url": "/api/ability-scores/cha"
}

Authentication

The dnd5eapi is a completely open API. No authentication is required to query
and get data. This also means that we've limited what you can do to just
GET-ing the data. If you find a mistake in the data, feel free to
message us.

GraphQL

This API supports GraphQL. The GraphQL URL for this API
is https://www.dnd5eapi.co/graphql. Most of your questions regarding the GraphQL schema can be answered
by querying the endpoint with the Apollo sandbox explorer.

Schemas

Definitions of all schemas will be accessible in a future update. Two of the most common schemas are described here.

APIReference

Represents a minimal representation of a resource. The detailed representation of the referenced resource can be retrieved by making a request to the referenced URL.

APIReference {
  index     string
  name      string
  url       string
}

DC

Represents a difficulty check.

DC {
  dc_type       APIReference
  dc_value      number
  success_type  "none" | "half" | "other"
}

Damage

Represents damage.

Damage {
  damage_type     APIReference
  damage_dice     string
}

Choice

Represents a choice made by a player. Commonly seen related to decisions made during character creation or combat (e.g.: the description of the cleric class, under Proficiencies, states "Skills: Choose two from History, Insight, Medicine, Persuasion, and Religion" [[SRD p15]](https://media.wizards.com/2016/downloads/DND/SRD-OGL_V5.1.pdf#page=15))

Choice {
  desc      string
  choose    number
  type      string
  from      OptionSet
}

OptionSet

The OptionSet structure provides the options to be chosen from, or sufficient data to fetch and interpret the options. All OptionSets have an option_set_type attribute that indicates the structure of the object that contains the options. The possible values are options_array, equipment_category, and reference_list. Other attributes on the OptionSet depend on the value of this attribute.

  • options_array
  • options (array): An array of Option objects. Each item in the array represents an option that can be chosen.
  • equipment_category
  • equipment_category (APIReference): A reference to an EquipmentCategory. Each item in the EquipmentCategory's equipment array represents one option that can be chosen.
  • resource_list
  • resource_list_url (string): A reference (by URL) to a collection in the database. The URL may include query parameters. Each item in the resulting ResourceList's results array represents one option that can be chosen.

Option

When the options are given in an options_array, each item in the array inherits from the Option structure. All Options have an option_type attribute that indicates the structure of the option. The value of this attribute indicates how the option should be handled, and each type has different attributes. The…

Endpoints 47

Common

  • GETGet all resource URLs./apiMaking a request to the API's base URL returns an object containing available endpoints.
  • GETGet list of all available resources for an endpoint./api/:endpointCurrently only the /spells and /monsters endpoints support filtering with query parameters. Use of these query parameters is documented under the respective…

Character Data

  • GETGet an ability score by index./api/ability-scores/:indexAbility Score Represents one of the six abilities that describes a creature's physical and mental characteristics. The three main rolls of the game - the…
  • GETGet an alignment by index./api/alignments/:indexAlignment A typical creature in the game world has an alignment, which broadly describes its moral and personal attitudes. Alignment is a combination of two…
  • GETGet a background by index./api/backgrounds/:indexBackground Every story has a beginning. Your character's background reveals where you came from, how you became an adventurer, and your place in the world.…
  • GETGet a language by index./api/languages/:indexLanguage Your race indicates the languages your character can speak by default, and your background might give you access to one or more additional languages…
  • GETGet a proficiency by index./api/proficiencies/:indexProficiency By virtue of race, class, and background a character is proficient at using certain skills, weapons, and equipment. Characters can also gain…
  • GETGet a skill by index./api/skills/:indexSkill Each ability covers a broad range of capabilities, including skills that a character or a monster can be proficient in. A skill represents a specific…

Class

  • GETGet a class by index./api/classes/:indexClass A character class is a fundamental part of the identity and nature of characters in the Dungeons & Dragons role-playing game. A character's…
  • GETGet multiclassing resource for a class./api/classes/:index/multi-classing
  • GETGet spellcasting info for a class./api/classes/:index/spellcasting

Class Resource Lists

  • GETGet features available for a class./api/classes/:index/features
  • GETGet proficiencies available for a class./api/classes/:index/proficiencies
  • GETGet spells available for a class./api/classes/:index/spells
  • GETGet subclasses available for a class./api/classes/:index/subclasses

Class Levels

  • GETGet all level resources for a class./api/classes/:index/levels?subclass=ber
  • GETGet level resource for a class and level./api/classes/:index/levels/:class_level
  • GETGet features available to a class at the requested level./api/classes/:index/levels/:class_level/features
  • GETGet spells of the requested level available to the class./api/classes/:index/levels/:spell_level/spells

Game Mechanics

  • GETGet a condition by index./api/conditions/:indexCondition A condition alters a creature’s capabilities in a variety of ways and can arise as a result of a spell, a class feature, a monster’s attack, or…
  • GETGet a damage type by index./api/damage-types/:indexDamage type Different attacks, damaging spells, and other harmful effects deal different types of damage. Damage types have no rules of their own, but other…
  • GETGet a magic school by index./api/magic-schools/:indexMagic School Academies of magic group spells into eight categories called schools of magic. Scholars, particularly wizards, apply these categories to all…

Equipment

  • GETGet an equipment category by index./api/equipment-categories/:indexThese are the categories that various equipment fall under.
  • GETGet an equipment item by index./api/equipment/:indexEquipment Opportunities abound to find treasure, equipment, weapons, armor, and more in the dungeons you explore. Normally, you can sell your treasures and…
  • GETGet a magic item by index./api/magic-items/:indexThese are the various magic items you can find in the game.
  • GETGet a weapon property by index./api/weapon-properties/:index

Feats

  • GETGet a feat by index./api/feats/:indexFeat A feat is a boon a character can receive at level up instead of an ability score increase.

Features

  • GETGet a feature by index./api/features/:indexFeature When you gain a new level in a class, you get its features for that level. You don’t, however, receive the class’s starting Equipment, and a few…

Monsters

  • GETGet list of monsters with optional filtering/api/monsters?challenge_rating=1,2
  • GETGet monster by index./api/monsters/:index

Races

  • GETGet a race by index./api/races/:indexEach race grants your character ability and skill bonuses as well as racial traits.
  • GETGet proficiencies available for a race./api/races/:index/proficiencies
  • GETGet subraces available for a race./api/races/:index/subraces
  • GETGet traits available for a race./api/races/:index/traits

Rules

  • GETGet a rule section by index./api/rule-sections/:indexRule sections represent a sub-heading and text that can be found underneath a rule heading in the SRD.
  • GETGet a rule by index./api/rules/:indexRule Rules are pages in the SRD that document the mechanics of Dungeons and Dragons. Rules have descriptions which is the text directly underneath the rule…

Spells

  • GETGet list of spells with optional filtering./api/spells?level=1,2&school=evocation,illusion
  • GETGet a spell by index./api/spells/:index

Subclasses

  • GETGet a subclass by index./api/subclasses/:indexSubclasses reflect the different paths a class may take as levels are gained.
  • GETGet features available for a subclass./api/subclasses/:index/features
  • GETGet all level resources for a subclass./api/subclasses/:index/levels
  • GETGet level resources for a subclass and level./api/subclasses/:index/levels/:subclass_level
  • GETGet features of the requested spell level available to the class./api/subclasses/:index/levels/:subclass_level/features

Subraces

  • GETGet a subrace by index./api/subraces/:indexSubraces reflect the different varieties of a certain parent race.
  • GETGet proficiences available for a subrace./api/subraces/:index/proficiencies
  • GETGet traits available for a subrace./api/subraces/:index/traits

Traits

  • GETGet a trait by index./api/traits/:index

API details

Base URL
https://www.dnd5eapi.co
http://localhost:3000
Authentication
None declared in the description
Operations
47 operations on 47 pathsGET 47
Main resources
Character Data 6Subclasses 5Class Levels 4Class Resource Lists 4Equipment 4Races 4Class 3Game Mechanics 3Subraces 3Common 2
Response formats
application/json
Description format
OpenAPI 3.0.1, API version 0.1
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the D&D 5e API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the D&D 5e API collection, without the publisher's secrets.
  3. Add your credentialsOpen the collection's variables or an environment and enter your API key or token, if the API needs one.
  4. Send a requestPick an endpoint, for example “Get all resource URLs.” (GET /api), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the D&D 5e API?

Introduction Welcome to the dnd5eapi, the Dungeons & Dragons 5th Edition API! This documentation should help you familiarize yourself with the resources… It is listed under Data & analytics and has 47 endpoints.

Who publishes the D&D 5e API?

It is listed from Dnd5eapi's public API description (an OpenAPI document), not published by Dnd5eapi on Swastik Codes. Anyone who controls dnd5eapi.co can claim the profile by adding a DNS TXT record.

What is the base URL of the D&D 5e API?

Its description lists 2 base URLs: https://www.dnd5eapi.co, http://localhost:3000. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the D&D 5e API?

Its OpenAPI description does not declare an authentication scheme. Some endpoints may be open; check the provider's documentation before relying on that.

How many endpoints does the D&D 5e API have?

47 operations on 47 paths (47 GET). The largest groups are Character Data, Subclasses, Class Levels, Class Resource Lists.

Is forking the D&D 5e API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.