Quotes API Documentation

Introduction

Welcome to the FindIpInfo Quotes API! This free API lets you add inspirational and motivational quotes to your applications. Whether you're building a website, mobile app, or tool, you can fetch quotes by category (e.g., Love, Motivation), get a random quote, or explore available categories. This guide provides clear PHP and Java examples, perfect for beginners and experienced developers alike.

Step 1: Get Your API Key

To use the Quotes API, you need a unique API key for authentication. Follow these steps:

Step 2: Explore API Endpoints

The Quotes API offers three endpoints to fetch quotes, random quotes, or categories. Replace API_KEY with your key and CATEGORY with a category like Love or Motivation. All responses include status, message, and findipinfo fields.

2.1 Fetch Quotes (Paginated)

Retrieve a list of quotes, optionally filtered by category, with pagination for easy navigation.

Endpoint: https://findipinfo.net/api/quotes/{API_KEY}/{CATEGORY}?page={PAGE}&per_page={PER_PAGE}

Parameters:

  • API_KEY (required): Your API key.
  • CATEGORY (optional): Filter by category (e.g., Love, Motivation).
  • page (optional): Page number (default: 1).
  • per_page (optional): Quotes per page (default: 20, max: 100).
<?php
$apiKey = 'your-api-key-here';
$category = 'Love';
$page = 1;
$perPage = 20;
$url = "https://findipinfo.net/api/quotes/$apiKey/$category?page=$page&per_page=$perPage";

try {
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['status'] === 'success') {
        echo "Title: {$data['findipinfo']['title']}\n";
        foreach ($data['findipinfo']['quotes'] as $quote) {
            echo "Quote: {$quote['quote']} - {$quote['author']} ({$quote['category']})\n";
        }
        echo "Next Page: " . ($data['findipinfo']['pagination']['next_page_url'] ?? 'None') . "\n";
    } else {
        echo "Error: {$data['message']}\n";
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

2.2 Fetch a Random Quote

Get a single random quote, optionally filtered by category.

Endpoint: https://findipinfo.net/api/random-quote/{API_KEY}/{CATEGORY}

Parameters:

  • API_KEY (required): Your API key.
  • CATEGORY (optional): Filter by category (e.g., Love, Motivation).
<?php
$apiKey = 'your-api-key-here';
$category = 'Motivation';
$url = "https://findipinfo.net/api/random-quote/$apiKey/$category";

try {
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['status'] === 'success') {
        echo "Title: {$data['findipinfo']['title']}\n";
        echo "Quote: {$data['findipinfo']['quote']['quote']} - {$data['findipinfo']['quote']['author']} ({$data['findipinfo']['quote']['category']})\n";
    } else {
        echo "Error: {$data['message']}\n";
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

2.3 Fetch Quote Categories

Retrieve a list of available quote categories with metadata like name, colors, and images.

Endpoint: https://findipinfo.net/api/quote-categories/{API_KEY}

Parameters:

  • API_KEY (required): Your API key.
<?php
$apiKey = 'your-api-key-here';
$url = "https://findipinfo.net/api/quote-categories/$apiKey";

try {
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['status'] === 'success') {
        echo "Title: {$data['findipinfo']['title']}\n";
        foreach ($data['findipinfo']['categories'] as $category) {
            echo "Category: {$category['name']} (Image: {$category['image']})\n";
        }
    } else {
        echo "Error: {$data['message']}\n";
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

Step 3: Handle API Errors

The API returns a status field to indicate the request outcome. Check this field to manage errors effectively.

Possible Status Values:

  • success: Request successful, data in findipinfo.
  • api_error: Invalid or missing API key.
  • pagination_error: Invalid page or per_page parameters.
  • data_error: No quotes found for the category.
  • server_error: Internal server issue.
<?php
$apiKey = 'your-api-key-here';
$category = 'Love';
$url = "https://findipinfo.net/api/quotes/$apiKey/$category";

try {
    $response = file_get_contents($url);
    if ($response === false) {
        echo "Connection error. Please try again.\n";
    } else {
        $data = json_decode($response, true);
        switch ($data['status']) {
            case 'success':
                echo "Title: {$data['findipinfo']['title']}\n";
                foreach ($data['findipinfo']['quotes'] as $quote) {
                    echo "Quote: {$quote['quote']} - {$quote['author']}\n";
                }
                break;
            case 'api_error':
                echo "API error: {$data['message']}\n";
                break;
            case 'pagination_error':
                echo "Pagination error: {$data['message']}\n";
                break;
            case 'data_error':
                echo "Data error: {$data['message']}\n";
                break;
            case 'server_error':
                echo "Server error: {$data['message']}\n";
                break;
        }
    }
} catch (Exception $e) {
    echo "Request failed: {$e->getMessage()}\n";
}
?>

Step 4: API Response Examples

Success: Fetch Quotes

{
    "status": "success",
    "message": "Quotes retrieved successfully",
    "findipinfo": {
        "title": "Quotes From Love",
        "quotes": [
            {
                "quote": "Love is all you need.",
                "author": "The Beatles",
                "category": "Love"
            },
            {
                "quote": "The best thing to hold onto in life is each other.",
                "author": "Audrey Hepburn",
                "category": "Love"
            }
        ],
        "pagination": {
            "next_page_url": "https://findipinfo.net/api/quotes/{API_KEY}/Love?page=2",
            "prev_page_url": null
        }
    }
}

Success: Random Quote

{
    "status": "success",
    "message": "Random quote retrieved successfully",
    "findipinfo": {
        "title": "Random Motivation Quote",
        "quote": {
            "quote": "The only way to do great work is to love what you do.",
            "author": "Steve Jobs",
            "category": "Motivation"
        }
    }
}

Success: Fetch Categories

{
    "status": "success",
    "message": "Quote categories retrieved successfully",
    "findipinfo": {
        "title": "Quotes Categories",
        "categories": [
            {
                "name": "Love",
                "start_color": "#FF0000",
                "end_color": "#FF9999",
                "image": "https://findipinfo.net/assets/quotes/love.jpg"
            },
            {
                "name": "Motivation",
                "start_color": "#00FF00",
                "end_color": "#99FF99",
                "image": "https://findipinfo.net/assets/quotes/motivation.jpg"
            }
        ]
    }
}

Error: Invalid API Key

{
    "status": "api_error",
    "message": "Invalid API key",
    "code": 401
}

Step 5: Get Support

Need help with the Quotes API? Contact our support team via WhatsApp at  Live Support Chat.