DEV Community

Cover image for I Built a Free Public Random Quotes API — No Key, No Auth, Just Use It
Prayush Adhikari
Prayush Adhikari

Posted on

I Built a Free Public Random Quotes API — No Key, No Auth, Just Use It

Hey there! So you've been Googling for a free quotes API that doesn't require signing up, doesn't throttle you after 100 requests, and actually has useful filters?

Yeah, I built that. It's live, it's public, and I want you to use it.

Base URL: https://quotesapi.prayushadhikari.com.np/api

No API key. No authentication. No credit card. Just copy the URL and start fetching quotes. Let me show you everything it can do.


Why Another Quotes API?

Most random quotes APIs I found while building projects were either:

  • Dead (domain expired, RIP)
  • Rate-limited to the point of uselessness
  • Behind a signup wall for basic features
  • Returning the same 20 quotes forever

I needed something with real filtering — by author, category, text search, quote length. So I built it. And since I built it anyway, I hosted it publicly so you don't have to.


Try It Right Now

Open your browser or terminal and hit this:

curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes/random"
Enter fullscreen mode Exit fullscreen mode

You'll get back:

{
  "data": [
    {
      "quote": "I feel bare. I didn't realize I wore my secrets as armor until they were gone and now everyone sees me as I really am.",
      "author": "Veronica Roth, Insurgent",
      "category": ["armor", "secrets"]
    }
  ],
  "meta": {
    "total": 499708,
    "limit": 1,
    "offset": 0,
    "order": "random",
    "returned": 1
  }
}
Enter fullscreen mode Exit fullscreen mode

Notice category is an array — a single quote can belong to multiple categories. And yeah, meta.total is 499,708. Nearly half a million quotes. That's not a typo.

That's it. No setup, no tokens, no nonsense. It just works.


All Available Endpoints

Hit the discovery endpoint first — it gives you the full route map:

curl -s "https://quotesapi.prayushadhikari.com.np/api"
Enter fullscreen mode Exit fullscreen mode

Here's what's available:

Endpoint What it does
GET /api Route map — your starting point
GET /api/quotes Paginated quotes with all filters
GET /api/quotes/random Random quote(s), default limit=1
GET /api/categories All available categories
GET /api/authors Searchable author list
GET /api/health Load status + diagnostics

The Random Quotes Endpoint

The most popular use case — get a random quote:

# Single random quote (default)
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes/random"

# 5 random quotes at once
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes/random?limit=5"
Enter fullscreen mode Exit fullscreen mode

This is what you want for daily quote widgets, Discord bots, browser extensions, email footers — anything that needs a surprise every time.


Filters That Actually Work

This is where this free quotes API beats most alternatives. You're not stuck with just "give me random." Let me show you what's possible.

Filter by Category

# Quotes about wisdom
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?category=wisdom&limit=5"

# Multiple categories (OR — matches either)
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?categories=wisdom,motivation&limit=10"

# Multiple categories (AND — must match all)
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?categories=wisdom,motivation&match_categories=all"

# Exclude a category
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?exclude_category=politics&limit=10"
Enter fullscreen mode Exit fullscreen mode

Filter by Author

# Partial match, case-insensitive
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?author=oscar&limit=5"

# Exact match
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?author_exact=Oscar%20Wilde"

# Exclude specific author
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?exclude_author=Napoleon&limit=10"
Enter fullscreen mode Exit fullscreen mode

Full-Text Search

# Search inside quote text
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?q=journey&order=text&limit=20"
Enter fullscreen mode Exit fullscreen mode

Quote Length Filters

Perfect when you have a UI constraint — like a widget that only fits a tweet-length quote:

# Short quotes only (under 100 characters)
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?max_len=100&limit=5"

# Medium length range
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?min_len=80&max_len=200&limit=5"
Enter fullscreen mode Exit fullscreen mode

Discover What's in the Dataset

Before you build filters, explore what categories and authors exist:

# All categories
curl -s "https://quotesapi.prayushadhikari.com.np/api/categories"

# Categories with quote counts
curl -s "https://quotesapi.prayushadhikari.com.np/api/categories?counts=true"

# Search authors by name
curl -s "https://quotesapi.prayushadhikari.com.np/api/authors?q=einstein&limit=10"

# All authors (up to 100)
curl -s "https://quotesapi.prayushadhikari.com.np/api/authors"
Enter fullscreen mode Exit fullscreen mode

The counts=true on categories returns { name, count }[] which is exactly what you need to build a category picker UI.


The Seed Param — My Favorite Feature

This is the most underrated param in this random quotes API.

curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?order=random&seed=42&limit=10"
Enter fullscreen mode Exit fullscreen mode

Same seed = same "random" order, every single time. Use cases:

  • Daily quote of the day — use today's date as the seed (seed=20250506)
  • Shareable quote lists — send someone a seed and they see what you see
  • Reproducible testing — no flaky randomness in your test suite

Pagination for the Full Dataset

