Iconify API queries
This tutorial is for developers that want to create their own tools to access Iconify API.
Iconify API supports the following basic queries:
- /{prefix}/{icon}.svg dynamically generates SVG.
- /{prefix}.css?icons={icons} dynamically generates CSS for icons.
- /{prefix}.json?icons={icons} retrieves icon data.
- /last-modified?prefixes={prefixes} returns last modification time of requested icon sets, which can be used to invalidate old icon data cache.
If list of icons is enabled, custom icon pickers can use the following queries to browse icons:
- /collections returns list of available icon sets.
- /collection?prefix={prefix} returns list of icons in an icon set.
If search engine is enabled, icon pickers can implement search functionality using these queries:
- /search?query={keyword} returns list of icons that match keyword.
- /keywords?prefix={keyword} or /keywords?keyword={keyword} returns list of keywords that contain requested keyword, which can be used for autocomplete.
Maintenance queries:
- /version shows API version as plain text, unless disabled. If you are running multiple API servers, like public Iconify API does, this can be used to check which server visitor is connected to.
- /update updates icon sets from its source without restarting API. This can be used to automatically keep API up to date using GitHub hooks or similar methods.
API versions
In code samples some queries above are marked as API v2, some as API v3.
Differences:
- API v2 queries existed since version 2 of Iconify API, but were not documented. They are supported and will continue being supported, but at some point improved v3 versions of same queries can be added.
- API v3 queries are available since version 3 of Iconify API.
You can use both versions at the same time. Improved versions of old queries might be added to solve various issues, but no need to switch to new version right away, old versions will continue to be supported.
API even supports v1 queries that aren't documented and should not be used. They are supported because they can still be found in some legacy applications, such as older versions of Iconify plug-in for Sketch.
Common parameters
All queries that return JSON data have one common parameter:
- pretty is used to format JSON data, making it easy to read. Set to 1 or true to enable.