searchFonts
This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.
Returns a list of fonts that match the given search query.
This returns fonts from the Canva library that matches the search query. It does not return custom or brand fonts.
Usage: Performing a font search for "serif"
import { searchFonts } from "@canva/asset";const results = await searchFonts({query: "serif"});const foundFonts = [];for await (const fonts of results.pages) {foundFonts.push(...fonts);}
Parameters
requestSearchFontsRequestOptions for searching for fonts.
querystringThe query provided for a font search request.
Returns
The result of searching for fonts. This is a Promise that resolves with the following object:
pagesAsyncIterable<Font[]>Each page is an array of Font matching the search query.
Iterate over pages with for await to retrieve fonts from the search request, one page at a time.
refFontRefA unique identifier that points to a font asset in Canva's backend.
namestringThe name of the font.
weightsFontWeight[]The available font weights for the font.
weightFontWeightNameThe name of the font weight.
Available values:
"normal""thin""extralight""light""medium""semibold""bold""ultrabold""heavy"
stylesFontStyle[]The font styles available for this specific font weight.
Available values:
"normal""italic"
previewUrlstringThe URL of an image that renders a preview of the font.