---
title: "Quotes"
description: "API reference for Quote endpoints - list, filter, and retrieve quotes."
canonical_url: "https://docs.quotegallery.nl/docs/api/quotes"
---
# Quotes

> API reference for Quote endpoints - list, filter, and retrieve quotes.

The Quotes endpoints let you retrieve and filter approved public quotes. All responses wrap data in a `data` field and include a `pagination` object on list endpoints.

## List Quotes

```text
GET /api/v1/quotes
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        language
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      Return text in this language (<code>
        en
      </code>
      
      , <code>
        nl
      </code>
      
      , <code>
        tr
      </code>
      
      , …) where a translation exists. It does not filter
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        categories
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      Comma-separated category slugs. Matches any (OR logic)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        author_id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      Filter by a specific author ID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        playlist_id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      
    </td>
    
    <td>
      Filter by a specific playlist ID
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        limit
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        20
      </code>
    </td>
    
    <td>
      Results per page (max <code>
        100
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        offset
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Pagination offset
    </td>
  </tr>
</tbody>
</table>

<tabs>
<tabs-item label="cURL">

```bash
curl -H "X-API-Key: your_api_key_here" \
  "https://quotegallery.nl/api/v1/quotes?language=en&categories=wisdom,success&limit=10"
```

</tabs-item>

<tabs-item label="JavaScript">

```js
const response = await fetch(
  'https://quotegallery.nl/api/v1/quotes?language=en&categories=wisdom,success&limit=10',
  { headers: { 'X-API-Key': process.env.QUOTE_GALLERY_API_KEY } }
)

const { data, pagination } = await response.json()
```

</tabs-item>

<tabs-item label="Python">

```python
import requests, os

response = requests.get(
    'https://quotegallery.nl/api/v1/quotes',
    headers={'X-API-Key': os.environ['QUOTE_GALLERY_API_KEY']},
    params={'language': 'en', 'categories': 'wisdom,success', 'limit': 10}
)

data = response.json()
```

</tabs-item>
</tabs>

```json
{
  "data": [
    {
      "id": "abc123",
      "quoteNumber": 1043,
      "url": "https://quotegallery.nl/quotes/1043-the-only-way-to-do-great-work-is",
      "text": "The only way to do great work is to love what you do.",
      "language": "en",
      "categories": ["wisdom", "success"],
      "likeCount": 42,
      "author": { "id": "xyz789", "name": "Steve Jobs" },
      "createdAt": 1704067200000
    }
  ],
  "pagination": { "total": 100, "limit": 10, "offset": 0, "hasMore": true }
}
```

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        data[].id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Unique quote identifier
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].quoteNumber
      </code>
    </td>
    
    <td>
      <code>
        number | null
      </code>
    </td>
    
    <td>
      The quote’s permanent number, the one in its web address. It never changes. <code>
        null
      </code>
      
       only for a quote that has not been numbered yet
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].url
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The quote’s canonical page on quotegallery.nl, <code>
        https://quotegallery.nl/quotes/<number>-<slug>
      </code>
      
      . Link to it when you show the quote
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].text
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Quote text
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].language
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The language you asked for, or the quote’s own when you asked for none. It does not prove that a translation exists
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].categories
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      Category slugs
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].likeCount
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Number of likes
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].author.id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Author identifier
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].author.name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Author display name
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data[].createdAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Unix timestamp (ms)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pagination.total
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Matches counted so far, see below
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pagination.hasMore
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether more of the counted matches follow
    </td>
  </tr>
</tbody>
</table>

### How far the list reaches

The quote list counts matches among the first `(offset + limit) × 10` quotes it reads, and never reads more than 8,000. So `pagination.total` is not the size of the catalog, and it can grow as you page. With a narrow `categories` filter a page can come back short, and `hasMore` can be `false` although later quotes would match: ask for a larger `limit` to look further.

## Random Quote

Returns a single random approved quote. Useful for quote-of-the-day features and loading screens.

```text
GET /api/v1/quotes/random
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        language
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Return text in this language where a translation exists. It does not filter
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        categories
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Comma-separated category slugs. Matched against a random sample of 500 quotes, so a rare category can answer <code>
        404
      </code>
      
       once and succeed on the next call
    </td>
  </tr>
</tbody>
</table>

<tabs>
<tabs-item label="cURL">

