API Documentation


Getting Started

The RandomQuotes API is designed to help you easily integrate inspirational and motivational quotes into your applications.


API Endpoints

Endpoint Method URL
All Quotes GET /api/quotes
Random Quote GET /api/random
Quote by ID GET /api/quotes/1

Example Responses

[
    {
        "id": 1,
        "quote": "The best way to get started is to quit talking and begin doing.",
        "author": "Walt Disney"
    },
    {
        "id": 2,
        "quote": "The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.",
        "author": "Winston Churchill"
    },
    {
        "id": 3,
        "quote": "Don’t let yesterday take up too much of today.",
        "author": "Will Rogers"
    }
]
{
    "id": 1,
    "quote": "The best way to get started is to quit talking and begin doing.",
    "author": "Walt Disney"
}

Rate Limiting

Window Duration: 15 minutes

Maximum Requests: 100 requests per IP within the window duration

Response on Limit Exceed:

{
  "message": "Too many requests from this IP, please try again after 15 minutes"
}

Usage

You can use the API to display quotes on your website or application to motivate your users. Here are some examples of how you can use the API with JavaScript:

fetch('https://random-quotes-freeapi.vercel.app/api/random')
    .then(response => response.json())
    .then(data => {
        console.log(data.quote);
        console.log("- " + data.author);
    });
const quoteId = 1; // Example ID
fetch(`https://random-quotes-freeapi.vercel.app/api/quotes/${quoteId}`)
    .then(response => response.json())
    .then(data => {
        console.log(data.quote);
        console.log("- " + data.author);
    });