API Documentation
Integrate UnitFYI data into your applications. Access unit conversions, categories, glossary terms, blog posts, and tools through our JSON APIs, data feeds, and machine-readable endpoints.
Endpoint Reference
| Endpoint | Description | Cache |
|---|---|---|
GET /api/convert/ | Convert a value between two units | 5m |
GET /api/convert/table/ | Generate a conversion table with multiple values | 5m |
GET /api/categories/ | List all 20 measurement categories | 1h |
GET /api/categories/{slug}/ | Category detail with units and popular conversions | 1h |
GET /api/units/ | List all 220 units, optionally filtered by category | 1h |
GET /api/unit/{slug}/ | Single unit detail with aliases | 1h |
GET /api/glossary/ | List glossary terms with optional category/search filter | 1h |
GET /api/glossary/{slug}/ | Glossary term with definition | 1h |
GET /api/blog/posts/ | List published blog posts by category | 1h |
GET /api/blog/posts/{slug}/ | Blog post with full content | 1h |
GET /api/blog/categories/ | Blog categories with post counts | 1h |
GET /api/tools/ | List all 5 interactive conversion tools | 1h |
GET /api/search/?q= | Search across units, categories, glossary, and blog | 5m |
GET /api/openapi.json | OpenAPI 3.1.0 specification (CORS enabled) | none |
Base URL
https://unitfyi.com/api/
OpenAPI spec: https://unitfyi.com/api/openapi.json
Convert
Convert a value between two units.
/api/convert/?from={unit}&to={unit}&value={number}
Parameters
| from | Source unit slug (e.g., centimeter) |
| to | Target unit slug (e.g., inch) |
| value | Numeric value to convert (default: 1) |
Example
curl "https://unitfyi.com/api/convert/?from=centimeter&to=inch&value=100"
{
"from": "centimeter",
"to": "inch",
"value": "100",
"result": "39.37007874",
"from_name": "Centimeter",
"to_name": "Inch",
"from_symbol": "cm",
"to_symbol": "in",
"category": "length",
"formula": "value / 2.54"
}
Conversion Table
Generate a conversion table between two units with multiple values.
/api/convert/table/?from={unit}&to={unit}&values={csv}
Parameters
| from | Source unit slug (required) |
| to | Target unit slug (required) |
| values | Comma-separated values (default: 1,5,10,25,50,100,250,500,1000) |
Example
curl "https://unitfyi.com/api/convert/table/?from=meter&to=foot"
{
"from_unit": "meter",
"from_symbol": "m",
"from_name": "Meter",
"to_unit": "foot",
"to_symbol": "ft",
"to_name": "Foot",
"formula": "1 m = 3.2808 ft",
"table": [
{"value": "1", "result": "3.2808"},
{"value": "5", "result": "16.4042"},
{"value": "10", "result": "32.8084"},
...
]
}
List Categories
List all 20 measurement categories.
/api/categories/
Example
curl https://unitfyi.com/api/categories/
{
"categories": [
{"slug": "length", "name": "Length", "icon": "📏", "unit_count": 15},
{"slug": "weight", "name": "Weight", "icon": "⚖️", "unit_count": 14},
{"slug": "temperature", "name": "Temperature", "icon": "🌡️", "unit_count": 4},
...
]
}
Category Detail
Get a category with its units and popular conversions.
/api/categories/{slug}/
Parameters
| slug | Category slug (e.g., length, weight, temperature) |
Example
curl https://unitfyi.com/api/categories/length/
{
"slug": "length",
"name": "Length",
"icon": "📏",
"description": "Units for measuring distance and length",
"base_unit": "meter",
"units": [
{"slug": "meter", "name": "Meter", "symbol": "m"},
{"slug": "kilometer", "name": "Kilometer", "symbol": "km"},
...
],
"popular_conversions": [
{"from": "centimeter", "to": "inch"},
{"from": "meter", "to": "foot"},
...
]
}
List Units
List all 220 units, optionally filtered by category.
/api/units/?category={slug}
Parameters
| category | Filter by category slug (optional) |
Unit Detail
Get detailed info about a single unit including aliases.
/api/unit/{slug}/
Parameters
| slug | Unit slug (e.g., meter, kilogram, celsius) |
Example
curl https://unitfyi.com/api/unit/meter/
{
"slug": "meter",
"name": "Meter",
"symbol": "m",
"category": "length",
"category_name": "Length",
"description": "The SI base unit of length",
"aliases": ["metre", "meters", "metres"]
}
List Glossary Terms
List measurement glossary terms with optional filters.
/api/glossary/?category={slug}&search={query}
Parameters
| category | Filter by category (optional) |
| search | Search term or definition (optional) |
Glossary Term Detail
Get a single glossary term with definition and explanation.
/api/glossary/{slug}/
Example
curl https://unitfyi.com/api/glossary/metric-system/
{
"slug": "metric-system",
"term": "Metric System",
"definition": "An international decimal system of weights and measures...",
"category": "Metric",
"url": "/glossary/metric-system/"
}
List Blog Posts
List published blog posts, optionally filtered by category.
/api/blog/posts/?category={slug}
Parameters
| category | Filter by blog category slug (optional) |
Blog Post Detail
Get a single blog post with full content.
/api/blog/posts/{slug}/
Blog Categories
List all blog categories with post counts.
/api/blog/categories/
List Tools
List all interactive conversion tools.
/api/tools/
Example
curl https://unitfyi.com/api/tools/
{
"tools": [
{"slug": "converter", "name": "Universal Converter", "description": "Convert between any units", "url": "/tools/converter/"},
{"slug": "quick-convert", "name": "Quick Convert", "description": "Popular conversions at a glance", "url": "/tools/quick-convert/"},
...
]
}
Search
Search across units, categories, glossary terms, and blog posts.
/api/search/?q={query}
Parameters
| q | Search query (min 2 characters) |
Example
curl "https://unitfyi.com/api/search/?q=meter"
{
"query": "meter",
"total": 8,
"units": [
{"slug": "meter", "name": "Meter", "symbol": "m", "category": "length"},
{"slug": "kilometer", "name": "Kilometer", "symbol": "km", "category": "length"},
...
],
"categories": [...],
"glossary": [...],
"blog": [...]
}
RSS & Atom Feeds
Subscribe to our blog feeds to receive updates when new measurement guides and articles are published. We provide both RSS 2.0 and Atom 1.0 formats.
Standard RSS feed. Compatible with all feed readers.
Atom feed with richer metadata and update timestamps.
Subscribe via command line
# RSS curl "https://unitfyi.com/blog/feed/" # Atom curl "https://unitfyi.com/blog/feed/atom/"
AI / LLM Integration
UnitFYI provides machine-readable content summaries following the llms.txt standard. These endpoints help AI models understand and reference our content.
A concise summary of UnitFYI's content structure and key pages. Designed for AI models to quickly understand what the site offers and how it is organized.
Extended version with complete URL patterns, i18n language codes, and page-level structure. Use this for deeper indexing and cross-referencing of UnitFYI content.
Markdown output:
Append .md to any page URL
to get a markdown representation optimized for AI agent consumption.
AI Crawler Policy: Our robots.txt explicitly allows GPTBot, ClaudeBot, and Google-Extended crawlers.
SEO & Standards
Standard endpoints for search engines, crawlers, and security researchers.
| Endpoint | Standard | Description |
|---|---|---|
| /sitemap.xml | Sitemaps 0.9 | Sitemap index with per-section sitemaps covering all content types |
| /robots.txt | REP | Crawler directives with explicit AI bot permissions |
| /.well-known/security.txt | RFC 9116 | Security vulnerability reporting contact information |
Structured Data (JSON-LD)
Every page includes JSON-LD structured data for rich search results:
- - WebSite with SearchAction for sitelinks search box
- - CollectionPage for category and index pages
- - FAQPage on N-squared compare pages (unit-a vs unit-b)
- - Article for blog posts with author and dates
- - DefinedTerm for glossary term definitions
- - WebApplication for interactive tools
- - BreadcrumbList navigation breadcrumbs on all pages
Internationalization
All content pages include hreflang
alternate links for 15 languages: English (default), Korean, Japanese, Chinese (Simplified),
Spanish, French, German, Portuguese, Russian, Arabic, Hindi, Thai, Vietnamese, Indonesian, and Turkish.
Rate Limits & Usage
Our APIs are free to use with no authentication required. To ensure fair access for everyone, please follow these guidelines:
- + Free to use for any purpose
- + No API key or authentication required
- + CORS enabled for browser requests
- + All responses are JSON with UTF-8 encoding
- + OpenAPI 3.1 spec at /api/openapi.json
-
~
Rate limit: 60 requests per minute per IP. Responses include
X-RateLimit-LimitandX-RateLimit-Remainingheaders -
~
Include a descriptive
User-Agentheader identifying your application -
~
Cache responses locally when possible — our API responses include
Cache-Controlheaders
Python Package
Use UnitFYI offline with the Python package. Pure Python, zero dependencies.
Install
pip install unitfyi
Example
from decimal import Decimal
from unitfyi import convert
result = convert(Decimal("100"), "celsius", "fahrenheit")
print(result) # Decimal("212")
result = convert(Decimal("1"), "kilometer", "mile")
print(result) # Decimal("0.6213711922...")
Command-Line Interface
Unit conversion tools in your terminal.
Install & Use
pip install "unitfyi[cli]" unitfyi convert 100 celsius fahrenheit # 212 unitfyi categories # List all 20 categories unitfyi units length # List units in a category
MCP Server
Add unit conversion tools to any AI assistant that supports Model Context Protocol.
Install
pip install "unitfyi[mcp]"
claude_desktop_config.json
{
"mcpServers": {
"unitfyi": {
"command": "python",
"args": ["-m", "unitfyi.mcp_server"]
}
}
}
Available tools
npm Package
TypeScript/JavaScript unit conversion engine with zero dependencies. Works in Node.js, Deno, Bun, and browsers.
Install
npm install unitfyi
Example
import { convert } from "unitfyi";
const fahrenheit = convert(100, "celsius", "fahrenheit");
console.log(fahrenheit); // 212
const miles = convert(1, "kilometer", "mile");
console.log(miles); // 0.6213711922...
OpenAPI Specification
A machine-readable OpenAPI 3.1 specification is available for all JSON API endpoints. Use it with tools like Swagger UI, Postman, or code generators.
Fetch via command line
curl -s "https://unitfyi.com/api/openapi.json" | python -m json.tool
Quick Reference
/api/convert/
/api/convert/table/
/api/categories/
/api/categories/{slug}/
/api/units/
/api/unit/{slug}/
/api/glossary/
/api/glossary/{slug}/
/api/blog/posts/
/api/search/?q=...
/api/tools/
/api/openapi.json
/blog/feed/
/blog/feed/atom/
/llms.txt
/sitemap.xml