API Reference
Categories
API reference for the Categories endpoint — retrieve all available categories with quote counts.
Categories organize quotes and authors by topic or theme. The Categories endpoint returns the full list in one call — no pagination needed.
List Categories
GET /api/v1/categories
This endpoint accepts no query parameters.
curl -H "X-API-Key: your_api_key_here" \
"https://quotegallery.nl/api/v1/categories"
const response = await fetch(
'https://quotegallery.nl/api/v1/categories',
{ headers: { 'X-API-Key': process.env.QUOTE_GALLERY_API_KEY } }
)
const { data: categories } = await response.json()
categories.forEach((c) => console.log(`${c.name}: ${c.quoteCount} quotes`))
import requests, os
response = requests.get(
'https://quotegallery.nl/api/v1/categories',
headers={'X-API-Key': os.environ['QUOTE_GALLERY_API_KEY']}
)
for c in response.json()['data']:
print(f'{c["name"]}: {c["quoteCount"]} quotes')
{
"data": [
{ "id": "wisdom", "name": "Wisdom", "quoteCount": 245 },
{ "id": "philosophy", "name": "Philosophy", "quoteCount": 189 },
{ "id": "life", "name": "Life", "quoteCount": 167 },
{ "id": "inspirational", "name": "Inspirational", "quoteCount": 156 },
{ "id": "success", "name": "Success", "quoteCount": 134 }
]
}
| Field | Type | Description |
|---|---|---|
data[].id | string | Category slug, used in filter parameters |
data[].name | string | Human-readable display name |
data[].quoteCount | number | Number of approved quotes in this category |
| Status | Description |
|---|---|
401 | Missing or invalid API key |
The categories list is small and changes infrequently. Cache it for a few hours to avoid burning requests on repeat calls.
Using categories with other endpoints
Category slugs from the id field are what you pass as the categories parameter on Quotes, Authors, and Playlists endpoints. Multiple slugs are comma-separated and match with OR logic.
# Quotes in any of these categories
curl -H "X-API-Key: your_api_key_here" \
"https://quotegallery.nl/api/v1/quotes?categories=wisdom,philosophy,life"
# Authors associated with technology or science
curl -H "X-API-Key: your_api_key_here" \
"https://quotegallery.nl/api/v1/authors?categories=technology,science"
# Playlists tagged as inspirational
curl -H "X-API-Key: your_api_key_here" \
"https://quotegallery.nl/api/v1/playlists?categories=inspirational"
Example: cached category lookup
let cache = null
let expiry = 0
async function getCategories(apiKey) {
if (cache && Date.now() < expiry) return cache
const response = await fetch(
'https://quotegallery.nl/api/v1/categories',
{ headers: { 'X-API-Key': apiKey } }
)
const { data } = await response.json()
cache = data
expiry = Date.now() + 4 * 60 * 60 * 1000 // 4 hours
return cache
}
async function getCategoryName(apiKey, slug) {
const categories = await getCategories(apiKey)
return categories.find((c) => c.id === slug)?.name ?? slug
}