Docs

API

Send numbers over HTTP, get a font back. The API runs the same code as the SDK, on our servers.

Authentication

Make a key in your account and send it as a bearer token. A key is shown once, when you make it, and we only keep its hash. Keep it on your server: anyone who has it can spend your plan.

Header
Authorization: Bearer tm_live_...

POST /api/v1/fonts

Compiles a font and returns the file. Each call counts as one font against your plan.

Request
curl https://engine.typomat.app/api/v1/fonts \
  -H "Authorization: Bearer $TYPOMAT_KEY" \
  -H "Content-Type: application/json" \
  -o acme.ttf \
  -d '{
    "name": "Acme Display",
    "parameters": { "weight": 118, "contrast": 0.92 },
    "characters": "Acme"
  }'
FieldMeaning
nameOptional. The family name written into the font, up to 64 characters.
parametersOptional. Any of the parameters, by name. The rest stay at their defaults, and values are clamped to their ranges.
charactersOptional. Compile only these, for a smaller file. Leave it out for all 80.

The response is font/ttf. Its X-Typomat-Compile-Ms header says how long the compile took. Nothing is stored: the same numbers make the same letters, so you can keep the numbers and ask again.

POST /api/v1/glyphs

Outlines for a line of text, as JSON. Each call counts as one font against your plan.

Request
curl https://engine.typomat.app/api/v1/glyphs \
  -H "Authorization: Bearer $TYPOMAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Acme", "parameters": { "weight": 170 } }'
Response
{
  "metrics": { "lineTop": 880, "lineBottom": -310 },
  "glyphs": [
    { "c": "A", "advance": 742.1, "kern": 0, "d": "M 170.41 -700.2 ..." },
    ...
  ]
}

Paths are SVG path data in font units (1000 to the em), with y down. Text can be up to 1,000 characters. A character this build doesn't have comes back as { "c": "é", "missing": true }.

GET /api/v1/parameters

Every parameter with its range and default, the groups and the characters. It's public, so it needs no key.

Request
curl https://engine.typomat.app/api/v1/parameters

Errors

Errors come back as JSON, with a code to check and a message to read:

Response
{ "error": { "code": "over_limit", "message": "This plan's 1,000 fonts for the month are used up. It resets on the 1st." } }
StatusCodeMeaning
400invalid_requestThe body isn't JSON, a parameter's name is unknown, or a value isn't a number.
401missing_key / invalid_keyNo key was sent, or it isn't valid or has been revoked.
403inactive_license / no_apiThe licence has ended, or doesn't include the API.
429over_limitThis plan's fonts for the month are used up. It resets on the 1st.
503unavailableA hiccup on our side. Safe to retry.

Limits

Your plan sets how many fonts you can make a month: see pricing. Your account shows how far along you are. Nothing is ever charged automatically for going over: the API answers 429 until the next month.