Guides

SDKs & Libraries

Official and community SDKs, libraries, and tools for integrating with the Quote Gallery API.

SDKs & Libraries

While the Quote Gallery API can be used with any HTTP client, SDKs and wrapper libraries make integration faster and more pleasant. This page lists official utilities and community-contributed packages.

Official Tools

JavaScript / TypeScript Client

A lightweight, fully-typed API client you can copy directly into your project. No package installation required.

class QuoteGalleryClient {
  constructor(apiKey, options = {}) {
    this.apiKey = apiKey
    this.baseUrl = options.baseUrl ?? 'https://quotegallery.nl/api/v1'
  }

  async request(endpoint, params = {}) {
    const url = new URL(`${this.baseUrl}${endpoint}`)
    Object.entries(params).forEach(([key, value]) => {
      if (value !== undefined && value !== null) {
        url.searchParams.set(key, String(value))
      }
    })

    const response = await fetch(url.toString(), {
      headers: { 'X-API-Key': this.apiKey },
    })

    if (!response.ok) {
      const error = await response.json()
      throw new Error(`API Error ${response.status}: ${error.error}`)
    }

    return response.json()
  }

  getQuotes(params) { return this.request('/quotes', params) }
  getRandomQuote(params) { return this.request('/quotes/random', params) }
  getQuote(id, params) { return this.request(`/quotes/${id}`, params) }
  getAuthors(params) { return this.request('/authors', params) }
  getAuthor(id, params) { return this.request(`/authors/${id}`, params) }
  getPlaylists(params) { return this.request('/playlists', params) }
  getPlaylist(id, params) { return this.request(`/playlists/${id}`, params) }
  getCategories() { return this.request('/categories') }
}

Usage

const client = new QuoteGalleryClient(process.env.QUOTE_GALLERY_API_KEY)

const { data: quotes } = await client.getQuotes({ language: 'en', limit: 5 })
const { data: random } = await client.getRandomQuote({ language: 'en' })
const { data: categories } = await client.getCategories()
For a production-ready version with retry logic, timeouts, and structured error handling, see the full client example in the Error Handling guide.

Python Client

A minimal Python wrapper for the API:

import os
import requests

class QuoteGalleryClient:
    def __init__(self, api_key=None, base_url='https://quotegallery.nl/api/v1'):
        self.api_key = api_key or os.environ.get('QUOTE_GALLERY_API_KEY')
        self.base_url = base_url
        self.session = requests.Session()
        self.session.headers.update({'X-API-Key': self.api_key})

    def _request(self, endpoint, params=None):
        response = self.session.get(f'{self.base_url}{endpoint}', params=params)
        response.raise_for_status()
        return response.json()

    def get_quotes(self, **params):
        return self._request('/quotes', params)

    def get_random_quote(self, **params):
        return self._request('/quotes/random', params)

    def get_quote(self, quote_id, **params):
        return self._request(f'/quotes/{quote_id}', params)

    def get_authors(self, **params):
        return self._request('/authors', params)

    def get_author(self, author_id, **params):
        return self._request(f'/authors/{author_id}', params)

    def get_playlists(self, **params):
        return self._request('/playlists', params)

    def get_playlist(self, playlist_id, **params):
        return self._request(f'/playlists/{playlist_id}', params)

    def get_categories(self):
        return self._request('/categories')

Usage

client = QuoteGalleryClient()

quotes = client.get_quotes(language='en', limit=5)
random_quote = client.get_random_quote(language='en')
categories = client.get_categories()

Community Libraries

Community-contributed libraries are not maintained by the Quote Gallery team. Use them at your own discretion and check their documentation for the latest updates.

Have you built an SDK or library for the Quote Gallery API? We'd love to feature it here! Open an issue or pull request on our GitHub repository.
LanguageLibraryAuthorLink
Be the first to contribute!

Using Plain HTTP

You don't need an SDK to use the Quote Gallery API. Any HTTP client works. Here are quick examples in popular languages and tools:

cURL

curl -H "X-API-Key: $QUOTE_GALLERY_API_KEY" \
  "https://quotegallery.nl/api/v1/quotes?limit=5"

PHP

<?php
$apiKey = getenv('QUOTE_GALLERY_API_KEY');

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => 'https://quotegallery.nl/api/v1/quotes?limit=5',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey"],
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);

foreach ($data['data'] as $quote) {
    echo "\"{$quote['text']}\" — {$quote['author']['name']}\n";
}

Ruby

require 'net/http'
require 'json'
require 'uri'

api_key = ENV['QUOTE_GALLERY_API_KEY']
uri = URI('https://quotegallery.nl/api/v1/quotes?limit=5')

request = Net::HTTP::Get.new(uri)
request['X-API-Key'] = api_key

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

data = JSON.parse(response.body)

data['data'].each do |quote|
  puts "\"#{quote['text']}\" — #{quote['author']['name']}"
end

Go

package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
)

func main() {
    apiKey := os.Getenv("QUOTE_GALLERY_API_KEY")

    req, _ := http.NewRequest("GET", "https://quotegallery.nl/api/v1/quotes?limit=5", nil)
    req.Header.Set("X-API-Key", apiKey)

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)

    var result map[string]interface{}
    json.Unmarshal(body, &result)

    fmt.Println(string(body))
}

Rust

use reqwest::header;
use serde_json::Value;
use std::env;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = env::var("QUOTE_GALLERY_API_KEY")?;

    let client = reqwest::Client::new();
    let response = client
        .get("https://quotegallery.nl/api/v1/quotes?limit=5")
        .header("X-API-Key", &api_key)
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("{:#}", response);
    Ok(())
}

Building Your Own SDK

If you're building an SDK or wrapper library for the Quote Gallery API, here are some recommendations:

Version the Base URL
important
Always include the API version in the base URL (e.g., /api/v1). This makes it easy to support multiple API versions simultaneously when v2 is released.
Accept a Custom Base URL
recommended
Allow users to override the base URL for testing, proxying, or self-hosted scenarios.
Include Retry Logic
recommended
Handle 429 and 5xx responses with exponential backoff. Parse the X-RateLimit-Reset header for optimal retry timing.
Type the Responses
recommended
If your language supports it, provide typed response models for all endpoints. This greatly improves developer experience.
Support Environment Variables
recommended
Default to reading the API key from QUOTE_GALLERY_API_KEY environment variable so users don't need to pass it explicitly.
Respect Rate Limits
important
Expose rate limit information from response headers so consumers can make informed decisions about request pacing.
Copyright © 2026