{
    "openapi": "3.0.3",
    "info": {
        "title": "ShipSeeker API",
        "description": "U.S. import duty, Section 301, landed cost, HTS classification and global exporters. Part of the ShipSeeker Business plan.",
        "version": "1.0.0",
        "contact": {
            "url": "https://shipseeker.xyz/api"
        }
    },
    "servers": [
        {
            "url": "https://shipseeker.xyz"
        }
    ],
    "security": [
        {
            "ApiKeyQuery": []
        },
        {
            "BearerAuth": []
        }
    ],
    "paths": {
        "/api/v1/duty": {
            "get": {
                "summary": "Duty & landed cost for one HTS code and origin",
                "parameters": [
                    {
                        "name": "hts",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "8507.60.00"
                    },
                    {
                        "name": "value",
                        "in": "query",
                        "schema": {
                            "type": "number"
                        },
                        "example": 50000
                    },
                    {
                        "name": "origin",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "china",
                                "mfn",
                                "col2",
                                "ca",
                                "mx",
                                "kr",
                                "au",
                                "sg",
                                "cl",
                                "co",
                                "pe",
                                "il",
                                "pa",
                                "jo",
                                "bh",
                                "ma",
                                "om"
                            ]
                        },
                        "example": "china"
                    },
                    {
                        "name": "s301",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "25",
                                "7.5",
                                "none"
                            ]
                        }
                    },
                    {
                        "name": "ocean",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "1",
                                "0"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Duty breakdown",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DutyResult"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/hts/{code}": {
            "get": {
                "summary": "HTS classification & rate schedule",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "8507.60.00"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "HTS record"
                    },
                    "404": {
                        "description": "Not found"
                    }
                }
            }
        },
        "/api/v1/exporters": {
            "get": {
                "summary": "Largest exporting countries of the product (HS2, UN Comtrade)",
                "parameters": [
                    {
                        "name": "hts",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "example": "8507"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 10
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Ranked exporters"
                    }
                }
            }
        },
        "/api/v1/duty/bulk": {
            "post": {
                "summary": "Cost a whole PO (up to 1,000 lines); CBP fees applied once per entry",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/BulkRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Per-line results + totals"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ApiKeyQuery": {
                "type": "apiKey",
                "in": "query",
                "name": "key"
            },
            "BearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "DutyResult": {
                "type": "object",
                "properties": {
                    "hts": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "origin": {
                        "type": "string"
                    },
                    "customs_value": {
                        "type": "number"
                    },
                    "duty_rate": {
                        "type": "string",
                        "nullable": true
                    },
                    "rate_basis": {
                        "type": "string"
                    },
                    "duty": {
                        "type": "number",
                        "nullable": true
                    },
                    "specific_rate": {
                        "type": "boolean"
                    },
                    "section_301": {
                        "type": "number"
                    },
                    "mpf": {
                        "type": "number"
                    },
                    "hmf": {
                        "type": "number"
                    },
                    "total_duties_fees": {
                        "type": "number"
                    },
                    "landed_cost": {
                        "type": "number"
                    }
                }
            },
            "BulkRequest": {
                "type": "object",
                "required": [
                    "items"
                ],
                "properties": {
                    "s301": {
                        "type": "string",
                        "enum": [
                            "25",
                            "7.5",
                            "none"
                        ]
                    },
                    "ocean": {
                        "type": "boolean"
                    },
                    "origin": {
                        "type": "string",
                        "description": "default origin for lines that omit one"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "hts": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "number"
                                },
                                "origin": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
