{
  "openapi": "3.1.0",
  "info": {
    "title": "UNITECARGO Public API",
    "version": "1.1.0",
    "description": "Read-only access to published UNITECARGO blog content, bounded provider search, and logistics directory map data."
  },
  "servers": [
    {
      "url": "https://unitecargo.com"
    }
  ],
  "x-mcp": {
    "endpoint": "https://unitecargo.com/api/agent/v1/mcp",
    "protocolVersion": "2026-07-28",
    "transport": "Streamable HTTP",
    "tools": ["search_providers", "get_provider", "get_directory_stats"]
  },
  "paths": {
    "/api/blog": {
      "get": {
        "summary": "List published blog posts",
        "operationId": "listPublishedBlogPosts",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "All"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published posts and pagination metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlogListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/blog/{slug}": {
      "get": {
        "summary": "Get a published blog post",
        "operationId": "getPublishedBlogPost",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The published post and related posts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlogDetailResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "404": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/agent/v1/providers/search": {
      "get": {
        "summary": "Search active verified logistics providers",
        "operationId": "searchLogisticsProviders",
        "description": "Returns bounded provider summaries with canonical UNITECARGO profile links and evidence freshness. Contact, account, claim, submission, and administrative fields are excluded.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "schema": { "type": "string", "maxLength": 100 },
            "description": "Partial company name"
          },
          {
            "name": "state",
            "in": "query",
            "schema": { "type": "string", "pattern": "^[A-Za-z]{2}$" },
            "description": "Two-letter U.S. state or district code"
          },
          {
            "name": "city",
            "in": "query",
            "schema": { "type": "string", "maxLength": 80 },
            "description": "Exact city name, matched case-insensitively"
          },
          {
            "name": "service",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["freight_forwarder", "nvocc", "carrier", "3pl", "broker", "warehouse", "customs_broker", "last_mile", "other"]
            }
          },
          {
            "name": "transport_mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["air", "ocean", "rail", "truck_ftl", "truck_ltl", "intermodal", "courier", "drayage"]
            }
          },
          {
            "name": "cargo_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["general", "hazmat", "refrigerated", "oversized", "high_value", "pharmaceutical", "automotive", "electronics", "perishable", "livestock"]
            }
          },
          {
            "name": "equipment_type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["dry_van", "reefer", "flatbed", "step_deck", "lowboy", "tanker", "intermodal_container", "air_cargo_container"]
            }
          },
          {
            "name": "certification",
            "in": "query",
            "schema": { "type": "string", "maxLength": 100 },
            "description": "Exact documented certification"
          },
          {
            "name": "specialty",
            "in": "query",
            "schema": { "type": "string", "maxLength": 100 },
            "description": "Exact documented specialty"
          },
          {
            "name": "page",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 10000, "default": 1 }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 25, "default": 10 }
          }
        ],
        "responses": {
          "200": {
            "description": "Filtered provider summaries and pagination metadata",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ProviderSearchResponse" }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/StructuredErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/StructuredErrorResponse"
          }
        }
      }
    },
    "/api/logistics/map-data": {
      "get": {
        "summary": "Get logistics directory map data",
        "operationId": "getLogisticsMapData",
        "responses": {
          "200": {
            "description": "Cached map records and aggregate counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MapDataResponse"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/api/logistics/map-stats": {
      "get": {
        "summary": "Get logistics directory map statistics",
        "operationId": "getLogisticsMapStats",
        "responses": {
          "200": {
            "description": "Directory counts and the ten states with the most listed providers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MapStatsResponse"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "ErrorResponse": {
        "description": "Request failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "StructuredErrorResponse": {
        "description": "Request failed",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/StructuredErrorEnvelope" }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "BlogPost": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "excerpt": {
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          },
          "author": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "read_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "BlogListResponse": {
        "type": "object",
        "required": [
          "posts",
          "pagination",
          "categories",
          "filters"
        ],
        "properties": {
          "posts": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/BlogPost"
                },
                {
                  "type": "object",
                  "properties": {
                    "contentPreview": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "filters": {
            "type": "object",
            "required": [
              "category",
              "search"
            ],
            "properties": {
              "category": {
                "type": "string"
              },
              "search": {
                "type": "string"
              }
            }
          }
        }
      },
      "BlogDetailResponse": {
        "type": "object",
        "required": [
          "post",
          "relatedPosts",
          "metadata"
        ],
        "properties": {
          "post": {
            "$ref": "#/components/schemas/BlogPost"
          },
          "relatedPosts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlogPost"
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "page",
          "limit",
          "total",
          "totalPages",
          "hasNext",
          "hasPrev"
        ],
        "properties": {
          "page": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "totalPages": {
            "type": "integer"
          },
          "hasNext": {
            "type": "boolean"
          },
          "hasPrev": {
            "type": "boolean"
          }
        }
      },
      "StructuredErrorEnvelope": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "string" },
              "field": { "type": "string" },
              "message": { "type": "string" }
            }
          }
        }
      },
      "ProviderEvidenceFreshness": {
        "type": "object",
        "required": ["status", "reviewed_at", "age_days", "stale_after_days", "profile_updated_at", "basis"],
        "properties": {
          "status": { "type": "string", "enum": ["current", "stale", "unknown"] },
          "reviewed_at": { "type": ["string", "null"], "format": "date-time" },
          "age_days": { "type": ["integer", "null"], "minimum": 0 },
          "stale_after_days": { "type": "integer", "const": 180 },
          "profile_updated_at": { "type": ["string", "null"], "format": "date-time" },
          "basis": { "type": "string" }
        }
      },
      "ProviderSearchItem": {
        "type": "object",
        "required": ["slug", "company_name", "location", "primary_service", "transport_modes", "cargo_types", "equipment_types", "certifications", "specialties", "technology", "regulatory_identifiers", "directory_status", "canonical_url", "evidence_freshness"],
        "properties": {
          "slug": { "type": ["string", "null"] },
          "company_name": { "type": ["string", "null"] },
          "dba_name": { "type": ["string", "null"] },
          "location": {
            "type": "object",
            "required": ["city", "state"],
            "properties": {
              "city": { "type": ["string", "null"] },
              "state": { "type": ["string", "null"] }
            }
          },
          "primary_service": { "type": ["string", "null"] },
          "transport_modes": { "type": "array", "items": { "type": "string" } },
          "cargo_types": { "type": "array", "items": { "type": "string" } },
          "equipment_types": { "type": "array", "items": { "type": "string" } },
          "certifications": { "type": "array", "items": { "type": "string" } },
          "specialties": { "type": "array", "items": { "type": "string" } },
          "technology": {
            "type": "object",
            "additionalProperties": { "type": ["boolean", "null"] }
          },
          "regulatory_identifiers": {
            "type": "object",
            "additionalProperties": { "type": ["string", "null"] }
          },
          "directory_status": { "type": "string", "const": "verified_active" },
          "canonical_url": { "type": "string", "format": "uri" },
          "evidence_freshness": { "$ref": "#/components/schemas/ProviderEvidenceFreshness" }
        }
      },
      "ProviderSearchResponse": {
        "type": "object",
        "required": ["providers", "pagination", "applied_filters", "evidence_policy"],
        "properties": {
          "providers": {
            "type": "array",
            "maxItems": 25,
            "items": { "$ref": "#/components/schemas/ProviderSearchItem" }
          },
          "pagination": {
            "type": "object",
            "required": ["page", "limit", "total", "total_pages", "has_next", "has_previous"],
            "properties": {
              "page": { "type": "integer" },
              "limit": { "type": "integer" },
              "total": { "type": "integer" },
              "total_pages": { "type": "integer" },
              "has_next": { "type": "boolean" },
              "has_previous": { "type": "boolean" }
            }
          },
          "applied_filters": { "type": "object", "additionalProperties": true },
          "evidence_policy": {
            "type": "object",
            "required": ["stale_after_days", "note"],
            "properties": {
              "stale_after_days": { "type": "integer", "const": 180 },
              "note": { "type": "string" }
            }
          }
        }
      },
      "MapDataResponse": {
        "type": "object",
        "required": [
          "mapData",
          "stateStats",
          "totalCount",
          "recentCount",
          "cacheAge",
          "updatedAt"
        ],
        "properties": {
          "mapData": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "stateStats": {
            "$ref": "#/components/schemas/StateStats"
          },
          "totalCount": {
            "type": "integer"
          },
          "recentCount": {
            "type": "integer"
          },
          "cacheAge": {
            "type": "string",
            "enum": [
              "fresh",
              "cached"
            ]
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MapStatsResponse": {
        "type": "object",
        "required": [
          "stateStats",
          "otherRegions",
          "totalCount",
          "recentCount",
          "statesCovered",
          "topStates",
          "cacheAge",
          "updatedAt",
          "evidenceFreshness"
        ],
        "properties": {
          "stateStats": {
            "$ref": "#/components/schemas/StateStats"
          },
          "otherRegions": {
            "$ref": "#/components/schemas/StateStats"
          },
          "totalCount": {
            "type": "integer"
          },
          "recentCount": {
            "type": "integer"
          },
          "statesCovered": {
            "type": "integer"
          },
          "topStates": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "state",
                "count"
              ],
              "properties": {
                "state": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                }
              }
            }
          },
          "cacheAge": {
            "type": "string",
            "const": "live"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "evidenceFreshness": {
            "type": "object",
            "required": ["status", "checked_at", "latest_profile_update_at", "source"],
            "properties": {
              "status": { "type": "string", "const": "current" },
              "checked_at": { "type": "string", "format": "date-time" },
              "latest_profile_update_at": { "type": ["string", "null"], "format": "date-time" },
              "source": { "type": "string" }
            }
          }
        }
      },
      "StateStats": {
        "type": "object",
        "additionalProperties": {
          "type": "integer"
        }
      }
    }
  }
}
