REST API
HTS MCP exposes 12 REST endpoints through a FastAPI server, providing the same capabilities as the MCP tools via HTTP/JSON.
Base URL
http://localhost:8000/api/v1Authentication
Optional API key authentication. Set the API_KEY environment variable to enable.
Authorization: Bearer your-api-keyIf API_KEY is not set, the API runs without authentication.
Rate Limits
When RATE_LIMIT_ENABLED=true:
| Endpoint | Limit |
|---|---|
GET /api/v1/search | 30/minute |
GET /api/v1/graph/edges/{code} | 60/minute |
POST /api/v1/load | 5/minute |
| All other endpoints | Unlimited |
Endpoint Summary
Tariffs
| Method | Path | Description |
|---|---|---|
GET | /api/v1/tariff/{hts_code} | Get full tariff details |
GET | /api/v1/tariff | Search tariffs by description |
GET | /api/v1/search | Multi-strategy search |
GET | /api/v1/tariff/{code}/references | Code references |
GET | /api/v1/tariff/{code}/referenced-by | Reverse references |
Resources
| Method | Path | Description |
|---|---|---|
GET | /api/v1/resources | Search resources |
GET | /api/v1/resources/stats | Resource statistics |
GET | /api/v1/resources/export | Export all resources |
GET | /api/v1/resources/{id} | Get single resource |
POST | /api/v1/resources | Add new resource |
PATCH | /api/v1/resources/{id}/verify | Toggle verification |
Data Loading
| Method | Path | Description |
|---|---|---|
POST | /api/v1/load | Start async data load |
GET | /api/v1/load/status/{job_id} | Check load job status |
Graph
| Method | Path | Description |
|---|---|---|
GET | /api/v1/graph/status | Graph pipeline status |
GET | /api/v1/graph/edges/{code} | Get edges for a code |
Health
| Method | Path | Description |
|---|---|---|
GET | /health | Health check |
GET | /ready | Readiness probe |
Error Format
All errors return a consistent JSON structure:
{
"detail": "Error message describing what went wrong"
}Standard HTTP status codes:
400: Invalid input404: Resource not found429: Rate limited500: Internal error503: Service unavailable