Quotable
Random Quotes API
Install / Use
/learn @lukePeavey/QuotableREADME
Quotable
Quotable is a free, open source quotations API. It was originally built as part of a FreeCodeCamp project. If you are interested in contributing, please check out the Contributors Guide.
Rate Limit
There is a rate limit of 180 requests per minute, per IP address. If you exceed the rate limit, the API will respond with a 429 error.
API Servers
https://api.quotable.io
Postman
You can try out the API on our public Postman workspace.
API Reference <!-- omit in toc -->
- Get random quote
- Get Random Quotes
- List Quotes
- Get Quote By ID
- List Authors
- Search Quotes (beta)
- Search Authors (beta)
- Get Author By Slug
- List Tags
Examples <!-- omit in toc -->
- Basic Quote Machine (CodePen)
- React Quote Machine (CodeSandbox)
- React Native App (Github)
- Paginated Author List (codeSandbox)
- Paginated Quote List (codeSandbox)
Get random quote
GET /random
Returns a single random quote from the database
⛔️ This method is deprecated in favor of Get Random Quotes
Query parameters
| param | type | Description |
| :-------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| maxLength | Int | The maximum Length in characters ( can be combined with minLength ) |
| minLength | Int | The minimum Length in characters ( can be combined with maxLength ) |
| tags | String | Get a random quote with specific tag(s). This takes a list of one or more tag names, separated by a comma (meaning AND) or a pipe (meaning OR). A comma separated list will match quotes that have all of the given tags. While a pipe (\|) separated list will match quotes that have any one of the provided tags. Tag names are not case-sensitive. Multi-word tags can be kebab-case ("tag-name") or space separated ("tag name") |
| author | String | Get a random quote by one or more authors. The value can be an author name or slug. To include quotes by multiple authors, provide a pipe-separated list of author names/slugs. |
| authorId | String | deprecated <br> Same as author param, except it uses author _id instead of slug |
Response
{
_id: string
// The quotation text
content: string
// The full name of the author
author: string
// The `slug` of the quote author
authorSlug: string
// The length of quote (number of characters)
length: number
// An array of tag names for this quote
tags: string[]
}
<br>
Get Random Quotes
GET /quotes/random
Get one or more random quotes from the database. This method supports several filters that can be used to get random quotes with specific properties (ie tags, quote length, etc.)
By default, this methods returns a single random quote. You can specify the number of random quotes to return via the limit parameter.
<br>⚠️ This method is equivalent to the
/randomendpoint. The only difference is the response format: Instead of retuning a singleQuoteobject, this method returns anArrayofQuoteobjects.
| param | type | Description |
| :-------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| limit | Int | default: 1 min: 1 max: 50 <br> The number of random quotes to retrieve. |
| maxLength | Int | The maximum Length in characters ( can be combined with minLength ) |
| minLength | Int | The minimum Length in characters ( can be combined with maxLength ) |
| tags | String | Get a random quote with specific tag(s). This takes a list of one or more tag names, separated by a comma (meaning AND) or a pipe (meaning OR). A comma separated list will match quotes that have all of the given tags. While a pipe (\|) separated list will match quotes that have any one of the provided tags. Tag names are not case-sensitive. Multi-word tags can be kebab-case ("tag-name") or space separated ("tag name") |
| author | String | Get a random quote by one or more authors. The value can be an author name or slug. To include quotes by multiple authors, provide a pipe-separated list of author names/slugs. |
| authorId | String | deprecated <br>Same as author param, except it uses author _id instead of slug |
Response
// An array containing one or more Quotes
Array<{
_id: string
// The quotation text
content: string
// The full name of the author
author: string
// The `slug` of the quote author
authorSlug: string
// The length of quote (number of characters)
length: number
// An array of tag names for this quote
tags: string[]
}>
Examples
Get random quote try in browser
GET /quotes/random
Get 5 random quotes try in browser
GET /quotes/random?limit=3
Random Quote with tags "technology" AND "famous-quotes" try in browser
GET /quotes/random?tags=technology,famous-quotes
Random Quote with tags "History" OR "Civil Rights" try in browser
GET /quotes/random?tags=history|civil-rights
Random Quote with a maximum length of 50 characters try in browser
GET /quotes/random?maxLength=50
Random Quote with a length between 100 and 140 characters try in browser
GET /quotes/random?minLength=100&maxLength=140
<br>
List Quotes
GET /quotes
Get all quotes matching a given query. By default, this will return a paginated list of all quotes, sorted by _id. Quotes can also be filter by author, tag, and length.
Query parameters
| param | type | Description
