back

API documentation

Calling the API

Calling the API is quite simple: all you need is your public_id and your api token, both of which you can obtain from your account page after you have signed up.

You send your HTML content as a post request. Any external resources must be accessible over the internet.

curl -d @test.html -H "project: {PUBLIC_ID}" -H "token: {TOKEN}" -X POST https://api.typeset.sh/ > test.pdf

What is stored?

We track the number of pages, size, time, and IP of each API call. The content of your HTML and PDF is not stored, but we do store external resources (images, fonts, CSS, etc.) for caching purpose for up to two weeks. This will speed up the PDF generation, saving the trouble of downloading the same content repeatedly.

Please make sure external resources do not contain any personal data.

The URI of the resources are hashed and not saved as plaintext.

What happens if I exceed my API limit?

At first, nothing will happen. The limits are soft-limits, and the API will still continue to work. If we see that you have been exceeding the limit continuously we will get in touch via email.

Don't worry if you do a few calls to the API during development or if you have a good day. The API will not stop working straight away.

We monitor API usage, and if we see a continuous use above the limit, we will get in touch with you.

Having said that, there is also a hard limit, and if you hit that, we will return a 500 error code. Also, if you already know for sure that you will exceed your API limits, please get in touch with us.

Can I control the version that I am using?

Yes, you can choose the version by setting the "version" query parameter.

The current version is: https://api.typeset.sh/?version=0.26.10

We are still developing and things may not work as expected. Therefore, we recommend using a fixed version for any production environment.