Font recognition
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({image_url: 'https://images.example.com/wordmark.png', top_k: 3})
};
fetch('https://api.mixfont.com/v1/lens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mixfont.com/v1/lens"
payload = {
"image_url": "https://images.example.com/wordmark.png",
"top_k": 3
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.mixfont.com/v1/lens \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"image_url": "https://images.example.com/wordmark.png",
"top_k": 3
}
'{
"word": "Mixfont",
"word_box": {
"left": 140,
"top": 96,
"width": 412,
"height": 104
},
"input_image": {
"width": 1600,
"height": 900,
"image_url": "https://images.example.com/wordmark.png"
},
"font_matches": [
{
"name": "Inter",
"score": 0.83,
"fonts": [
{
"full_name": "Inter Regular",
"style": "normal",
"weight": 400,
"url": "https://static.mixfont.com/fonts/inter/Inter-Regular.ttf"
},
{
"full_name": "Inter Italic",
"style": "italic",
"weight": 400,
"url": "https://static.mixfont.com/fonts/inter/Inter-Italic.ttf"
}
]
},
{
"name": "Public Sans",
"score": 0.11,
"fonts": [
{
"full_name": "Public Sans Regular",
"style": "normal",
"weight": 400,
"url": "https://static.mixfont.com/fonts/public-sans/PublicSans-Regular.ttf"
}
]
}
],
"requestId": "7d58a66d-f129-4f9a-bf9a-4f2c6d0c3e4d"
}{
"error": "image_url must be a string and top_k must be an integer between 1 and 10."
}{
"error": "Unauthorized."
}{
"error": "Current team does not have enough API credits remaining."
}{
"error": "Team associated with this API key could not be resolved."
}{
"error": "The font recognition service failed to process the request."
}{
"error": "Inference request timed out after 90 seconds."
}API reference
Font recognition
Identify the closest matching open-source font from an image
POST
/
v1
/
lens
Font recognition
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({image_url: 'https://images.example.com/wordmark.png', top_k: 3})
};
fetch('https://api.mixfont.com/v1/lens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mixfont.com/v1/lens"
payload = {
"image_url": "https://images.example.com/wordmark.png",
"top_k": 3
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.mixfont.com/v1/lens \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"image_url": "https://images.example.com/wordmark.png",
"top_k": 3
}
'{
"word": "Mixfont",
"word_box": {
"left": 140,
"top": 96,
"width": 412,
"height": 104
},
"input_image": {
"width": 1600,
"height": 900,
"image_url": "https://images.example.com/wordmark.png"
},
"font_matches": [
{
"name": "Inter",
"score": 0.83,
"fonts": [
{
"full_name": "Inter Regular",
"style": "normal",
"weight": 400,
"url": "https://static.mixfont.com/fonts/inter/Inter-Regular.ttf"
},
{
"full_name": "Inter Italic",
"style": "italic",
"weight": 400,
"url": "https://static.mixfont.com/fonts/inter/Inter-Italic.ttf"
}
]
},
{
"name": "Public Sans",
"score": 0.11,
"fonts": [
{
"full_name": "Public Sans Regular",
"style": "normal",
"weight": 400,
"url": "https://static.mixfont.com/fonts/public-sans/PublicSans-Regular.ttf"
}
]
}
],
"requestId": "7d58a66d-f129-4f9a-bf9a-4f2c6d0c3e4d"
}{
"error": "image_url must be a string and top_k must be an integer between 1 and 10."
}{
"error": "Unauthorized."
}{
"error": "Current team does not have enough API credits remaining."
}{
"error": "Team associated with this API key could not be resolved."
}{
"error": "The font recognition service failed to process the request."
}{
"error": "Inference request timed out after 90 seconds."
}Analyze a public image URL and return ranked open-source font matches for the largest readable word in the image.
Font recognition guide
Learn when to use font recognition and see a complete example response.
Authorizations
Body
application/json
Response
Successful response
Largest detected word in the image. This can be null if no confident word is found.
Location of the detected word in the original image. This can be null if detection falls back to the full image.
Hide child attributes
Hide child attributes
Ranked font matches, sorted best first.
Hide child attributes
Hide child attributes
Name of the matched font family.
Similarity score for the match.
Downloadable font files for that family when available.
Hide child attributes
Hide child attributes
Full font file name.
Font style such as normal or italic.
Numeric font weight.
Download URL for the font file, or an empty string when metadata is unavailable.
Request identifier to share with support.

