stylehub.cloud

API documentation

API overview

On this page

Three addresses, read only: the manual and its design tokens as JSON, and the manual as a PDF. A public manual needs no key, so the shortest useful call is one line. Nothing is written through the API.

Shell
curl https://stylehub.cloud/api/v1/manuals/acme.json

The three addresses

GET /api/v1/manuals/{slug}.json
The manual: its sections and blocks, each with the anchor the page gives it. Reading a manual.
GET /api/v1/manuals/{slug}/tokens.json
The design tokens in the W3C format, the same document the export page offers as a file. Reading the design tokens.
GET /api/v1/manuals/{slug}.pdf
The manual drawn as an A4 document. Fetching the PDF.

Every address starts with https://stylehub.cloud/api/v1/manuals/. Any other path under it answers 404 with a note naming the three. On a brand's own host or a custom domain the same three paths answer; there the host names the brand, and the slug is a manual's own path segment or the host's label for the manual at its root.

What a slug is

The API names a manual after its public address, in lowercase, and calls that name the slug. It is one of three things. For the primary manual of a brand, the brand's subdomain: acme for acme.stylehub.cloud. For another manual of the brand, the brand's subdomain and the manual's own path joined with a dot: acme.guidelines for acme.stylehub.cloud/guidelines. For a manual with a subdomain of its own, that subdomain. The dashboard prints the exact address of every published manual on its API page, in the account menu, so nothing has to be worked out.

A first call

GET acme.json
curl -sS https://stylehub.cloud/api/v1/manuals/acme.json \
  -H "Accept: application/json" | jq '.title, .sections[].title'

When you need a token

  • A public or unlisted manual answers anyone. No token.
  • A private or password protected manual needs an API token of its brand, sent as a bearer. See Tokens and authentication.
  • An unpublished manual answers 404, token or not; an expired one answers 410. Every refusal is described under Errors.

Where things are in the dashboard

Under API in the dashboard of a brand: its tokens, the requests a minute its owner's plan allows, the ready made address of each published manual, and how often the API was called in the last thirty days. Tokens are made and revoked there by the owner, an admin, or a custom role holding the settings permission. Open it (opens in a new tab).

The manual as the page shows it

The API serves what the published page serves. Sections kept off the page, blocks marked internal and empty blocks are not in the answer, and a manual that reviews changes before publishing is served as its approved version.

Reading order

Something the API does that this page does not say? Write to hello@stylehub.cloud with the request and the answer you got.

API documentation - Stylehub