> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/kapishdima/fonttrio/llms.txt
> Use this file to discover all available pages before exploring further.

# API Overview

> Access Fonttrio font pairings and fonts through a simple REST API

## Introduction

The Fonttrio Registry API provides programmatic access to curated font pairings and individual font configurations. The API serves JSON files from the registry that can be directly integrated into your projects.

## Base URL

```
https://www.fonttrio.xyz/api/r/
```

All API endpoints are relative to this base URL.

## Authentication

No authentication is required. The API is publicly accessible and free to use.

## Rate Limiting

There are no explicit rate limits, but please be respectful of the service. The API is designed for:

* Build-time fetching of font configurations
* Client-side dynamic loading of font pairings
* CLI tools and automation scripts

## Caching

The API implements intelligent caching behavior:

### Static Requests (No Query Parameters)

* **Cache-Control**: `public, max-age=86400, s-maxage=86400`
* Cached for 24 hours by browsers and CDNs
* Ideal for production deployments

### Dynamic Requests (With Query Parameters)

* **Cache-Control**: `no-cache`
* Not cached to ensure parameter overrides are always applied
* Used for customizing font styles on-the-fly

## Common Use Cases

### 1. Fetch a Font Pairing

Retrieve a complete font pairing configuration with heading, body, and mono fonts:

```javascript theme={null}
const response = await fetch('https://www.fonttrio.xyz/api/r/minimal');
const pairing = await response.json();
```

### 2. Fetch an Individual Font

Get configuration for a single font:

```javascript theme={null}
const response = await fetch('https://www.fonttrio.xyz/api/r/inter');
const font = await response.json();
```

### 3. Customize Typography On-The-Fly

Override specific CSS properties using query parameters:

```javascript theme={null}
const response = await fetch(
  'https://www.fonttrio.xyz/api/r/minimal?h1-size=3rem&body-lh=1.8'
);
const customPairing = await response.json();
```

### 4. Build-Time Integration

Use in Next.js or other frameworks during build:

```typescript theme={null}
import { NextResponse } from 'next/server';

export async function GET() {
  const pairing = await fetch('https://www.fonttrio.xyz/api/r/brutalist')
    .then(res => res.json());
  
  return NextResponse.json(pairing);
}
```

## Response Format

All API responses return JSON with either:

* A [pairing schema](/api/pairing-schema) for font combination configurations
* A [font schema](/api/font-schema) for individual font definitions

## Error Handling

The API returns standard HTTP status codes:

| Status Code | Description             |
| ----------- | ----------------------- |
| `200`       | Successful request      |
| `404`       | Registry item not found |
| `500`       | Server error            |

### Error Response Format

```json theme={null}
{
  "error": "Registry item \"invalid-name\" not found"
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Endpoints" icon="code" href="/api/endpoints">
    Explore all available API endpoints and parameters
  </Card>

  <Card title="Pairing Schema" icon="layer-group" href="/api/pairing-schema">
    Learn the structure of font pairing responses
  </Card>

  <Card title="Font Schema" icon="font" href="/api/font-schema">
    Understand individual font configuration format
  </Card>
</CardGroup>
