Skip to content

Favicon API

The Favicon API returns the current favicon URL for a site and updates automatically when the website favicon changes. It is useful when you want to track the latest favicon rather than fetching a static file.

Response Format

All successful responses are returned in JSON format.

{
    "credit": "API Data from <a href='https://dev.tylermwise.uk/v2/favicon'>tylermwise.com</a>",
    "url": "https://example.com/favicon.ico",
    "extension": "ico"
}

Response Fields:

  • credit (string) - Attribution text for the API source, returned as HTML.
  • url (string) - The current favicon URL.
  • extension (string) - The detected file extension for the favicon.

Authentication Methods

This endpoint is publicly accessible and does not require authentication.

Characteristics:

  • No authentication required
  • JSON response format
  • Tracks the current favicon URL
  • Automatically updates when the source favicon changes

Usage:

curl "https://api.tylermwise.uk/v2/favicon?url=tylermwise.uk"

You can fetch and decode the API response in PHP using file_get_contents() and json_decode().

Example:

<?php
    $contents = file_get_contents("https://api.tylermwise.uk/v2/favicon?url=tylermwise.uk");
    $data = json_decode($contents);
?>

Endpoint

GET /v2/favicon

Example Request

curl "https://api.tylermwise.uk/v2/favicon?url=example.com"

Example Response

{
    "credit": "API Data from <a href='https://dev.tylermwise.uk/v2/favicon'>tylermwise.com</a>",
    "url": "https://example.com/favicon.ico",
    "extension": "ico"
}

PHP Usage

Fetch API Data

<?php
    $contents = file_get_contents("https://api.tylermwise.uk/v2/favicon?url=tylermwise.uk");
    $data = json_decode($contents);
?>

Output Common Values

<?php
    echo $data->credit;
    echo $data->url;
    echo $data->type;
?>

Output Favicon URL

<?php echo $data->url; ?>

Output File Extension

<?php echo $data->extension; ?>

Output API Credit

<?php echo $data->credit; ?>

Response Fields

Field Type Description
credit string Attribution text for the API source.
url string Current favicon URL.
extension string Detected favicon file extension.

Notes

  • The endpoint updates automatically when the target site favicon changes.
  • The response currently includes url and extension.
  • The source example mentions type, but the example JSON uses extension, so extension is the field documented here.
  • You can embed the returned favicon URL directly in an <img> tag if needed.

HTTP Status Codes

Standard responses may include:

  • 200 - Success.
  • 400 - Bad Request.
  • 429 - Too Many Requests.
  • 500 - Internal Server Error.

Versioning

This page documents version 2 of the Favicon API, available under the /v2/ path.