Overview

The AllMyQuotes API provides programmatic access to our database of quotes. All endpoints return JSON responses and follow RESTful conventions.

Base URL
https://allmyquotes.com/api
Response Format

All responses follow this structure:

{
  "success": true,
  "data": { ... },
  "error": null
}

Authentication

The public API endpoints do not require authentication. For higher rate limits and additional features, API keys will be available in the future.

API key authentication coming soon

Quotes

GET /quotes/random

Get random quotes

Parameters
NameTypeDescription
limitintegerNumber of quotes (default: 10, max: 50)
Example Request
curl "https://allmyquotes.com/api/quotes/random?limit=5"
Example Response
{
  "success": true,
  "data": [
    {
      "id": 123,
      "path": "the-only-way-to-do-great-work",
      "quotes": "The only way to do great work is to love what you do.",
      "author_name": "Steve",
      "author_surname": "Jobs",
      "author_path": "steve-jobs"
    }
  ]
}

GET /quotes/{path}

Get a single quote by its path

Example Request
curl "https://allmyquotes.com/api/quotes/the-only-way-to-do-great-work"

GET /quotes/recent

Get recently added quotes

Parameters
NameTypeDescription
daysintegerNumber of days to look back (default: 30)
limitintegerMaximum quotes to return (default: 20)

GET /quotes/by-author/{author_id}

Get all quotes by a specific author

GET /quotes/by-length

Get quotes filtered by character length

Parameters
NameTypeDescription
minintegerMinimum character length
maxintegerMaximum character length

Authors

GET /authors

Get a paginated list of authors

Parameters
NameTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 20, max: 100)
letterstringFilter by first letter of surname
typestringFilter by author type
sortstringSort by: name, quotes, date

GET /authors/{path}

Get author details by path

GET /authors/{path}/quotes

Get all quotes by an author

Topics

GET /topics

Get list of all topics

GET /topics/{slug}

Get quotes for a specific topic

Error Handling

When an error occurs, the API returns an appropriate HTTP status code and error message.

Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Authentication required
403Forbidden - Access denied
404Not Found - Resource does not exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error
Error Response Format
{
  "success": false,
  "data": null,
  "error": "Error message description"
}

Rate Limits

To ensure fair usage, the API has the following rate limits:

TierRate LimitNotes
Public (no API key)100 requests/dayPer IP address
Free (with API key)1,000 requests/dayComing soon
Pro10,000 requests/dayComing soon
Please be respectful of the API limits. Excessive requests may result in temporary blocking.

Code Examples

JavaScript (Fetch)
async function getRandomQuote() {
  const response = await fetch('https://allmyquotes.com/api/quotes/random?limit=1');
  const data = await response.json();

  if (data.success && data.data.length > 0) {
    const quote = data.data[0];
    console.log(`"${quote.quotes}" — ${quote.author_name} ${quote.author_surname}`);
  }
}

getRandomQuote();
Python
import requests

def get_random_quote():
    response = requests.get('https://allmyquotes.com/api/quotes/random', params={'limit': 1})
    data = response.json()

    if data['success'] and data['data']:
        quote = data['data'][0]
        print(f'"{quote["quotes"]}" — {quote["author_name"]} {quote["author_surname"]}')

get_random_quote()
PHP
<?php
$response = file_get_contents('https://allmyquotes.com/api/quotes/random?limit=1');
$data = json_decode($response, true);

if ($data['success'] && !empty($data['data'])) {
    $quote = $data['data'][0];
    echo "\"{$quote['quotes']}\" — {$quote['author_name']} {$quote['author_surname']}";
}