A kit is a combination of fonts configured for use on a particular site - you'll need to create a new kit for each site you want to use Typekit on.
The API allows you to create and update kits, add fonts to a kit, then when you're happy, publish the kits to our CDN. Then you can include it in a webpage using CSS or JavaScript. Learn more about adding kits to webpages.
Creating and editing kits
You can create a new kit by making an authenticated POST
to kits
. This will return information on the newly created kit, including the ID. For example, to create a new kit called "Example" for example.com:
$ curl -s -H $tk_auth -F name=Example -F domains[]=example.com https://typekit.com/api/v1/json/kits | jsonpretty
{
"kit": {
"name": "Example",
"id": "nfx3ygt",
"analytics": false,
"domains": [
"example.com"
],
"families": [
]
}
}
You can edit attributes of an existing kit by making an authenticated POST
to kits/:kit
.
You can add a font family to a kit by making an authenticated POST
to kits/:kit/families/:family
. You'll also need to decide which subset and which font variations you want to include (more information is available on the terminology we use for fonts).
Once a font family is added to a kit you can edit it the same way you created it, by making an authenticated POST
to kits/:kit/families/:family
.
You can also add multiple font families at a time and/or replace all existing font families in a kit by making an authenticated POST
to kits/:kit
and including the families
parameter.
Fetching kit information
You can get a list of all your kits by making an authenticated GET
to kits
.
You can get information about an individual kit by making an authenticated GET
to kits/:kit
. For example:
$ curl -s -H $tk_auth https://typekit.com/api/v1/json/kits/ord8twk | jsonpretty
{
"kit": {
"name": "Example kit",
"id": "ord8twk",
…
}
}
It's important to understand that when you edit a kit, your changes are not immediately published to our CDN. Behind the scenes, Typekit keeps track of both the published version of the kit, and the current draft version of the kit. Sending a GET
to kits/:kit
will give you information about the current draft version.
There are some situations where you'd like to know what is currently published on a website. To do this, you can make a GET
to kits/:kit/published
.
Publishing a kit
Once you're happy with a kit, you can publish it to our CDN by making an authenticated POST
to kits/:kit/publish
. It can take some time for the kit to be available from our CDN, for more details see the kit publishing reference documentation