Fav Quotes

FavQs API v1

Our API lets you interact with FavQs using HTTPS.

All data is sent and received as JSON.

A token is required to access our API (except for the Quote of the Day).

For authenticated API calls, pass your access token in via the header.

$ curl -H 'Authorization: Token token="YOUR_TOKEN"'

For testing the API on the command line, we recommend creating an alias.

$ alias favqs='curl -H "Authorization: Token token=\"YOUR_TOKEN\""'

The header of your request should look like this:

Authorization: Token token="your-application-token-here"

Note:  This format will not work:

Authorization: "your-application-token-here"

You can specify the version in the header of your calls.

$ curl -H 'Accept: application/vnd.favqs.v1+json;'

Note:  The API will default to the latest version if no version is specified.

All responses include an ETag (Entity Tag) in the header. The ETag identifies the specific version of a returned resource. Use this value to check for changes to a resource by repeating the request and passing the ETag value in the If-None-Match header. If the resource has not changed, a 304 Not Modified status will be returned with an empty body. If the resource has changed, the request will return the resource.

Response
HTTP/1.1 200 OK 
...
Etag: "558f0b9bea2e6910b1f93de7f4c0d47c"
Request
$ curl -I -H 'If-None-Match: "558f0b9bea2e6910b1f93de7f4c0d47c"'
HTTP/1.1 304 Not Modified

Access to the API is rate limited by IP address. An IP address is allowed 30 requests in a 20 second interval.

The remaining number of requests is returned in the HTTP header 'Rate-Limit-Remaining'.

Response
HTTP/1.1 200 OK 
...
Rate-Limit-Remaining: 24

Quotes

Get the Quote of the Day.

Request
GET /api/qotd
Example
$ curl https://favqs.com/api/qotd
Response
{
  "date": "2014-05-04T15:09:00Z",
  "body": "Life is pure adventure, and the sooner we realize that, the quicker we will be able to treat life as art.",
  "author": "Maya Angelou",
  "author_permalink": "maya-angelou",
  "dialogue": false,
  "id": 576,
  "url": "https://favqs.com/quotes/maya-angelou/576-life-is-pure"
}

A list of quotes, paged 25 at a time.

Request
GET /api/quotes
Response
{
  "page": 1,
  "last_page": false,
  "quotes": [
    {
      "tags": [
        "linux",
        "programming",
        "code",
        "finnish-american"
      ],
      "favorite": false,
      "author_permalink": "linus-torvalds",
      "body": "Talk is cheap. Show me the code.",
      "id": 253,
      "favorites_count": 1,
      "dialogue": false,
      "author": "Linus Torvalds",
      "url": "https://favqs.com/quotes/linus-torvalds/253-talk-is-cheap-s-"
    },
    ...
  ]
}

Optional Parameters

The list of quotes can be refined via these filters.

ParameterDescription
filterKeyword search
typeEither ['author', 'tag', 'user'] or omitted
pagePage number (25 quotes per page)

If the 'type' is omitted, the 'filter' will be a keyword search.

If the 'type' is not omitted, the 'filter' will be used to look up the 'type'. For example, the following query will return quotes by Mark Twain.

GET https://favqs.com/api/quotes/?filter=Mark+Twain&type=author

Queries with the 'type' present and the 'filter' omitted will return the general index.


Typeahead

This resource provides a list of the public Authors, Tags, and Users in FavQs.

Request
GET /api/typeahead
Response
{
  "authors": [
    {
      "count": 21,
      "permalink": "mark-twain",
      "name": "Mark Twain"
    },
    ...
  ],
  "tags": [
    {
      "count": 44,
      "permalink": "funny",
      "name": "funny"
    },
    ...
  ],
  "users": [
    {
      "count": 432,
      "permalink": "gose",
      "name": "gose"
    },
    ...
  ]
}

With this data, typeahead can be performed locally giving the user a fast response.


Request Access

Access to our API requires a token.

  • Sign up for an account
  • Request access using the form below