An NPC’s Sorrow

For developers

Sorrow API

Generate NPC stories for graveyards, city maps, and other apps. Use the JSON directly or open the returned player and DM links. No API key is required. Cross-origin browser requests are supported.

Generate a story

Send JSON to POST /api/v1/sorrows.

{
  "seed": "grayhaven-grave-17",
  "count": 1,
  "npc": {
    "race": "dwarf",
    "age": 210,
    "sex": "female",
    "occupation": "mason"
  },
  "location": "generic-fantasy",
  "locationName": "Grayhaven"
}

All fields are optional. Omit the seed for a random result. Reuse the same seed and inputs for the same story. Set count from 1 to 20 for a batch.

NPC details and locations

Supply npc.name, npc.race, npc.sex, npc.age, and npc.occupation. Age accepts an age group or integer years from 0 to 2000. Exact years select a race-adjusted narrative age group. Occupation defaults to commoner.

Set location to generic-fantasy or forgotten-realms. Use locationName for a settlement or region to include in the story.

Get supported values and limits as JSON.

Read the response

The response contains apiVersion, generatorVersion, seed, count, and an items array. Each item includes npc, location, story.scene, story.findings, and story.text.

Both views are public sharing links. The player handout includes all findings. There is no separate hidden DM narrative.

Use GET

Pass NPC fields as flat query parameters. Numeric ages in GET use digits only.

Try the Grayhaven grave example

fetch('/api/v1/sorrows?seed=grave-17&race=elf&age=320')
  .then(response => response.json())
  .then(data => console.log(data.items[0]));

Limits and persistence

Seeds allow 64 characters for a single story or 60 for a batch. Names allow 48 characters. Location names allow 120. JSON bodies allow 8192 bytes. Unknown fields and invalid values return 400, oversized bodies return 413, and unsupported POST content types return 415. Errors use { error: { code, message } }.

Batch seeds append :1, :2, and so on. Save each returned API link for individual regeneration. For maps, use a stable seed per grave so reordering graves does not change their stories.

The v1 API and sharing views pin generator version 5. Nothing is stored on the server. Save returned JSON in your app for a permanent snapshot. Sharing links contain supplied inputs, so use them for fictional NPC details.