{
    "openapi": "3.1.0",
    "info": {
        "title": "FloorLogik API",
        "version": "1.0",
        "description": "Read and write a FloorLogik account's customers, products, orders, quotes, invoices, leads and diary. Documented at https://app.floorlogik.com/developers."
    },
    "servers": [
        {
            "url": "https://app.floorlogik.com/api/v1"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "operationId": "me",
                "summary": "Check a key",
                "tags": [
                    "Account"
                ],
                "description": "Which account the key belongs to and what it may do. A good first call: if this works, the key does.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/customers": {
            "get": {
                "operationId": "customers.index",
                "summary": "List customers",
                "tags": [
                    "Customers"
                ],
                "description": "Every customer, oldest first.",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Matches name, company, email or postcode.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "required": false,
                        "description": "Exactly this email address.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Customer"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "customers.store",
                "summary": "Add a customer",
                "tags": [
                    "Customers"
                ],
                "description": "Needs a key with write access.",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Customer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "individual (the default), trade or builder."
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "First name. Needed unless company_name is given."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Last name."
                                    },
                                    "company_name": {
                                        "type": "string",
                                        "description": "Company name."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "Email address."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Phone number."
                                    },
                                    "mobile": {
                                        "type": "string",
                                        "description": "Mobile number."
                                    },
                                    "billing_address": {
                                        "type": "object",
                                        "description": "line1, line2, line3, city, county, postcode, country. On an update, only the parts sent change."
                                    },
                                    "delivery_address": {
                                        "type": "object",
                                        "description": "The same, for deliveries."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/customers/{id}": {
            "get": {
                "operationId": "customers.show",
                "summary": "Get a customer",
                "tags": [
                    "Customers"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Customer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "customers.update",
                "summary": "Change a customer",
                "tags": [
                    "Customers"
                ],
                "description": "Only the fields sent change. Needs a key with write access.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Customer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "individual (the default), trade or builder."
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "First name. Needed unless company_name is given."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Last name."
                                    },
                                    "company_name": {
                                        "type": "string",
                                        "description": "Company name."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "Email address."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Phone number."
                                    },
                                    "mobile": {
                                        "type": "string",
                                        "description": "Mobile number."
                                    },
                                    "billing_address": {
                                        "type": "object",
                                        "description": "line1, line2, line3, city, county, postcode, country. On an update, only the parts sent change."
                                    },
                                    "delivery_address": {
                                        "type": "object",
                                        "description": "The same, for deliveries."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/products": {
            "get": {
                "operationId": "products.index",
                "summary": "List products",
                "tags": [
                    "Products"
                ],
                "description": "The catalogue. Fitting rates are left out, and so are cost prices: neither is anything a website should show.",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Matches name, SKU or supplier code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sku",
                        "in": "query",
                        "required": false,
                        "description": "Exactly this SKU or supplier code.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category_id",
                        "in": "query",
                        "required": false,
                        "description": "In this category, subcategories included.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "supplier_id",
                        "in": "query",
                        "required": false,
                        "description": "From this supplier.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "required": false,
                        "description": "true for products still sold, false for ones that are not.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "required": false,
                        "description": "stock, to include what is in stock.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Product"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/products/{id}": {
            "get": {
                "operationId": "products.show",
                "summary": "Get a product",
                "tags": [
                    "Products"
                ],
                "description": "With its stock.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Product"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orders": {
            "get": {
                "operationId": "orders.index",
                "summary": "List orders",
                "tags": [
                    "Orders"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Only orders with this status.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "customer_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this customer's.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "external_ref",
                        "in": "query",
                        "required": false,
                        "description": "The order you sent in with this reference.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "source",
                        "in": "query",
                        "required": false,
                        "description": "api for orders sent in through the API.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Order"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "orders.store",
                "summary": "Send in an order",
                "tags": [
                    "Orders"
                ],
                "description": "An order taken somewhere else, usually a website. It arrives as pending, the same as one raised in FloorLogik, and the shop picks, dispatches and invoices it as normal. Every line is checked before anything is saved: if one is wrong, nothing is made. Send external_ref and a retry is safe: the same reference again returns the order already made, with status 200 rather than 201. Needs a key with write access.",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Order"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "external_ref": {
                                        "type": "string",
                                        "description": "Your order number. Unique per account."
                                    },
                                    "customer_id": {
                                        "type": "integer",
                                        "description": "An existing customer."
                                    },
                                    "customer": {
                                        "type": "object",
                                        "description": "Or the customer's details, as for Add a customer. Matched to an existing customer by email, so somebody ordering twice is one customer."
                                    },
                                    "lines": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "product_id": {
                                                    "type": "integer",
                                                    "description": "The product."
                                                },
                                                "sku": {
                                                    "type": "string",
                                                    "description": "Or its SKU (or supplier code)."
                                                },
                                                "quantity": {
                                                    "type": "number",
                                                    "description": "How many, in the product's unit: packs for a pack product, m2 for most others. See unit on a product."
                                                },
                                                "unit_price_pence": {
                                                    "type": "integer",
                                                    "description": "Price per unit. If left out, what this customer pays: their price list, or their pricing tier."
                                                },
                                                "vat_rate": {
                                                    "type": "integer",
                                                    "description": "0, 5 or 20. The product's rate if left out; 20 for a line with no product."
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "description": "For a line with no product, such as a delivery charge. Needs unit_price_pence too. Refused if the shop has typed lines switched off."
                                                },
                                                "unit": {
                                                    "type": "string",
                                                    "description": "Only to override the product's own unit."
                                                },
                                                "room": {
                                                    "type": "string",
                                                    "description": "Which room it is for."
                                                }
                                            },
                                            "required": [
                                                "quantity"
                                            ]
                                        },
                                        "description": "What was ordered. Up to 200."
                                    },
                                    "prices_include_vat": {
                                        "type": "boolean",
                                        "description": "true if the prices sent include VAT, as most websites' do. They are taken back to ex VAT, which can move a total by a penny."
                                    },
                                    "delivery_address": {
                                        "type": "object",
                                        "description": "name, line1, line2, city, county, postcode. If left out, the customer's delivery address, or failing that their billing address."
                                    },
                                    "delivery_notes": {
                                        "type": "string",
                                        "description": "For the driver."
                                    },
                                    "delivery_date": {
                                        "type": "string",
                                        "format": "date",
                                        "description": "Puts the delivery in the diary."
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Notes on the order."
                                    },
                                    "payment": {
                                        "type": "object",
                                        "description": "Money already taken, such as at a website checkout: amount_pence, and method (card, cash, bank_transfer, cheque, bacs or stripe; card if left out). Raises the invoice and records the payment, so the order shows as paid."
                                    }
                                },
                                "required": [
                                    "lines"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/orders/{id}": {
            "get": {
                "operationId": "orders.show",
                "summary": "Get an order",
                "tags": [
                    "Orders"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Order"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/quotes": {
            "get": {
                "operationId": "quotes.index",
                "summary": "List quotes",
                "tags": [
                    "Quotes"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Only quotes with this status.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "customer_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this customer's.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Quote"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/quotes/{id}": {
            "get": {
                "operationId": "quotes.show",
                "summary": "Get a quote",
                "tags": [
                    "Quotes"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Quote"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices": {
            "get": {
                "operationId": "invoices.index",
                "summary": "List invoices",
                "tags": [
                    "Invoices"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Only invoices with this status.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "customer_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this customer's.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "order_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this order's.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Invoice"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices/{id}": {
            "get": {
                "operationId": "invoices.show",
                "summary": "Get an invoice",
                "tags": [
                    "Invoices"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Invoice"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/leads": {
            "get": {
                "operationId": "leads.index",
                "summary": "List leads",
                "tags": [
                    "Leads"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Only leads with this status.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Lead"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "leads.store",
                "summary": "Add an enquiry",
                "tags": [
                    "Leads"
                ],
                "description": "From a contact form, a sample request or a \"book a measure\" button. It lands in Leads as new, the same as one typed in. Samples asked for go on the shop's list of samples to send, so it can see what is going out and what turned into an order. Needs a key with write access.",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Lead"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "first_name": {
                                        "type": "string",
                                        "description": "First name."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Last name."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "Email address."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Phone number."
                                    },
                                    "address": {
                                        "type": "object",
                                        "description": "line1, line2, line3, city, county, postcode."
                                    },
                                    "source": {
                                        "type": "string",
                                        "description": "Where it came from. website if left out."
                                    },
                                    "customer_type": {
                                        "type": "string",
                                        "description": "retail or trade."
                                    },
                                    "product_interest": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        },
                                        "description": "carpet, vinyl, laminate, hardwood, tile or other."
                                    },
                                    "area_m2": {
                                        "type": "number",
                                        "description": "Roughly how much floor."
                                    },
                                    "rooms": {
                                        "type": "integer",
                                        "description": "How many rooms."
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Their message."
                                    },
                                    "samples": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "product_id": {
                                                    "type": "integer",
                                                    "description": "The product."
                                                },
                                                "sku": {
                                                    "type": "string",
                                                    "description": "Or its SKU (or supplier code)."
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "description": "Or what it is, in words, for something not in the catalogue."
                                                },
                                                "quantity": {
                                                    "type": "integer",
                                                    "description": "How many. 1 if left out."
                                                }
                                            }
                                        },
                                        "description": "Samples they asked for. They go on the shop's \"to send\" list and the noticeboard."
                                    }
                                },
                                "required": [
                                    "first_name"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/leads/{id}": {
            "get": {
                "operationId": "leads.show",
                "summary": "Get a lead",
                "tags": [
                    "Leads"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Lead"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/jobs": {
            "get": {
                "operationId": "jobs.index",
                "summary": "List jobs",
                "tags": [
                    "Diary"
                ],
                "description": "Measures, fittings and deliveries, in date order.",
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Only this type, such as installation.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Only this status.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "order_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this order's.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "On or after this day.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "On or before this day.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Which page. Starts at 1.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "How many a page, up to 100. 25 if not given.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Only records changed since then. For keeping a copy in step: remember when you last asked.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Job"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/jobs/{id}": {
            "get": {
                "operationId": "jobs.show",
                "summary": "Get a job",
                "tags": [
                    "Diary"
                ],
                "description": "",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Job"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "An API key made in Settings, under Integrations: fl_live_..."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string",
                                "enum": [
                                    "unauthenticated",
                                    "subscription_required",
                                    "account_inactive",
                                    "forbidden",
                                    "not_found",
                                    "method_not_allowed",
                                    "validation_failed",
                                    "rate_limited",
                                    "server_error"
                                ]
                            },
                            "message": {
                                "type": "string"
                            },
                            "fields": {
                                "type": "object",
                                "additionalProperties": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Customer": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The customer's id."
                    },
                    "type": {
                        "type": "string",
                        "description": "individual, trade or builder."
                    },
                    "name": {
                        "type": "string",
                        "description": "The name to show: the company name for a business, otherwise first and last name."
                    },
                    "first_name": {
                        "type": "string",
                        "description": "First name."
                    },
                    "last_name": {
                        "type": "string",
                        "description": "Last name."
                    },
                    "company_name": {
                        "type": "string",
                        "description": "Company name, for a business."
                    },
                    "email": {
                        "type": "string",
                        "description": "Email address."
                    },
                    "phone": {
                        "type": "string",
                        "description": "Phone number."
                    },
                    "mobile": {
                        "type": "string",
                        "description": "Mobile number."
                    },
                    "billing_address": {
                        "type": "object",
                        "properties": {
                            "line1": {
                                "type": "string",
                                "description": "First line."
                            },
                            "line2": {
                                "type": "string",
                                "description": "Second line."
                            },
                            "line3": {
                                "type": "string",
                                "description": "Third line."
                            },
                            "city": {
                                "type": "string",
                                "description": "Town or city."
                            },
                            "county": {
                                "type": "string",
                                "description": "County."
                            },
                            "postcode": {
                                "type": "string",
                                "description": "Postcode."
                            },
                            "country": {
                                "type": "string",
                                "description": "Country."
                            }
                        },
                        "description": "Where invoices go."
                    },
                    "delivery_address": {
                        "type": "object",
                        "properties": {
                            "line1": {
                                "type": "string",
                                "description": "First line."
                            },
                            "line2": {
                                "type": "string",
                                "description": "Second line."
                            },
                            "line3": {
                                "type": "string",
                                "description": "Third line."
                            },
                            "city": {
                                "type": "string",
                                "description": "Town or city."
                            },
                            "county": {
                                "type": "string",
                                "description": "County."
                            },
                            "postcode": {
                                "type": "string",
                                "description": "Postcode."
                            },
                            "country": {
                                "type": "string",
                                "description": "Country."
                            }
                        },
                        "description": "Where goods go, when different."
                    },
                    "pricing_tier": {
                        "type": "integer",
                        "description": "Which price the customer pays: 1 (standard), 2 or 3. See price_pence on a product."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the customer was added."
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the customer was last changed."
                    }
                }
            },
            "Product": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The product's id."
                    },
                    "sku": {
                        "type": "string",
                        "description": "The shop's code for it. Orders can name products by this."
                    },
                    "supplier_ref": {
                        "type": "string",
                        "description": "The supplier's code for it."
                    },
                    "name": {
                        "type": "string",
                        "description": "Name."
                    },
                    "description": {
                        "type": "string",
                        "description": "Description."
                    },
                    "type": {
                        "type": "string",
                        "description": "roll, cut, pack, make_to_order or accessory."
                    },
                    "unit": {
                        "type": "string",
                        "description": "What a quantity of it is counted in on an order: pack, m2, m, item, box..."
                    },
                    "category": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The category's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The category's name."
                            }
                        },
                        "description": "Its category. A subcategory is named with its parent, as \"Wood › Herringbone\"."
                    },
                    "supplier": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The supplier's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The supplier's name."
                            }
                        },
                        "description": "Who supplies it."
                    },
                    "colour": {
                        "type": "string",
                        "description": "Colour."
                    },
                    "width_mm": {
                        "type": "integer",
                        "description": "Board, tile or roll width in millimetres."
                    },
                    "thickness_mm": {
                        "type": "number",
                        "description": "Thickness in millimetres."
                    },
                    "length": {
                        "type": "object",
                        "properties": {
                            "text": {
                                "type": "string",
                                "description": "As the supplier writes it, such as \"1200mm\" or \"400-1500mm random\"."
                            },
                            "mm": {
                                "type": "integer",
                                "description": "A single length in millimetres."
                            },
                            "min_mm": {
                                "type": "integer",
                                "description": "The shortest, for random lengths."
                            },
                            "max_mm": {
                                "type": "integer",
                                "description": "The longest, for random lengths."
                            }
                        },
                        "description": "Board or tile length."
                    },
                    "pack_coverage_m2": {
                        "type": "number",
                        "description": "Square metres in a pack, for pack products."
                    },
                    "price_pence": {
                        "type": "integer",
                        "description": "Standard selling price per unit, ex VAT."
                    },
                    "price_tier2_pence": {
                        "type": "integer",
                        "description": "Price for tier 2 customers, ex VAT. Null means the standard price."
                    },
                    "price_tier3_pence": {
                        "type": "integer",
                        "description": "Price for tier 3 customers, ex VAT. Null means the tier 2 price."
                    },
                    "vat_rate": {
                        "type": "integer",
                        "description": "VAT rate in percent: 0, 5 or 20."
                    },
                    "is_active": {
                        "type": "boolean",
                        "description": "False for a product the shop no longer sells."
                    },
                    "stock": {
                        "$ref": "#/components/schemas/Stock",
                        "description": "What is in stock. Only with include=stock on a list; always on a single product. Null for things not stocked by the roll or pack."
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the product was last changed, price included."
                    }
                }
            },
            "Stock": {
                "type": "object",
                "properties": {
                    "unit": {
                        "type": "string",
                        "description": "m2 for rolls, pack for packs."
                    },
                    "in_stock": {
                        "type": "number",
                        "description": "Everything booked in and on the shelf."
                    },
                    "allocated": {
                        "type": "number",
                        "description": "Of that, how much is set aside for customers' orders."
                    },
                    "free": {
                        "type": "number",
                        "description": "What is free to sell: in_stock less allocated."
                    },
                    "rolls": {
                        "type": "integer",
                        "description": "Rolls only: how many rolls."
                    },
                    "metres": {
                        "type": "number",
                        "description": "Rolls only: metres left across them."
                    }
                }
            },
            "Order": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The order's id."
                    },
                    "ref": {
                        "type": "string",
                        "description": "The shop's order number, such as ORD-2026-0042."
                    },
                    "external_ref": {
                        "type": "string",
                        "description": "Your reference, when the order came in through the API."
                    },
                    "source": {
                        "type": "string",
                        "description": "api for an order sent in through the API; null for one raised in FloorLogik."
                    },
                    "status": {
                        "type": "string",
                        "description": "pending, confirmed, goods_received (everything ordered from suppliers is in), completed or cancelled."
                    },
                    "payment_status": {
                        "type": "string",
                        "description": "unpaid, deposit_paid (something paid, not all) or paid."
                    },
                    "customer": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The customer's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The customer's name."
                            }
                        },
                        "description": "Who the order is for."
                    },
                    "quote_id": {
                        "type": "integer",
                        "description": "The quote it came from, if any."
                    },
                    "subtotal_pence": {
                        "type": "integer",
                        "description": "Total before VAT."
                    },
                    "vat_pence": {
                        "type": "integer",
                        "description": "VAT."
                    },
                    "total_pence": {
                        "type": "integer",
                        "description": "Total including VAT."
                    },
                    "paid_pence": {
                        "type": "integer",
                        "description": "Paid so far, a measure fee taken off it included."
                    },
                    "balance_due_pence": {
                        "type": "integer",
                        "description": "Still to pay."
                    },
                    "deposit_pct": {
                        "type": "integer",
                        "description": "Deposit asked for, in percent."
                    },
                    "fitting_type": {
                        "type": "string",
                        "description": "supply_only, supply_and_install or supply_third_party (fitted by somebody else)."
                    },
                    "delivery_date": {
                        "type": "string",
                        "format": "date",
                        "description": "When it is to be delivered, if booked."
                    },
                    "dispatched": {
                        "type": "boolean",
                        "description": "Whether it has been picked and sent out."
                    },
                    "delivery_address": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "Who it is for."
                            },
                            "line1": {
                                "type": "string",
                                "description": "First line."
                            },
                            "line2": {
                                "type": "string",
                                "description": "Second line."
                            },
                            "city": {
                                "type": "string",
                                "description": "Town or city."
                            },
                            "county": {
                                "type": "string",
                                "description": "County."
                            },
                            "postcode": {
                                "type": "string",
                                "description": "Postcode."
                            },
                            "notes": {
                                "type": "string",
                                "description": "Delivery notes."
                            }
                        },
                        "description": "Where it goes."
                    },
                    "notes": {
                        "type": "string",
                        "description": "Notes on the order."
                    },
                    "goods": {
                        "type": "object",
                        "properties": {
                            "state": {
                                "type": "string",
                                "description": "awaiting, part_received or received."
                            },
                            "label": {
                                "type": "string",
                                "description": "The same, in words: \"Goods part received\"."
                            }
                        },
                        "description": "Where the goods ordered from suppliers for it have got to. Null when nothing has been ordered."
                    },
                    "lines": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Line"
                        },
                        "description": "What is on it."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the order was raised."
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the order was last changed."
                    }
                }
            },
            "Line": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The line's id."
                    },
                    "type": {
                        "type": "string",
                        "description": "product for goods; labour for fitting; discount."
                    },
                    "product_id": {
                        "type": "integer",
                        "description": "The product, if it is one."
                    },
                    "description": {
                        "type": "string",
                        "description": "What it says on the paperwork."
                    },
                    "quantity": {
                        "type": "number",
                        "description": "How many, in unit."
                    },
                    "unit": {
                        "type": "string",
                        "description": "pack, m2, m, item..."
                    },
                    "unit_label": {
                        "type": "string",
                        "description": "The unit as a customer reads it: \"packs\", \"m²\"."
                    },
                    "unit_price_pence": {
                        "type": "integer",
                        "description": "Price per unit, ex VAT."
                    },
                    "vat_rate": {
                        "type": "integer",
                        "description": "VAT rate in percent."
                    },
                    "total_pence": {
                        "type": "integer",
                        "description": "The line including VAT."
                    },
                    "room": {
                        "type": "string",
                        "description": "The room it is for."
                    },
                    "area_m2": {
                        "type": "number",
                        "description": "The room's area, where measured."
                    },
                    "cuts": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Carpet only: the cuts off the roll, each with its width and length."
                    }
                }
            },
            "Quote": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The quote's id."
                    },
                    "ref": {
                        "type": "string",
                        "description": "The shop's quote number."
                    },
                    "status": {
                        "type": "string",
                        "description": "draft, sent, approved (accepted by the customer online), declined or converted (made into an order)."
                    },
                    "customer": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The customer's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The customer's name."
                            }
                        },
                        "description": "Who it is for."
                    },
                    "subtotal_pence": {
                        "type": "integer",
                        "description": "Total before VAT."
                    },
                    "vat_pence": {
                        "type": "integer",
                        "description": "VAT."
                    },
                    "total_pence": {
                        "type": "integer",
                        "description": "Total including VAT."
                    },
                    "valid_until": {
                        "type": "string",
                        "format": "date",
                        "description": "When it runs out."
                    },
                    "sent_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was sent."
                    },
                    "accepted_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the customer accepted it online."
                    },
                    "lines": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Line"
                        },
                        "description": "What is on it."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was made."
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was last changed."
                    }
                }
            },
            "Invoice": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The invoice's id."
                    },
                    "ref": {
                        "type": "string",
                        "description": "The invoice number."
                    },
                    "type": {
                        "type": "string",
                        "description": "deposit, balance, full or measure (a measure fee)."
                    },
                    "status": {
                        "type": "string",
                        "description": "draft, sent, overdue, paid or voided."
                    },
                    "customer": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The customer's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The customer's name."
                            }
                        },
                        "description": "Who it is to."
                    },
                    "order": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The order's id."
                            },
                            "ref": {
                                "type": "string",
                                "description": "The order number."
                            }
                        },
                        "description": "The order it is for. Null for a measure fee."
                    },
                    "subtotal_pence": {
                        "type": "integer",
                        "description": "Before VAT."
                    },
                    "vat_pence": {
                        "type": "integer",
                        "description": "VAT."
                    },
                    "total_pence": {
                        "type": "integer",
                        "description": "Including VAT."
                    },
                    "paid_pence": {
                        "type": "integer",
                        "description": "Paid so far."
                    },
                    "due_pence": {
                        "type": "integer",
                        "description": "Still owed."
                    },
                    "due_date": {
                        "type": "string",
                        "format": "date",
                        "description": "When it is due."
                    },
                    "issued_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was issued."
                    },
                    "paid_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was paid in full."
                    },
                    "pay_url": {
                        "type": "string",
                        "description": "A page where the customer can pay it by card, when the shop takes card payments and something is owed."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was raised."
                    }
                }
            },
            "Lead": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The lead's id."
                    },
                    "status": {
                        "type": "string",
                        "description": "new, contacted, sample_sent, measure_booked, quoted, won or lost."
                    },
                    "source": {
                        "type": "string",
                        "description": "Where it came from, such as website, phone, walk_in, referral, checkatrade or trade_show."
                    },
                    "first_name": {
                        "type": "string",
                        "description": "First name."
                    },
                    "last_name": {
                        "type": "string",
                        "description": "Last name."
                    },
                    "email": {
                        "type": "string",
                        "description": "Email address."
                    },
                    "phone": {
                        "type": "string",
                        "description": "Phone number."
                    },
                    "address": {
                        "type": "object",
                        "properties": {
                            "line1": {
                                "type": "string",
                                "description": "First line."
                            },
                            "line2": {
                                "type": "string",
                                "description": "Second line."
                            },
                            "line3": {
                                "type": "string",
                                "description": "Third line."
                            },
                            "city": {
                                "type": "string",
                                "description": "Town or city."
                            },
                            "county": {
                                "type": "string",
                                "description": "County."
                            },
                            "postcode": {
                                "type": "string",
                                "description": "Postcode."
                            }
                        },
                        "description": "Their address."
                    },
                    "customer_type": {
                        "type": "string",
                        "description": "retail or trade."
                    },
                    "product_interest": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "What they are interested in: carpet, vinyl, laminate, hardwood, tile or other."
                    },
                    "area_m2": {
                        "type": "number",
                        "description": "Roughly how much floor."
                    },
                    "rooms": {
                        "type": "integer",
                        "description": "How many rooms."
                    },
                    "notes": {
                        "type": "string",
                        "description": "Anything else they said."
                    },
                    "customer_id": {
                        "type": "integer",
                        "description": "The customer they became, once converted."
                    },
                    "samples": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Samples asked for or sent: id, product_id, description, quantity, status (requested, sent, follow_up_due or followed_up), requested_at, sent_at."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When the enquiry came in."
                    }
                }
            },
            "Job": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "The job's id."
                    },
                    "ref": {
                        "type": "string",
                        "description": "The job number."
                    },
                    "type": {
                        "type": "string",
                        "description": "measure, installation, delivery, meeting, callback, survey or collection."
                    },
                    "status": {
                        "type": "string",
                        "description": "scheduled, in_progress, completed, cancelled, no_access or rescheduled."
                    },
                    "customer": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The customer's id."
                            },
                            "name": {
                                "type": "string",
                                "description": "The customer's name."
                            }
                        },
                        "description": "Who it is for."
                    },
                    "order": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "description": "The order's id."
                            },
                            "ref": {
                                "type": "string",
                                "description": "The order number."
                            }
                        },
                        "description": "The order it is for, if any."
                    },
                    "scheduled_date": {
                        "type": "string",
                        "format": "date",
                        "description": "The day."
                    },
                    "end_date": {
                        "type": "string",
                        "format": "date",
                        "description": "The last day, for a job over several."
                    },
                    "start_time": {
                        "type": "string",
                        "description": "Start time, HH:MM."
                    },
                    "end_time": {
                        "type": "string",
                        "description": "End time, HH:MM."
                    },
                    "day_part": {
                        "type": "string",
                        "description": "am or pm, when booked by part of the day instead of a time."
                    },
                    "address": {
                        "type": "object",
                        "properties": {
                            "line1": {
                                "type": "string",
                                "description": "First line."
                            },
                            "city": {
                                "type": "string",
                                "description": "Town or city."
                            },
                            "postcode": {
                                "type": "string",
                                "description": "Postcode."
                            }
                        },
                        "description": "Where."
                    },
                    "completed_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was marked done."
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "description": "When it was booked."
                    }
                }
            }
        }
    }
}