In this post I would like to show you getting any company logo with the use of Clearbit’s logo API and you can use those logos in your projects.
The Clearbit Logo REST API allows developers to access and integrate the functionality of Clearbit with other applications and it’s free.
In order to get company logo, all you have to do is just replace the value of {domain_name} with the domain used by the company that you want to get logo.
GET https://logo.clearbit.com/:domain_name
Incredibly simple isn’t it.
Example
For example let’s get Alexa’s logo. Simply create a new image tag and link to logo.clearbit.com followed by the domain name.
How to pass Parameters?
You can also pass in the following optional parameters.
size – the size in pixels of the logo. The highest value I found to be valid is 800px. And the lowest is 5px.
format – you can pass either png or jpg.
greyscale – pass in a value of true if you want the logo to be in greyscale.
For example, you want the image to be in 100px and the format is png.
How to Download logos
You can also save it on your own server so you don’t use Clearbit’s resources every time the company logos are requested.
The PHP code Below gets the contents returned from the clearbit logo URL and then saves it to the images/logos directory in the server.