Endpoints
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.
Quotes
GET /quotes/random
Get random quotes
Parameters
| Name | Type | Description |
|---|---|---|
| limit | integer | Number 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
| Name | Type | Description |
|---|---|---|
| days | integer | Number of days to look back (default: 30) |
| limit | integer | Maximum 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
| Name | Type | Description |
|---|---|---|
| min | integer | Minimum character length |
| max | integer | Maximum character length |
Search
GET /search
Search quotes and authors
Parameters
| Name | Type | Description |
|---|---|---|
| q | string | Search query (required, min 2 chars) |
| type | string | Search type: all, quotes, authors |
| page | integer | Page number |
| per_page | integer | Results per page |
Example Request
curl "https://allmyquotes.com/api/search?q=love&type=quotes"
GET /search/suggestions
Get search suggestions for autocomplete
Parameters
| Name | Type | Description |
|---|---|---|
| q | string | Search query (min 2 chars) |
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 Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Access denied |
| 404 | Not Found - Resource does not exist |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal 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:
| Tier | Rate Limit | Notes |
|---|---|---|
| Public (no API key) | 100 requests/day | Per IP address |
| Free (with API key) | 1,000 requests/day | Coming soon |
| Pro | 10,000 requests/day | Coming soon |
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']}";
}