{
  "openapi": "3.0.3",
  "info": {
    "title": "TariffLine API",
    "version": "0.2.0",
    "description": "US HTS 2026 lines and Chapter 99 duty actions, searchable by code or description.",
    "license": {
      "name": "Public domain - US Government work (17 U.S.C. 105)",
      "url": "https://www.law.cornell.edu/uscode/text/17/105"
    }
  },
  "servers": [
    {
      "url": "https://api.tariffline.j0401.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/health": {
      "get": {
        "summary": "Health check",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/search": {
      "get": {
        "summary": "Search records",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10,
              "maximum": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching records"
          },
          "400": {
            "description": "limit/offset are not integers"
          },
          "401": {
            "description": "Missing or invalid API key (code: missing_api_key / invalid_api_key)"
          },
          "429": {
            "description": "Daily quota exceeded; see the Retry-After header"
          }
        }
      }
    },
    "/v1/changes": {
      "get": {
        "summary": "Diff against the previous dataset build",
        "description": "Added, removed and modified records plus the changed field names. Returns baseline=false when no previous snapshot exists.",
        "responses": {
          "200": {
            "description": "Change summary"
          },
          "401": {
            "description": "Missing or invalid API key (code: missing_api_key / invalid_api_key)"
          },
          "429": {
            "description": "Daily quota exceeded; see the Retry-After header"
          }
        }
      }
    },
    "/v1/records/{id}": {
      "get": {
        "summary": "Get one record by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Record"
          },
          "401": {
            "description": "Missing or invalid API key (code: missing_api_key / invalid_api_key)"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Daily quota exceeded; see the Retry-After header"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "Current quota usage",
        "responses": {
          "200": {
            "description": "Usage"
          },
          "401": {
            "description": "Missing or invalid API key (code: missing_api_key / invalid_api_key)"
          }
        }
      }
    },
    "/v1/waitlist": {
      "post": {
        "summary": "Join the waitlist",
        "security": [],
        "responses": {
          "200": {
            "description": "Accepted"
          }
        }
      }
    }
  }
}