# 5e.tools — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and retrieve D&D 5e game data like races, classes, and spells to power your character builders, campaign tools, or reference applications. Access comprehensive spell sources and character creation options directly from the official 5e.tools database.

**Category:** Entertainment | **Website:** [5e.tools/](https://5e.tools/) | **Docs:** [parse.bot/marketplace/39a9b674-cdf2-4b1d-acd8-5036ee2633d9/5e-tools-api](https://parse.bot/marketplace/39a9b674-cdf2-4b1d-acd8-5036ee2633d9/5e-tools-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-5e-tools-api-39a9b674/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_classes

Retrieve D&D 5e classes. When class_name is provided, returns the complete class data including subclasses, class features, and subclass features for that class. When omitted, returns a list of all class objects plus an index of available class names. Class names are case-insensitive and matched against the 5e.tools class index.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `class_name` | string | No | Name of the class to retrieve full details for. Case-insensitive. If omitted, returns a list of all classes. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-5e-tools-api-39a9b674/get_classes \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"class_name":"<string>"}'
```

### get_races

Retrieve D&D 5e species and races from the 5e.tools data. Filterable by a case-insensitive keyword matching race name. Returns all races when no query is provided. Each race includes name, source book, size, speed, darkvision range, trait tags, and detailed entry text.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | No | Case-insensitive search keyword to filter races by name (e.g. 'elf', 'dwarf', 'halfling'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-5e-tools-api-39a9b674/get_races \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

### get_spell_sources

List all available spell source book codes and their corresponding JSON filenames from the 5e.tools spell index. Use this to discover valid source values for the get_spells endpoint. Each key is a source code (e.g. 'PHB') and each value is the filename (e.g. 'spells-phb.json').

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-5e-tools-api-39a9b674/get_spell_sources \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_spells

Retrieve D&D 5e spells with optional filtering by source book and/or name. Defaults to Player's Handbook (PHB) spells when no source or fetch_all is specified. Supports combining source and query filters. Returns spell objects with full mechanical details including level, school, components, duration, range, and descriptive entries.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `fetch_all` | boolean | No | If true, fetches spells from all available sources. May return a large result set. |
| `query` | string | No | Case-insensitive search keyword to filter spells by name (e.g. 'fireball', 'heal', 'shield'). |
| `source` | string | No | Source book code to fetch spells from. Use the get_spell_sources endpoint to see all available codes (e.g. 'PHB', 'XGE', 'TCE', 'XPHB'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-5e-tools-api-39a9b674/get_spells \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fetch_all":"<boolean>","query":"<string>","source":"<string>"}'
```
