Typekit API example conventions

This is documentation for Typekit’s original API. This API is still supported, but we encourage you to try the newer Typekit Platform API. If you have any questions, email us.

Most examples in this documentation use curl — a command line HTTP client — to demonstrate API usage. Curl is already installed by default on Mac OS X and most Linux distributions, and is available for download on Windows. Curl has many many options, to read this document you only need to know about a handful of them:

Most API methods need authentication which makes the examples verbose and hard to copy. To help with this we use the convention of putting the auth header in a tk_auth shell variable. If you're using Bash, you can run the following (substituting your token) to set up your shell to run the examples:

$ export tk_auth=X-Typekit-Token:4d6141e7c82cb30affebcc392abc2ce3ab0ea4c1

Then you can make authenticated requests:

$ curl -s -H $tk_auth http://typekit.com/api/v1/json/kits/

We also use jsonpretty to make the JSON output easier to read.