API Documentation

Base URL

https://indian-quotes-api.vercel.app/api

Response Format

Fields Description

Quote Fields
  • id: Unique identifier (number)
  • created_at: Creation timestamp (ISO 8601)
  • quote: The actual quote text (string)
  • tags: Array of related tags (string[])
  • author_id: Reference to author (number)
  • author: Nested author object
Author Fields
  • id: Unique identifier (number)
  • img: Profile image URL (string)
  • url: Author's website/profile (string)
  • name: Full name (string)
  • slug: URL-friendly name (string)
  • company_id: Reference to company (number)
  • company: Nested company object
Company Fields
  • id: Unique identifier (number)
  • url: Company website (string)
  • name: Company name (string)
  • slug: URL-friendly name (string)
  • created_at: Creation timestamp (ISO 8601)

Rate Limiting

All API endpoints are rate-limited to 100 requests per minute per IP address. Rate limit information is included in the response headers:

  • X-RateLimit-Limit: Requests allowed per window
  • X-RateLimit-Remaining: Requests remaining in window
  • X-RateLimit-Reset: Time when the rate limit resets

Endpoints

GET
/quotes

Get a paginated list of quotes with optional filters.

Query Parameters

  • page: Page number (default: 1)
  • limit: Items per page (default: 10, max: 100)
  • author: Filter by author name
  • company: Filter by company name
  • tags: Filter by tag
// Example: Get quotes from Ratan Tata
const response = await fetch('https://indian-quotes-api.vercel.app/api/quotes?author=Ratan%20Tata');
const data = await response.json();

console.log(data);
/* Output:
{
  "data": [{
  "id": 1,
  "created_at": "2024-11-03T18:17:23.851778+00:00",
  "quote": "If there is doubt, there is no doubt.",
  "tags": [
    "mindset"
  ],
  "author_id": 1,
  "author": {
    "id": 1,
    "img": "https://media.licdn.com/dms/image/v2/C4D03AQGutmmcvCLUvw/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1632475772897?e=1736380800&v=beta&t=fZ1joSw_nh5Q5t80xTWxw8dT8zMTANYSGG4FP1uLOuI",
    "url": "https://www.linkedin.com/in/sachinbansal/",
    "name": "Sachin Bansal",
    "company": {
      "id": 1,
      "url": "https://www.flipkart.com/",
      "name": "Flipkart",
      "created_at": "2024-11-03T18:19:00.732254+00:00"
    },
    "company_id": 1,
    "created_at": "2024-11-03T17:37:46.864463+00:00"
  }
}],
  "pagination": {
    "page": 1,
    "pageSize": 10,
    "totalPages": 5,
    "totalItems": 42
  }
}
*/
GET
/quotes/{id}

Get a specific quote by ID.

// Example: Get quote with ID 1
const response = await fetch('https://indian-quotes-api.vercel.app/api/quotes/1');
const data = await response.json();

console.log(data);
/* Output:
{
  "id": 1,
  "created_at": "2024-11-03T18:17:23.851778+00:00",
  "quote": "If there is doubt, there is no doubt.",
  "tags": [
    "mindset"
  ],
  "author_id": 1,
  "author": {
    "id": 1,
    "img": "https://media.licdn.com/dms/image/v2/C4D03AQGutmmcvCLUvw/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1632475772897?e=1736380800&v=beta&t=fZ1joSw_nh5Q5t80xTWxw8dT8zMTANYSGG4FP1uLOuI",
    "url": "https://www.linkedin.com/in/sachinbansal/",
    "name": "Sachin Bansal",
    "company": {
      "id": 1,
      "url": "https://www.flipkart.com/",
      "name": "Flipkart",
      "created_at": "2024-11-03T18:19:00.732254+00:00"
    },
    "company_id": 1,
    "created_at": "2024-11-03T17:37:46.864463+00:00"
  }
}
*/
GET
/quotes/random

Get a random quote.

// Example: Get a random quote
const response = await fetch('https://indian-quotes-api.vercel.app/api/quotes/random');
const data = await response.json();

console.log(data);
/* Output:
{
  "id": 1,
  "created_at": "2024-11-03T18:17:23.851778+00:00",
  "quote": "If there is doubt, there is no doubt.",
  "tags": [
    "mindset"
  ],
  "author_id": 1,
  "author": {
    "id": 1,
    "img": "https://media.licdn.com/dms/image/v2/C4D03AQGutmmcvCLUvw/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1632475772897?e=1736380800&v=beta&t=fZ1joSw_nh5Q5t80xTWxw8dT8zMTANYSGG4FP1uLOuI",
    "url": "https://www.linkedin.com/in/sachinbansal/",
    "name": "Sachin Bansal",
    "company": {
      "id": 1,
      "url": "https://www.flipkart.com/",
      "name": "Flipkart",
      "created_at": "2024-11-03T18:19:00.732254+00:00"
    },
    "company_id": 1,
    "created_at": "2024-11-03T17:37:46.864463+00:00"
  }
}
*/

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of requests:

  • 200: Success
  • 400: Bad Request - Invalid parameters
  • 404: Not Found - Resource doesn't exist
  • 429: Too Many Requests - Rate limit exceeded
  • 500: Internal Server Error