API Reference
The Typeweave API provides developers with access to font CSS and metadata about the fonts supported by the Typeweave platform.
Usage
The Typeweave API is a read-only API that can be accessed by any HTTP client. All endpoints return standard HTTP responses.
Endpoints
Get Font CSS
GET
https://typeweave.com/api/fonts/[font-id]/cssReturns the CSS for a specific font, including @font-face declarations.
Parameters
font-id(required) - The font identifier (e.g., "inter", "roboto", "opensans")
Example Request
GET https://typeweave.com/api/fonts/inter/css
Example Response
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url('https://typeweave.com/api/fonts/inter/Inter-Variable.woff2')
format('woff2-variations');
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url('https://typeweave.com/api/fonts/inter/Inter-Italic-Variable.woff2')
format('woff2-variations');
}Get Font File
GET
https://typeweave.com/api/fonts/[font-id]/[filename]Returns the actual font file (WOFF2 format).
Parameters
font-id(required) - The font identifierfilename(required) - The font file name (e.g., "Inter-Variable.woff2")
Example Request
GET https://typeweave.com/api/fonts/inter/Inter-Variable.woff2
Error Codes
| Code | Description |
|---|---|
| 200 | The request was successful |
| 400 | The request was malformed |
| 404 | The requested font or file was not found |
| 422 | The request was unprocessable |
| 429 | The request was rate limited |
| 500 | An internal server error occurred |
Rate Limits
Typeweave API uses fair use rate limiting to ensure service availability for all users.
- Current rate limit: 100 requests per minute per IP address
- Uses sliding window algorithm for accurate rate limiting
- Font files are cached with long-lived cache headers for optimal performance
- Rate limit headers included in all responses (
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset)
Best Practice: For production applications, we recommend self-hosting fonts via NPM packages to avoid rate limits and improve performance. With proper cache headers, browsers will cache fonts for up to 1 year, eliminating the need for repeated API requests.
Response Headers
Typeweave API responses include the following headers:
Content-Type
CSS endpoints return text/css
Font file endpoints return font/woff2
Cache-Control
Font files are cached with public, max-age=31536000, immutable for optimal performance
Access-Control-Allow-Origin
Set to * to allow cross-origin requests