{
    "openapi": "3.1.0",
    "info": {
        "title": "Pack Heap AI API",
        "version": "1.0.0",
        "description": "Search the catalogue, compute DIM weight and file consented quote requests. No payments.",
        "contact": {
            "email": "sales@packheap.com",
            "url": "https://packheap.com/for-ai-agents/"
        }
    },
    "servers": [
        {
            "url": "https://packheap.com/wp-json/packheap-ai/v1"
        }
    ],
    "paths": {
        "/quotes": {
            "post": {
                "operationId": "requestQuote",
                "summary": "File a quote request for a buyer who consented to be contacted.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 100,
                                        "description": "Full name of the buyer."
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "description": "Buyer email address."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Optional phone number."
                                    },
                                    "company": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "description": "Optional company or brand name."
                                    },
                                    "product": {
                                        "type": "string",
                                        "maxLength": 150,
                                        "description": "Product or box style wanted, e.g. \"Custom Ring Boxes\" or a product slug."
                                    },
                                    "material": {
                                        "type": "string",
                                        "enum": [
                                            "Rigid",
                                            "Kraft",
                                            "Corrugated Cardboard",
                                            "Chipboard",
                                            "Other / not sure"
                                        ],
                                        "description": "Preferred material."
                                    },
                                    "length": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "description": "Length in the chosen unit."
                                    },
                                    "width": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "description": "Width in the chosen unit."
                                    },
                                    "depth": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "description": "Depth / height in the chosen unit."
                                    },
                                    "unit": {
                                        "type": "string",
                                        "enum": [
                                            "in",
                                            "cm",
                                            "mm"
                                        ],
                                        "description": "Unit for the dimensions."
                                    },
                                    "quantity": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Number of units. Orders can start from about 100."
                                    },
                                    "colors": {
                                        "type": "string",
                                        "enum": [
                                            "Full Color",
                                            "3 Color",
                                            "2 Color",
                                            "1 Color"
                                        ],
                                        "description": "Print colours."
                                    },
                                    "turnaround": {
                                        "type": "string",
                                        "enum": [
                                            "Rush (6-8 business days)",
                                            "Standard (12-14 business days)",
                                            "Long (1-3 months)"
                                        ],
                                        "description": "Required turnaround."
                                    },
                                    "country": {
                                        "type": "string",
                                        "enum": [
                                            "USA",
                                            "UK",
                                            "Other"
                                        ],
                                        "description": "Destination country (free shipping to USA and UK)."
                                    },
                                    "message": {
                                        "type": "string",
                                        "maxLength": 2000,
                                        "description": "Extra details: finishes, inserts, artwork status."
                                    },
                                    "consent": {
                                        "type": "boolean",
                                        "description": "Must be true: the buyer has explicitly agreed to be contacted by Pack Heap about this quote."
                                    },
                                    "agent": {
                                        "type": "string",
                                        "maxLength": 80,
                                        "description": "Name of the AI assistant submitting (e.g. ChatGPT, Claude)."
                                    }
                                },
                                "required": [
                                    "name",
                                    "email",
                                    "product",
                                    "quantity",
                                    "consent"
                                ],
                                "additionalProperties": false
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Quote request received"
                    },
                    "400": {
                        "description": "Validation error"
                    },
                    "429": {
                        "description": "Rate limit exceeded"
                    }
                }
            }
        },
        "/search": {
            "get": {
                "operationId": "searchCatalogue",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "any",
                                "product",
                                "guide",
                                "page"
                            ]
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Matches"
                    }
                }
            }
        },
        "/dimweight": {
            "get": {
                "operationId": "dimWeight",
                "parameters": [
                    {
                        "name": "length",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "width",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "height",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "unit",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "in",
                                "cm",
                                "mm"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Volume and DIM weight"
                    }
                }
            }
        },
        "/mcp": {
            "post": {
                "operationId": "mcp",
                "summary": "Model Context Protocol (JSON-RPC 2.0)",
                "responses": {
                    "200": {
                        "description": "JSON-RPC response"
                    }
                }
            }
        }
    }
}