API Endpoint Access URL
https://api.pixlab.io/favicon
Get Your API Key & Try FAVICON Now ↗Description
The Favicon API endpoint programmatically parses website metadata to identify, extract, and return the canonical favicon icon image of any target website URL. This is ideal for enriching bookmark lists, link directories, and website previews.
HTTP Methods
GET, POST
HTTP Parameters
Required
| Fields | Type | Description |
|---|---|---|
img |
URL | Input media URL. If uploading directly from your app, submit a multipart/form-data POST request. |
key |
String | Your PixLab API Key ↗. Alternatively, embed your key in the WWW-Authenticate: HTTP header to omit this parameter. |
Optional
| Fields | Type | Description |
|---|---|---|
blob |
Boolean | Returns JSON with output image link by default. Set to true to receive raw image binary instead. |
POST Request Body
This section details the requirements for using a POST request instead of a simple GET request.
Allowed Content-Types:
multipart/form-dataapplication/json
Use multipart/form-data for direct file uploads (see examples). For JSON, media must be pre-uploaded - call store first if needed.
HTTP Response
| Fields | Type | Description |
|---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
link |
URL | Link to the media output stored on pixlab.xyz storage server unless custom S3 keys are configured (see console for setup). |
id |
String | Unique media identifier. |
error |
String |
Error message when status != 200.
|
The API returns application/json when the optional blob parameter is omitted. When blob is enabled, the response contains raw binary data instead of JSON. The JSON response structure contains these fields:
Required
All requests must include the mandatory API key and target URL parameters.
Optional
The blob parameter switches response format between JSON and binary output.
Code Samples
import requests
API_URL = 'https://api.pixlab.io/favicon'
API_KEY = 'My_Key'
def get_favicon(image_url: str) -> str:
params = {
'img': image_url,
'key': API_KEY
}
try:
response = requests.get(API_URL, params=params, timeout=10)
response.raise_for_status()
data = response.json()
if data.get('status') == 200:
return data.get('link', '')
else:
raise ValueError(data.get('error', 'Unknown error occurred'))
except requests.exceptions.RequestException as e:
raise Exception(f"Request failed: {str(e)}")
if __name__ == '__main__':
try:
favicon_url = get_favicon('http://www.drodd.com/images15/nature31.jpg')
print(f"Link to the favicon: {favicon_url}")
except Exception as e:
print(f"Error: {str(e)}")
fetch('https://api.pixlab.io/favicon?img=http://www.drodd.com/images15/nature31.jpg&key=My_Key')
.then(response => response.json())
.then(reply => {
if (reply.status !== 200) {
console.log(reply.error);
} else {
console.log("Link to the favicon: " + reply.link);
}
})
.catch(error => console.error('Error:', error));
<?php
$params = [
'img' => 'http://www.drodd.com/images15/nature31.jpg',
'key' => 'My_Key'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixlab.io/favicon?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
throw new RuntimeException('Curl error: ' . curl_error($ch));
}
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
echo $reply['error'];
} else {
echo "Link to the favicon: " . $reply['link'];
}
require 'net/http'
require 'json'
uri = URI('https://api.pixlab.io/favicon')
params = { img: 'http://www.drodd.com/images15/nature31.jpg', key: 'My_Key' }
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
else
puts "Link to the favicon: #{reply['link']}"
end
Similar API Endpoints
polaroid, posterize, roundcorners, reflect, randomthreshold, grayscale, raise, quantize, roll, shadow, sepia, transverse, transpose, reverse