API Documentation

Access the PhobiaFile data programmatically.

Base URL

All API endpoints are relative to this base URL:

https://phobia.otd.lol
Get Phobia of the Day
GET

Retrieve the current phobia of the day.

Endpoint

/api/phobias/today

Example Request (fetch)

fetch('https://phobia.otd.lol/api/phobias/today')
  .then(response => response.json())
  .then(data => console.log(data));

Example Response

{
  "id": 1,
  "name": "Arachnophobia",
  "description": "The intense and irrational fear of spiders...",
  "fact": "Some people with arachnophobia can't even look at a picture...",
  "statistics": "Affects up to 6.1% of the global population...",
  "iconName": "spider"
}
Get All Phobias
GET

Retrieve a list of all phobias in the database.

Endpoint

/api/phobias

Example Request (fetch)

fetch('https://phobia.otd.lol/api/phobias')
  .then(response => response.json())
  .then(data => console.log(data));

Example Response

[
  {
    "id": 1,
    "name": "Arachnophobia",
    "description": "The intense and irrational fear of spiders...",
    "fact": "Some people with arachnophobia can't even look at a picture...",
    "statistics": "Affects up to 6.1% of the global population...",
    "iconName": "spider"
  },
  {
    "id": 2,
    "name": "Ophidiophobia",
    ...
  }
]
Get Phobia by ID
GET

Retrieve a single phobia by its unique ID.

Endpoint

/api/phobias/[id]

Example Request (fetch)

fetch('https://phobia.otd.lol/api/phobias/1')
  .then(response => response.json())
  .then(data => console.log(data));

Example Response

{
  "id": 1,
  "name": "Arachnophobia",
  "description": "The intense and irrational fear of spiders...",
  "fact": "Some people with arachnophobia can't even look at a picture...",
  "statistics": "Affects up to 6.1% of the global population...",
  "iconName": "spider"
}