API Documentation

Build with
Mythological Power

Comprehensive documentation for accessing the Greek Mythology API. Learn how to integrate ancient tales into your modern applications.

Base URL

Base URL
https://thegreekmythapi.vercel.app/api

Images are available at /api/{category}/{name}.png, for example:

Image URL Example
https://thegreekmythapi.vercel.app/api/heroes/orpheus.png

Available Endpoints

  • /gods – Olympian deities and divine beings
  • /heroes – Legendary warriors and champions
  • /monsters – Fearsome creatures and beasts
  • /titans – Primordial gods and giants

Example: Get All Gods

Request
GET
/api/gods
GET https://thegreekmythapi.vercel.app/api/heroes
Response
200 OK
{
      "name": "Orpheus",
      "description": "Legendary musician, poet, and prophet in the Greek myths. Son of Apollo.",
      "category": "Hero",
      "attributes": {
        "origin": "Son of Apollo and the muse Calliope",
        "symbols": [
          "Lyre",
          "Orphic tablets"
        ],
        "abode": "Various, including the underworld",
        "powers": [
          "Musical prowess",
          "Journey to the underworld"
        ],
        "family": {
          "parents": [
            "Apollo",
            "Calliope"
          ],
          "siblings": [
            "Linus",
            "Aglaea",
            "Eupheme"
          ],
          "spouse": [
            "Eurydice"
          ]
        },
        "stories": [
          "Rescue of Eurydice from the underworld",
          "Death at the hands of Maenads"
        ]
      },
      "image": "/api/heroes/orpheus.png",
      "id": 1
    },
Zeus

Example: Zeus Image

Each entity comes with a high-quality AI-generated image, accessible via the image URL in the response.

Hercules

Example: Hercules Image

Images can be used to enhance your applications with rich visual content.

API Tips & Tricks

Filtering Related Entities

You can cross-reference entities using their relationships. For example, to find all heroes related to Zeus:

Example Code
// First get Zeus's details
const zeus = await fetch('https://thegreekmythapi.vercel.app/api/gods')
  .then(r => r.json())
  .then(gods => gods.find(g => g.name === 'Zeus'));

// Then get all heroes
const heroes = await fetch('https://thegreekmythapi.vercel.app/api/heroes')
  .then(r => r.json());

// Filter heroes related to Zeus
const zeusHeroes = heroes.filter(hero => 
  hero.attributes.family?.parents?.includes('Zeus') ||
  hero.attributes.stories?.some(story => 
    story.includes('Zeus')
  )
);

Combining Multiple Endpoints

Create rich storytelling by combining data from different endpoints:

// Fetch data from all endpoints in parallel
const [gods, heroes, monsters] = await Promise.all([
  fetch('https://thegreekmythapi.vercel.app/api/gods')
    .then(r => r.json()),
  fetch('https://thegreekmythapi.vercel.app/api/heroes')
    .then(r => r.json()),
  fetch('https://thegreekmythapi.vercel.app/api/monsters')
    .then(r => r.json())
]);

// Find all entities involved in a specific story
const trojanWar = [...gods, ...heroes, ...monsters]
  .filter(entity =>
    entity.attributes.stories?.some(story => 
      story.toLowerCase().includes('troy') || 
      story.toLowerCase().includes('trojan')
    )
  );

Building Family Trees

Create genealogical relationships between gods and heroes:

// Get all gods and heroes
const [gods, heroes] = await Promise.all([
  fetch('https://thegreekmythapi.vercel.app/api/gods')
    .then(r => r.json()),
  fetch('https://thegreekmythapi.vercel.app/api/heroes')
    .then(r => r.json())
]);

// Function to find children of a deity
const findChildren = (deityName) => {
  return [...gods, ...heroes]
    .filter(entity =>
      entity.attributes.family?.parents?.includes(deityName)
    );
};

// Example: Get Zeus's family tree
const zeusFamily = {
  deity: gods.find(g => g.name === 'Zeus'),
  spouse: gods.find(g => g.name === 'Hera'),
  children: findChildren('Zeus'),
  siblings: gods.filter(g => 
    g.attributes.family?.parents?.includes('Cronus') && 
    g.name !== 'Zeus'
  )
};

Other Endpoints

  • /heroes GET all heroes
    Request
    GET
    /api/heroes
    GET https://thegreekmythapi.vercel.app/api/heroes
  • /monsters GET all monsters
    Request
    GET
    /api/monsters
    GET https://thegreekmythapi.vercel.app/api/monsters
  • /titans GET all titans
    Request
    GET
    /api/titans
    GET https://thegreekmythapi.vercel.app/api/titans

Usage

No authentication required. Simply send a GET request to any endpoint. Example using fetch in JavaScript:

JavaScript Example
fetch('https://thegreekmythapi.vercel.app/api/gods')
  .then(res => res.json())
  .then(data => console.log(data))