The Typekit API consists of a number of endpoints. Each endpoint represents a resource (a kit, a font family etc) that can be manipulated. You access the Typekit API by making HTTP requests to these endpoints.
For example, to get information about one of the kits hosted by Typekit in JSON format, you can make a GET request to https://typekit.com/api/v1/json/kits/qba6sms/published like so:
$ curl -s https://typekit.com/api/v1/json/kits/qba6sms/published | jsonpretty
{
"kit": {
"id": "qba6sms",
"families": [
{
"id": 'ykqk',
"name": "Bello Pro",
"css_names": [
"bello-pro-1",
"bello-pro-2"
],
"css_stack": "\"bello-pro-1\",\"bello-pro-2\",sans-serif",
"variations": [
"n4"
]
}
]
}
}
URLs
Throughout the API documentation we use rails-style URL descriptions. For example, the URL https://typekit.com/api/v1/json/kits/qba6sms/published contains several components:
https://typekit.com/api/v1/is the root URL of this version of the Typekit API. Future releases of the API may be hosted at a different URL.jsonis the requested format for responses.kits/qba6sms/publishedis the specific endpoint requested, in this case the published version of kit "qba6sms".
This could be rewritten as https://typekit.com/api/v1/:format/kits/:kit/published, where :format and :kit are parameters we want to pass to the API.
In most cases we'll also ignore the API root and format, giving us kits/:kit/published.
HTTP Methods
The HTTP method used is significant:
GETrequests are used to read information from the APIPOSTrequests are used to manipulate objectsDELETErequests are used to remove objects
In some cases you may not be able to issue a DELETE request. In this scenario you can send a POST request with a _method=DELETE parameter and the API will treat it as a DELETE request.
Parameters
Many API endpoints allow you to pass extra information about your request. The parameters page explains how to format these parameters.