{
  "openapi": "3.1.0",
  "info": {
    "title": "raFont Fonts API",
    "version": "1.0.0",
    "summary": "Read-only JSON API for the raFont free-font catalogue.",
    "description": "No authentication. CORS open. 120 requests/minute per IP. Bulk exports: /data/fonts.json. Every font page is also available as Markdown by appending .md.",
    "license": {
      "name": "CC BY 4.0 (metadata)",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "contact": {
      "url": "https://rafont.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://rafont.com"
    }
  ],
  "paths": {
    "/api/v1/stats": {
      "get": {
        "operationId": "getStats",
        "summary": "Catalogue statistics and endpoint index",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stats"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fonts": {
      "get": {
        "operationId": "listFonts",
        "summary": "List / filter fonts",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Category slug, e.g. serif-fonts"
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "newest",
                "popular"
              ],
              "default": "newest"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Only fonts updated on/after this date"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FontList"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/v1/fonts/{slug}": {
      "get": {
        "operationId": "getFont",
        "summary": "Font detail with tags, gallery and description HTML",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FontDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/v1/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "Categories with font counts",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/tags": {
      "get": {
        "operationId": "listTags",
        "summary": "Tags with font counts",
        "parameters": [
          {
            "name": "min",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            },
            "description": "Minimum fonts per tag"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "searchFonts",
        "summary": "Alias of /api/v1/fonts with q",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/data/fonts.json": {
      "get": {
        "operationId": "bulkJson",
        "summary": "Full catalogue (JSON, regenerated daily)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/data/fonts.csv": {
      "get": {
        "operationId": "bulkCsv",
        "summary": "Full catalogue (CSV)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "llmsTxt",
        "summary": "LLM-oriented site guide (Markdown)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/markdown": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Font": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "category": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            }
          },
          "summary": {
            "type": "string"
          },
          "preview_image": {
            "type": [
              "string",
              "null"
            ]
          },
          "download_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "license": {
            "type": "string"
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "views": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "FontDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Font"
          },
          {
            "type": "object",
            "properties": {
              "tags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  }
                }
              },
              "gallery": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "description_html": {
                "type": "string"
              },
              "description_2_html": {
                "type": "string"
              },
              "markdown_url": {
                "type": "string"
              }
            }
          }
        ]
      },
      "FontList": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "page": {
                "type": "integer"
              },
              "per_page": {
                "type": "integer"
              },
              "pages": {
                "type": "integer"
              },
              "next": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bulk_dataset": {
                "type": "string"
              }
            }
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Font"
            }
          }
        }
      },
      "Stats": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "data": {
            "type": "object"
          }
        }
      }
    }
  }
}
