API

Get random quotes as JSON. Free to use, no authentication required, CORS enabled.

Base URL

https://quotes.erikreagan.com

Quick Start

Fetch a random quote with JavaScript:

const res = await fetch('https://quotes.erikreagan.com/api/random');
const quote = await res.json();
console.log(quote.quote, '—', quote.author);
GET

/api/random

Returns a random quote. Each request returns a different quote from the collection.

Query Parameters

Parameter Type Description
only_themes string Optional. Comma-separated list of themes. Return quotes only from these themes (matches theme and tags). Use /api/themes to get available values.
exclude_themes string Optional. Comma-separated list of themes to exclude (matches theme and tags). Takes priority over only_themes.
exclude_quotes string Optional. Comma-separated list of quote IDs to exclude from results. Useful to avoid showing the same quote twice in a row.

Example Request

curl https://quotes.erikreagan.com/api/random

Filter to specific themes:

curl "https://quotes.erikreagan.com/api/random?only_themes=wisdom,character"

Exclude themes:

curl "https://quotes.erikreagan.com/api/random?exclude_themes=wisdom"

Response

200 OK

{
  "id": "marcus-aurelius-a1b2c3d4",
  "quote": "Waste no more time arguing about what a good man should be. Be one.",
  "author": "Marcus Aurelius",
  "source": "Meditations",
  "tags": [
    "virtue",
    "action"
  ],
  "theme": "character",
  "permalink": "https://quotes.erikreagan.com/q/marcus-aurelius-a1b2c3d4",
  "images": {
    "tall": "https://quotes.erikreagan.com/image/marcus-aurelius-a1b2c3d4/tall.png",
    "square": "https://quotes.erikreagan.com/image/marcus-aurelius-a1b2c3d4/square.png",
    "wide": "https://quotes.erikreagan.com/image/marcus-aurelius-a1b2c3d4/wide.png"
  }
}

Response Fields

Field Type Description
id string Unique quote identifier
quote string The quote text
author string Who said or wrote the quote
source string Book, speech, or other origin
tags string[] Related topic tags
theme string Primary theme the quote belongs to
permalink string Permanent URL to the quote page
images object Shareable images in three sizes: tall, square, and wide

Errors

404 Not Found — returned when no quotes match the given filters

{
  "error": "No quotes found"
}

Try It

Request URL

only_themes
exclude_themes

Auto-filled with the last returned quote ID for this demo

Response

 
GET

/api/themes

Returns all available themes. Useful for building dynamic theme filters with /api/random.

Example Request

curl https://quotes.erikreagan.com/api/themes

Response

200 OK

[
  {
    "slug": "character",
    "name": "Character",
    "description": "Quotes about integrity, virtue, and moral strength",
    "quoteCount": 12,
    "permalink": "https://quotes.erikreagan.com/themes/character"
  }
]

Response Fields

Field Type Description
slug string URL-safe theme identifier. Use this value with only_themes and exclude_themes.
name string Display name for the theme
description string Short description of the theme
quoteCount number Number of quotes in this theme
permalink string Permanent URL to the theme page

Try It

Request URL

Response

 

Notes

  • No authentication or API key is needed.
  • CORS is enabled for all origins, so you can call the API directly from browser JavaScript.
  • Responses use Content-Type: application/json.
  • All errors return { "error": "..." } with an appropriate HTTP status code.
  • There are no rate limits currently, but please be reasonable.
  • The collection is regularly updated with new quotes.