HTS MCP
Skip to Content

Graph

Endpoints for querying the semantic knowledge graph.

GET /api/v1/graph/status

Get pipeline statistics including candidate counts, classification progress, and relationship type breakdown.

Response 200

{ "total_candidates": 142380, "total_classified": 142368, "by_type": { "material_affinity": { "count": 18420, "avg_confidence": 0.82 }, "functional_similarity": { "count": 15230, "avg_confidence": 0.79 }, "substitution": { "count": 8920, "avg_confidence": 0.71 }, "component_assembly": { "count": 7650, "avg_confidence": 0.73 }, "end_use": { "count": 11890, "avg_confidence": 0.74 }, "manufacturing_process": { "count": 12100, "avg_confidence": 0.76 }, "cross_category_bridge": { "count": 3210, "avg_confidence": 0.68 }, "abstraction": { "count": 2890, "avg_confidence": 0.85 }, "weak_association": { "count": 24560, "avg_confidence": 0.45 }, "no_meaningful_relationship": { "count": 37498, "avg_confidence": 0.88 } }, "avg_confidence": 0.69, "recent_runs": [ { "run_id": "abc-123", "run_type": "classification", "status": "completed", "started_at": "2024-12-15T10:00:00Z", "completed_at": "2024-12-15T12:15:00Z" } ] }

GET /api/v1/graph/edges/{hts_code}

Get classified semantic edges for a specific HTS code. Returns edges where the code is either the source or target.

Path Parameters

ParameterTypeDescription
hts_codestringHTS code (any length)

Query Parameters

ParameterTypeDefaultDescription
min_confidencefloat0.0Minimum confidence threshold (0-1)
relationship_typelist[string]All typesFilter to specific types (can repeat)
limitinteger20Maximum results (1-100)

Response 200

{ "hts_code": "02013080", "edges": [ { "id": 12345, "source_code": "02013080", "target_code": "02023080", "relationship_type": "material_affinity", "confidence": 0.92, "reasoning": "Both classify boneless beef cuts. Source is fresh/chilled while target is frozen.", "key_differentiator": "fresh vs frozen preservation", "source_inclusionary": ["fresh", "chilled", "boneless", "beef"], "source_exclusionary": ["frozen"], "target_inclusionary": ["frozen", "boneless", "beef"], "target_exclusionary": ["fresh", "chilled"], "haiku": "Cattle on the range\nFresh and frozen sides of beef\nCold preserves the cut", "is_bidirectional": true, "classification_clarity": 0.95, "similarity": 0.89 } ], "count": 15 }

Rate Limit

60 requests per minute when rate limiting is enabled.

Examples

All edges with high confidence:

GET /api/v1/graph/edges/02013080?min_confidence=0.8

Substitution relationships only:

GET /api/v1/graph/edges/02013080?relationship_type=substitution&relationship_type=functional_similarity