API guides
Logo API
The Logo API returns a company's logo image for a domain. It needs no API key and uses no credits (Credits and usage), so you can put its URL straight into an <img> tag.
Request
Code
| Parameter | In | Description |
|---|---|---|
domain | Path | The company's domain, such as stripe.com. A subdomain returns the logo of its registrable domain, so www.stripe.com returns the logo for stripe.com. A trailing image extension, as in stripe.com.png, is ignored. |
s or size | Query | Width and height in pixels, from 1 to 512. The logo is scaled to a square PNG of that size; a logo that isn't square is stretched to fit. Without s, or with s=80, the logo is returned as stored, in its original format and dimensions. |
greyscale | Query | true returns the logo as a greyscale PNG. |
d or default | Query | URL-encoded http or https URL of an image to return when Tomba has no logo for the domain. It must point to a public host. |
Response
A successful request returns status 200 with the image in the body:
Content-Typeisimage/pngwhen you setsorgreyscale. Otherwise, it's the format the logo is stored in:image/png,image/jpeg,image/webp,image/avif, orimage/svg+xml.Content-Dispositionisattachment; filename="<domain>.<extension>". Opening the URL in a browser tab therefore downloads the image; an<img>tag displays it.
When Tomba has no logo for the domain, the API still returns status 200:
- Without
d, it returns a placeholder PNG ofs×spixels, 80 × 80 by default, withContent-Disposition: attachment; filename=default.png. Check that header to tell a placeholder from a logo. - With
d, it fetches your image and returns it unchanged, withContent-Disposition: attachment; filename="default".
Errors
Errors return a JSON body with an error message, such as {"error": "size must be between 1 and 512"}.
| Status | Cause |
|---|---|
400 | The domain isn't a valid domain name, s isn't a number from 1 to 512, or d isn't an http or https URL on a public host. |
502 | Tomba couldn't fetch the image at d, or that URL didn't return status 200. |
Examples
Code
Code
Last modified on