Skip to main content

SVG

GET /v1/svg/{slug}​

Returns raw SVG bytes for a catalog slug. The response body comes from stored SVG markup in service_svg_variants.svg_content (or the startup mono cache), not from a request-time CDN or filesystem lookup.

AspectDetail
HeaderX-API-Key
Pathslug
Queryvariant - see table below (optional: with none, the best file, below)
Querytheme - light (default) or dark: the page the best file is for (optional; not with variant)

Response: Content-Type: image/svg+xml

Header: X-Svg-Variant - the variant actually served (for a request with no variant, mono, color, icon, wordmark or light on a light page, dark, mono, color, icon or wordmark on a dark page), or placeholder when a placeholder is returned.

With no variant: the best file​

A request with no variant gets the brand's best file for the page in theme. This works on every plan, free included.

themeFiles tried, in orderPassed overWith none left
light (default)mono, color, icon, wordmark, lighta file that cannot be seen on whitea branded placeholder SVG
darkdark, mono, color, icon, wordmarkany file not proven visible on #121212 (a currentColor file included: it draws black in an <img>)a branded placeholder SVG that can be seen on dark

Name a variant (for example ?variant=mono) to get exactly that variant instead. theme and variant together are refused with 422 (validation_error).

Light and dark pages​

For a site with both themes, ask for each page's file and let the browser choose:

<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="https://api.scrift.app/v1/svg/stripe?theme=dark"
/>
<img src="https://api.scrift.app/v1/svg/stripe?theme=light" alt="Stripe" width="48" height="48" />
</picture>

prefers-color-scheme follows the visitor's system setting. A site with its own light and dark toggle should request theme=light or theme=dark from that toggle instead. /v1/png and /v1/webp take the same theme.

Placeholder behavior​

If the slug does not exist → 404 (service_not_found). If the slug exists but the requested variant is missing, Scrift first falls back to the stored mono variant. If no stored SVG is available for a known slug, it returns 200 with a branded placeholder SVG (not a 404).

Caching​

CaseCache-Control
Real SVG assetpublic, max-age=86400
Placeholder SVGpublic, max-age=3600
Recoloured SVG (?color=)private, max-age=3600
curl "https://api.scrift.app/v1/svg/stripe?variant=mono" \
-H "X-API-Key: YOUR_API_KEY"

Use in HTML:

<img
src="https://api.scrift.app/v1/svg/stripe?variant=mono"
alt="Stripe"
width="48"
height="48"
/>
note

Embedding in img still triggers a normal HTTP GET; you must pass X-API-Key only where your client supports custom headers (or use a server-side proxy). Many browsers omit custom headers on <img> - prefer server-side fetch or your backend as a cache when keys must stay private.

Variants​

VariantDescription
monoSingle-color mark; works on most backgrounds (first in the best-file order)
colorFull-color brand artwork
darkTuned for dark backgrounds
lightTuned for light backgrounds
wordmarkLogo including wordmark
iconIcon-only mark

Variant availability is per brand. For example, an enriched catalog row may have color, icon, mono, and wordmark, while another row may only have mono. Use the catalog/brand metadata or test the endpoint to discover what is actually available for a slug.

Interactive details: API reference.