Random order doesn't support offset — that's intentional. But if you switch to deterministic ordering, pagination works perfectly:

# Page 1
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?order=text&limit=20&offset=0"

# Page 2
curl -s "https://quotesapi.prayushadhikari.com.np/api/quotes?order=text&limit=20&offset=20"
Enter fullscreen mode Exit fullscreen mode

The meta field in every response gives you total and returned so you can compute pages on your end.


Using the API in JavaScript

This quotes API supports CORS, so you can call it directly from the browser — no backend needed.

// Fetch a single random quote
const getRandomQuote = async () => {
  const res = await fetch('https://quotesapi.prayushadhikari.com.np/api/quotes/random');
  const { data } = await res.json();
  return data[0];
};

// Fetch quotes by category
const getQuotesByCategory = async (category, limit = 5) => {
  const params = new URLSearchParams({ category, limit });
  const res = await fetch(`https://quotesapi.prayushadhikari.com.np/api/quotes?${params}`);
  const { data, meta } = await res.json();
  return { quotes: data, total: meta.total };
};

// Daily quote using date as seed
const getDailyQuote = async () => {
  const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');
  const params = new URLSearchParams({ order: 'random', seed: today, limit: 1 });
  const res = await fetch(`https://quotesapi.prayushadhikari.com.np/api/quotes?${params}`);
  const { data } = await res.json();
  return data[0];
};

// Example usage
const quote = await getRandomQuote();
console.log(`"${quote.quote}" — ${quote.author}`);
Enter fullscreen mode Exit fullscreen mode

Using It in Python

import requests
from datetime import date

BASE_URL = "https://quotesapi.prayushadhikari.com.np/api"

def get_random_quote(category=None, limit=1):
    params = {"limit": limit}
    if category:
        params["category"] = category

    res = requests.get(f"{BASE_URL}/quotes/random", params=params)
    data = res.json()
    return data["data"]

def get_daily_quote():
    seed = date.today().strftime("%Y%m%d")
    res = requests.get(f"{BASE_URL}/quotes", params={"order": "random", "seed": seed, "limit": 1})
    return res.json()["data"][0]

# Get a random motivation quote
quotes = get_random_quote(category="motivation")
for q in quotes:
    print(f'"{q["quote"]}"{q["author"]}')

# Get today's quote (same every time you call it today)
daily = get_daily_quote()
print(f'Daily: "{daily["quote"]}"')
Enter fullscreen mode Exit fullscreen mode

All Query Parameters at a Glance

Here's the full reference for GET /api/quotes and GET /api/quotes/random:

Parameter Description Example
author Substring match on author name author=einstein
author_exact Exact author name author_exact=Albert%20Einstein
exclude_author Exclude this author exclude_author=Napoleon
category Must include this category category=wisdom
categories Comma-separated, OR logic categories=wisdom,love
match_categories=all Require ALL listed categories match_categories=all
exclude_category Exclude this category exclude_category=politics
q Substring search in quote text q=courage
min_len / max_len Quote character length range min_len=50&max_len=200
limit Results per page (default 10, max 100) limit=25
offset Pagination offset (not for random) offset=40
order random, author, text, none order=author
seed Deterministic shuffle for random seed=42
legacy=true Returns bare JSON array legacy=true
meta=false Omit meta object from response meta=false

What Can You Build With This?

Here's what I'd love to see people building:

  • Daily quote bots for Discord, Telegram, or Slack
  • New tab browser extensions with category-filtered quotes
  • Motivational widgets on personal portfolio sites
  • Quote-of-the-day email newsletters using the seed param
  • Mobile apps that match quote moods to user input
  • Screensaver or wallpaper generators with random quotes
  • Obsidian plugins that pull quotes into your daily notes
  • CLI tools that show a quote on every terminal open

The API handles CORS for all GET requests, so browser-direct calls work without a proxy backend.


Troubleshooting

Getting empty data: []?

Hit the health endpoint first:

curl -s "https://quotesapi.prayushadhikari.com.np/api/health"
Enter fullscreen mode Exit fullscreen mode

It'll tell you if the full dataset loaded correctly or if there's a fallback in use.

Filters returning fewer results than expected?

You might be combining too many strict filters. Try loosening them one at a time. The q text search is a substring match, so q=inspiration won't match a quote containing "inspire."

Need ALL quotes, not just 10?

Use order=text (or order=author) with offset for pagination. meta.total tells you how many exist total. Don't use order=random with offset — it won't work.


Wrapping Up

I built this free random quotes API because I was tired of hitting dead endpoints and rate limits every time I wanted to add a quote feature to a side project. Now you don't have to be.

It's free. It's public. It's not going anywhere.

Start here: https://quotesapi.prayushadhikari.com.np/api

Drop a comment with what you're building — I read every single one and it helps me figure out what to add next. Want me to cover setting up your own instance, adding new quote datasets, or building a Discord bot with this? Let me know.

I'm Prayush Adhikari, grinding through computer engineering and shipping things in public.

Now go fetch some quotes.

Top comments (0)