```bash
curl -H "X-API-Key: your_api_key_here" \
  "https://quotegallery.nl/api/v1/quotes/random?language=en"
```

</tabs-item>

<tabs-item label="JavaScript">

```js
const response = await fetch(
  'https://quotegallery.nl/api/v1/quotes/random?language=en',
  { headers: { 'X-API-Key': process.env.QUOTE_GALLERY_API_KEY } }
)

const { data: quote } = await response.json()
console.log(`"${quote.text}" - ${quote.author.name}`)
```

</tabs-item>
</tabs>

```json
{
  "data": {
    "id": "abc123",
    "quoteNumber": 2210,
    "url": "https://quotegallery.nl/quotes/2210-stay-hungry-stay-foolish",
    "text": "Stay hungry, stay foolish.",
    "language": "en",
    "categories": ["inspirational"],
    "likeCount": 128,
    "author": { "id": "xyz789", "name": "Steve Jobs" },
    "createdAt": 1704067200000
  }
}
```

## Get Quote by ID

Returns a single quote with full detail, including all available translations.

```text
GET /api/v1/quotes/:id
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        language
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Preferred language for the primary <code>
        text
      </code>
      
       field
    </td>
  </tr>
</tbody>
</table>

<tabs>
<tabs-item label="cURL">

```bash
curl -H "X-API-Key: your_api_key_here" \
  "https://quotegallery.nl/api/v1/quotes/abc123?language=en"
```

</tabs-item>

<tabs-item label="JavaScript">

```js
const response = await fetch(
  `https://quotegallery.nl/api/v1/quotes/abc123?language=en`,
  { headers: { 'X-API-Key': process.env.QUOTE_GALLERY_API_KEY } }
)

const { data: quote } = await response.json()
```

</tabs-item>
</tabs>

```json
{
  "data": {
    "id": "abc123",
    "quoteNumber": 1043,
    "url": "https://quotegallery.nl/quotes/1043-the-only-way-to-do-great-work-is",
    "text": "The only way to do great work is to love what you do.",
    "language": "en",
    "categories": ["wisdom", "success"],
    "likeCount": 42,
    "author": { "id": "xyz789", "name": "Steve Jobs", "imageUrl": "https://..." },
    "translations": [
      { "language": "en", "text": "The only way to do great work is to love what you do." }
    ],
    "createdAt": 1704067200000
  }
}
```

The `translations` array contains all available language versions of the quote. The top-level `text` field reflects the language requested via the `language` param, or the quote’s original text if omitted.

### Quote number and link

Every quote the API returns, in lists, random picks and single lookups, and inside playlist and author responses, carries two fields that point at its page on quotegallery.nl:

- `quoteNumber` is the quote’s permanent number. It is assigned once and never reused, so you can store it.
- `url` is the full address of the quote’s page, `https://quotegallery.nl/quotes/<number>-<slug>`. The number finds the quote; the slug is the first words of the text and can change if the text is edited, in which case the old address redirects to the new one. Show or store the `url` if you want your users to be able to read more about a quote.

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        404
      </code>
    </td>
    
    <td>
      Quote ID not found or not publicly approved
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        401
      </code>
    </td>
    
    <td>
      Missing or invalid API key
    </td>
  </tr>
</tbody>
</table>

## Examples

### Quote of the day with caching

```js
async function getQuoteOfTheDay(apiKey) {
  const cacheKey = `qotd-${new Date().toISOString().slice(0, 10)}`
  const cached = cache.get(cacheKey)
  if (cached) return cached

  const response = await fetch(
    'https://quotegallery.nl/api/v1/quotes/random?language=en',
    { headers: { 'X-API-Key': apiKey } }
  )

  const { data: quote } = await response.json()
  cache.set(cacheKey, quote, 86400)
  return quote
}
```

### Quotes from a playlist

```js
// One page: up to 100 quotes
async function getPlaylistQuotes(apiKey, playlistId) {
  const response = await fetch(
    `https://quotegallery.nl/api/v1/quotes?playlist_id=${playlistId}&limit=100`,
    { headers: { 'X-API-Key': apiKey } }
  )

  const { data } = await response.json()
  return data
}
```


## Sitemap

See the full [sitemap](https://docs.quotegallery.nl/sitemap.md) for all pages.
