{
    "openapi": "3.1.0",
    "info": {
        "title": "Sleep Align Pillow Loft API",
        "version": "2026-08-15",
        "description": "Computes the supported pillow loft a body needs from sleeping position, frame width and mattress firmness, and returns which catalogued pillows publish a loft inside that range. Free to use, no key required, CC BY 4.0 with attribution to sleepalign.org.",
        "license": {
            "name": "CC BY 4.0",
            "url": "https://creativecommons.org/licenses/by/4.0/"
        },
        "contact": {
            "email": "hello@sleepalign.org"
        }
    },
    "servers": [
        {
            "url": "https://sleepalign.org/wp-json/sleepalign/v1"
        }
    ],
    "paths": {
        "/loft": {
            "get": {
                "operationId": "getPillowLoft",
                "summary": "Compute the pillow loft a person needs",
                "description": "Returns the supported pillow height in inches, as a centre value with a +/- 0.5 in tolerance range, plus every catalogued pillow whose published loft overlaps that range.",
                "parameters": [
                    {
                        "name": "position",
                        "in": "query",
                        "required": true,
                        "description": "Sleeping position. Combination uses side-sleeping figures because side is the limiting case.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "side",
                                "back",
                                "stomach",
                                "combination"
                            ]
                        }
                    },
                    {
                        "name": "build",
                        "in": "query",
                        "required": false,
                        "description": "Frame width across the shoulders.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "narrow",
                                "average",
                                "broad"
                            ],
                            "default": "average"
                        }
                    },
                    {
                        "name": "firmness",
                        "in": "query",
                        "required": false,
                        "description": "Mattress firmness. Softer mattresses need lower pillows because the shoulder sinks further.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "soft",
                                "medium",
                                "firm"
                            ],
                            "default": "medium"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Computed loft range and matching pillows"
                    }
                }
            }
        },
        "/pillows": {
            "get": {
                "operationId": "listPillowSpecifications",
                "summary": "The full pillow specification dataset",
                "description": "Published loft, fill, firmness, adjustability, cooling claim, trial window, warranty and price for every catalogued pillow, each row carrying the manufacturer URL it came from.",
                "responses": {
                    "200": {
                        "description": "The dataset"
                    }
                }
            }
        }
    }
}