Hey folks! We’re excited to introduce searchFonts, a new Preview API that lets you search for fonts in the Canva library.
What it does
The API uses fuzzy search to return pages of fonts that match your search query. Only permitted fonts from the Canva library are included, so results won’t include custom or brand fonts.
How to use it
The API uses an async iterator to handle pagination on the host side, so you don’t need a continuation token to fetch the next page of results.
import { searchFonts } from "@canva/asset";
const results = await searchFonts({
query: "serif"
});
const foundFonts = [];
for await (const fonts of results.pages) {
foundFonts.push(...fonts);
}
For more info, refer to the API reference docs.
Notes
- Not all fonts are available through this API. For the widest font coverage, use it alongside requestFontSelection in your app.
Keep in mind that apps using Preview APIs can’t be published to the Canva Apps Marketplace yet, but you can still use them in private apps.
We’re aiming to make this API generally available in the next couple of weeks, and we’d love to hear your feedback!