An API of Ice and Fire

Entertainment API · Global · Game of Thrones & Song of Ice and Fire data

TL;DR

The world's first REST API for the Song of Ice and Fire universe. Query structured data on all characters (2,000+), books (12+), and houses (400+) from George R.R. Martin's series. Each character entry includes name, aliases, titles, allegiances, book appearances, spouse, father, and whether they're alive or dead. Books include ISBN, page count, publication date, and POV characters. Houses include region, titles, ancestral weapon, words, and overlord. The definitive open API for Westeros — inspired by the series, unaffiliated with HBO or GRRM.

Quick start: https://anapioficeandfire.com/api/characters?page=1&pageSize=10

No API key needed — just make a request!

First 10 characters: https://anapioficeandfire.com/api/characters?page=1&pageSize=10

How to Use This API

1. Get All Books

https://anapioficeandfire.com/api/books

2. Get a Specific Character by ID

https://anapioficeandfire.com/api/characters/583

Character 583 is Daenerys Targaryen.

3. Search Characters by Name

https://anapioficeandfire.com/api/characters?name=Jon%20Snow

4. Filter Houses by Region

https://anapioficeandfire.com/api/houses?region=The%20North

5. JavaScript — Character Lookup

async function getCharacter(id) {
  const resp = await fetch(
    `https://anapioficeandfire.com/api/characters/${id}`
  );
  const char = await resp.json();
  
  console.log(`Name: ${char.name}`);
  console.log(`Aliases: ${char.aliases.filter(a => a).join(', ')}`);
  console.log(`Titles: ${char.titles.filter(t => t).join(', ')}`);
  console.log(`Alive: ${char.died ? 'No (' + char.died + ')' : 'Yes'}`);
  console.log(`Played by: ${char.playedBy.filter(p => p).join(', ') || 'N/A'}`);
}

getCharacter(583); // Daenerys Targaryen

6. Python — House Members

import requests

def house_members(house_name):
    resp = requests.get(
        'https://anapioficeandfire.com/api/houses',
        params={'name': house_name}
    )
    houses = resp.json()
    if not houses:
        print('House not found')
        return
    
    house = houses[0]
    print(f"{house['name']} — {house['region']}")
    print(f"Words: {house['words']}")
    print(f"Members: {len(house['swornMembers'])}")
    
    # Get first 3 sworn members
    for url in house['swornMembers'][:3]:
        member = requests.get(url).json()
        print(f"  - {member['name'] or 'Unknown'}")

house_members('House Stark')

Frequently Asked Questions

Is this an official API?
No. It's an independent, fan-built API using data compiled from the books. Not affiliated with George R.R. Martin, HBO, or any official entity.
Do I need an API key?
No. The API is completely free and open, no authentication required.
How much data is available?
Over 2,000 characters, 400+ houses, and a dozen books (including the main series, novellas, and companion books like The World of Ice and Fire).
Are there rate limits?
No official rate limits, but the API is hosted on free infrastructure. Be reasonable with request volume and cache results when possible.
Does it include show (HBO) data?
Some character entries include playedBy (actor name) for show counterparts, but the primary data is book-based. The API focuses on the literary canon.
How is pagination handled?
Use page and pageSize parameters. pageSize defaults to 10, max 50. Responses include Link headers for navigating between pages.

API Details

API URL
https://anapioficeandfire.com/api/
Documentation
anapioficeandfire.com
Category
Entertainment
Authentication
Not Required
Geographic Coverage
The world of Ice and Fire (Westeros, Essos, and beyond)

What You Can Build