katsau Docs
GET/v1/favicon

Get all available favicons for a URL with size information.

Query Parameters

NameTypeRequiredDefaultDescription
urlstring-The URL to get favicons from
sizestring32Preferred icon size (16, 32, 64, 128, 256)
Try it out
GET /v1/favicon

Get favicon for any URL

curl "https://api.katsau.com/v1/favicon?url=https%3A%2F%2Fgithub.com&size=32" \
  -H "Authorization: Bearer YOUR_API_KEY"

Request Example

curl "https://api.katsau.com/v1/favicon?url=https://github.com" \
  -H "Authorization: Bearer ks_live_your_api_key"

Response

{
  "success": true,
  "data": {
    "url": "https://github.com",
    "icons": [
      {
        "url": "https://github.githubassets.com/favicons/favicon.svg",
        "type": "image/svg+xml",
        "sizes": "any",
        "source": "link[rel=icon]"
      },
      {
        "url": "https://github.githubassets.com/favicons/favicon.png",
        "type": "image/png",
        "sizes": "32x32",
        "source": "link[rel=icon]"
      },
      {
        "url": "https://github.githubassets.com/apple-touch-icon.png",
        "type": "image/png",
        "sizes": "180x180",
        "source": "link[rel=apple-touch-icon]"
      }
    ],
    "best_match": {
      "url": "https://github.githubassets.com/favicons/favicon.png",
      "size": "32x32"
    }
  },
  "meta": {
    "request_id": "req_abc123xyz",
    "response_time_ms": 123
  }
}

Direct Image Redirect

Use /v1/favicon/image to get a redirect directly to the favicon image. This is useful for embedding in <img> tags.

GET /v1/favicon/image?url=https://github.com&api_key=ks_live_xxx HTTP/1.1
Host: api.katsau.com

→ 302 Redirect to: https://github.githubassets.com/favicons/favicon.png

Usage in HTML

<!-- Directly embed favicon -->
<img 
  src="https://api.katsau.com/v1/favicon/image?url=github.com&api_key=ks_live_xxx" 
  alt="GitHub favicon"
  width="32"
  height="32"
/>

Best Match Algorithm

When you specify a size parameter, the API returns the icon closest to your requested size. The algorithm:

  1. Parses all available icon sizes from the page
  2. SVG icons are preferred for large sizes (they scale perfectly)
  3. For bitmap icons, the closest size to your request is returned
  4. If no sized icons are found, falls back to /favicon.ico

Icon Sources

The API looks for icons in the following locations:

SourceSelector
Standard faviconlink[rel="icon"]
Shortcut iconlink[rel="shortcut icon"]
Apple touch iconlink[rel="apple-touch-icon"]
Default fallback/favicon.ico