{
    "openapi": "3.1.0",
    "info": {
        "title": "PerfDelta REST API",
        "version": "1.0.0",
        "summary": "PageSpeed and Core Web Vitals scans, reports, projects and performance budgets.",
        "description": "Start PageSpeed scans, read real-user Core Web Vitals (Chrome UX Report) and Lighthouse lab data, prioritised fixes, history, projects, competitors and performance budgets.\n\nAuthentication: `Authorization: Bearer <API key>`. Create keys at https://perfdelta.com/api-keys. A free account can call the read endpoints and start one scan every 24 hours (30 requests per minute); paid plans get 60 requests per minute and a monthly PageSpeed test budget. Scans cost one test per URL and device, all other calls are free of charge.\n\nResponses are JSON (`application/json; charset=utf-8`). Errors are flat objects with an `error` code and usually a `message`. There is no pagination. The same functions are available to AI agents through the MCP server at https://perfdelta.com/api/mcp.php.\n\nHuman-readable reference: https://perfdelta.com/api-docs",
        "termsOfService": "https://perfdelta.com/terms",
        "contact": {
            "name": "PerfDelta",
            "url": "https://perfdelta.com/contact",
            "email": "info@perfdelta.com"
        },
        "x-logo": {
            "url": "https://perfdelta.com/assets/img/apple-touch-icon.png"
        }
    },
    "externalDocs": {
        "description": "API documentation",
        "url": "https://perfdelta.com/api-docs"
    },
    "servers": [
        {
            "url": "https://perfdelta.com/api/v1"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "Scans",
            "description": "Start scans and poll their status."
        },
        {
            "name": "Reports",
            "description": "Results, fixes, changes, full reports and history."
        },
        {
            "name": "Projects",
            "description": "Projects, URLs and competitors."
        },
        {
            "name": "Notes",
            "description": "Notes on scans, for example fix status reported by coding agents."
        },
        {
            "name": "Budgets",
            "description": "Performance budgets and CI checks."
        },
        {
            "name": "Account",
            "description": "Plan, budget and quota."
        }
    ],
    "paths": {
        "/scans.php": {
            "get": {
                "operationId": "getScan",
                "tags": [
                    "Scans"
                ],
                "summary": "Status and results of a scan",
                "description": "Poll every 15 to 30 seconds until status is done or error. Only the account that started the scan can read it. Free of charge.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": true,
                        "description": "scan_id returned by POST /scans.php.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F-]{32,36}$"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Scan status; results once status is done.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ScanStatus"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "startScan",
                "tags": [
                    "Scans"
                ],
                "summary": "Start a scan",
                "description": "Costs one PageSpeed test per measured URL and device from the monthly budget. Free accounts: one scan per rolling 24 hours, a single URL, region auto only; the same URL within the window returns the existing scan with status 200 and reused true.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Public http(s) URL. Takes precedence over url_id."
                                    },
                                    "url_id": {
                                        "type": "integer",
                                        "description": "URL of one of your projects."
                                    },
                                    "devices": {
                                        "type": "string",
                                        "enum": [
                                            "both",
                                            "mobile",
                                            "desktop"
                                        ],
                                        "default": "both"
                                    },
                                    "project_id": {
                                        "type": "integer",
                                        "description": "Adds the URL to this project (paid plans)."
                                    },
                                    "scope": {
                                        "type": "string",
                                        "enum": [
                                            "url",
                                            "group"
                                        ],
                                        "default": "url"
                                    },
                                    "region": {
                                        "type": "string",
                                        "enum": [
                                            "auto",
                                            "us-east",
                                            "us-west",
                                            "eu",
                                            "asia"
                                        ],
                                        "description": "Lab region; free accounts only auto."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Free account: existing scan of the same URL reused (reused true, cost 0).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ScanStarted"
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Scan started.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ScanStarted"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "budget_exhausted or daily_limit, with needed, remaining, limit and upgrade_url.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "500": {
                        "description": "scan_failed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/usage.php": {
            "get": {
                "operationId": "getUsage",
                "tags": [
                    "Account"
                ],
                "summary": "Plan, budget and quota",
                "responses": {
                    "200": {
                        "description": "Current usage of the account.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Usage"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/report.php": {
            "get": {
                "operationId": "getReport",
                "tags": [
                    "Reports"
                ],
                "summary": "Latest public result of any measured domain",
                "description": "Works for every domain measured with PerfDelta, not only your own. Unknown domains return 200 with status not_found. Free of charge.",
                "parameters": [
                    {
                        "name": "url",
                        "in": "query",
                        "required": true,
                        "description": "Any URL of the domain; only the host is used.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "include",
                        "in": "query",
                        "required": false,
                        "description": "Comma-separated list, any of competitors, trend.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Language of texts in the response.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "de"
                            ],
                            "default": "en"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Latest result.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Report"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "getReportPost",
                "tags": [
                    "Reports"
                ],
                "summary": "Latest public result (JSON body)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string"
                                    },
                                    "include": {
                                        "oneOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "array",
                                                "items": {
                                                    "type": "string",
                                                    "enum": [
                                                        "competitors",
                                                        "trend"
                                                    ]
                                                },
                                                "maxItems": 5
                                            }
                                        ]
                                    },
                                    "lang": {
                                        "type": "string",
                                        "enum": [
                                            "en",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "url"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Latest result.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Report"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/fixes.php": {
            "get": {
                "operationId": "getFixes",
                "tags": [
                    "Reports"
                ],
                "summary": "Prioritised fixes of the latest measurement",
                "parameters": [
                    {
                        "name": "url",
                        "in": "query",
                        "required": true,
                        "description": "Any URL of the domain; only the host is used.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Language of texts in the response.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "de"
                            ],
                            "default": "en"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Fixes with impact, affected files and guides.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Fixes"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Domain not measured yet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/StatusNotFound"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "getFixesPost",
                "tags": [
                    "Reports"
                ],
                "summary": "Prioritised fixes (JSON body)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string"
                                    },
                                    "lang": {
                                        "type": "string",
                                        "enum": [
                                            "en",
                                            "de"
                                        ]
                                    }
                                },
                                "required": [
                                    "url"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Fixes with impact, affected files and guides.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Fixes"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Domain not measured yet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/StatusNotFound"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/changes.php": {
            "get": {
                "operationId": "getChanges",
                "tags": [
                    "Reports"
                ],
                "summary": "What changed since the previous measurement",
                "parameters": [
                    {
                        "name": "url",
                        "in": "query",
                        "required": true,
                        "description": "Any URL of the domain; only the host is used.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Language of texts in the response.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "de"
                            ],
                            "default": "en"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Changes between the last two measurements.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Changes"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Domain not measured yet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/StatusNotFound"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/details.php": {
            "get": {
                "operationId": "getReportDetails",
                "tags": [
                    "Reports"
                ],
                "summary": "Full report of a scan",
                "description": "Field and lab data per page, page weight, third parties, opportunities, diagnostics, competitors, AI recommendations, notes and history. Readable for your own scans and scans in your projects.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": false,
                        "description": "scan_id or report hash. Either id or url_id is required.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "url_id",
                        "in": "query",
                        "required": false,
                        "description": "Latest scan of a project URL.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Full report.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportDetails"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/history.php": {
            "get": {
                "operationId": "getHistory",
                "tags": [
                    "Reports"
                ],
                "summary": "Measurement history of a project URL",
                "description": "Newest first. Free accounts see the last three measurements.",
                "parameters": [
                    {
                        "name": "url_id",
                        "in": "query",
                        "required": true,
                        "description": "URL of one of your projects.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "History entries.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "history": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/HistoryEntry"
                                            }
                                        },
                                        "older_runs_stored": {
                                            "type": "integer"
                                        },
                                        "_meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    },
                                    "required": [
                                        "history"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/projects.php": {
            "get": {
                "operationId": "listProjects",
                "tags": [
                    "Projects"
                ],
                "summary": "List projects",
                "responses": {
                    "200": {
                        "description": "Projects of the account.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "projects": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "projects"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "createProject",
                "tags": [
                    "Projects"
                ],
                "summary": "Create a project (paid plans)",
                "description": "Plans without multiple projects can hold one project (403 project_limit).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "region": {
                                        "type": "string",
                                        "enum": [
                                            "auto",
                                            "us-east",
                                            "us-west",
                                            "eu",
                                            "asia"
                                        ]
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Project created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "region": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/urls.php": {
            "get": {
                "operationId": "listUrls",
                "tags": [
                    "Projects"
                ],
                "summary": "List project URLs or suggest URLs from the sitemap",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "query",
                        "required": true,
                        "description": "Project.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "suggest",
                        "in": "query",
                        "required": false,
                        "description": "Return URL suggestions from the sitemap instead of the project URLs.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1
                            ]
                        }
                    },
                    {
                        "name": "site",
                        "in": "query",
                        "required": false,
                        "description": "Site to read the sitemap from (suggest only).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "refresh",
                        "in": "query",
                        "required": false,
                        "description": "Read the sitemap again (suggest only).",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Project URLs, or suggestions with suggest=1.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "urls": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/ProjectUrl"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "urls"
                                            ]
                                        },
                                        {
                                            "$ref": "#/components/schemas/UrlSuggestions"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "addUrls",
                "tags": [
                    "Projects"
                ],
                "summary": "Add URLs to a project (paid plans)",
                "description": "URLs without a scheme get https://. Monitoring measures them from the monthly budget.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "project_id": {
                                        "type": "integer"
                                    },
                                    "url": {
                                        "type": "string"
                                    },
                                    "urls": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "maxItems": 100
                                    }
                                },
                                "required": [
                                    "project_id"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Nothing added (see skipped).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UrlsAdded"
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "At least one URL added.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UrlsAdded"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "patch": {
                "operationId": "setUrlMonitoring",
                "tags": [
                    "Projects"
                ],
                "summary": "Switch monitoring of a URL on or off (paid plans)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url_id": {
                                        "type": "integer"
                                    },
                                    "monitoring_enabled": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "url_id",
                                    "monitoring_enabled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "monitoring_enabled": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "delete": {
                "operationId": "removeUrl",
                "tags": [
                    "Projects"
                ],
                "summary": "Remove a URL from its project (paid plans)",
                "parameters": [
                    {
                        "name": "url_id",
                        "in": "query",
                        "required": false,
                        "description": "URL to remove (or url_id in a JSON body).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Deleted"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/competitors.php": {
            "get": {
                "operationId": "listCompetitors",
                "tags": [
                    "Projects"
                ],
                "summary": "List competitors of a project (paid plans)",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "query",
                        "required": true,
                        "description": "Project.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Competitors.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "domain": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "required": [
                                        "competitors"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "addCompetitor",
                "tags": [
                    "Projects"
                ],
                "summary": "Add a competitor (paid plans)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "project_id": {
                                        "type": "integer"
                                    },
                                    "domain": {
                                        "type": "string",
                                        "description": "Domain or URL."
                                    }
                                },
                                "required": [
                                    "project_id",
                                    "domain"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Competitor added.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "domain": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "description": "duplicate.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "delete": {
                "operationId": "removeCompetitor",
                "tags": [
                    "Projects"
                ],
                "summary": "Remove a competitor (paid plans)",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "query",
                        "required": false,
                        "description": "Project.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "id",
                        "in": "query",
                        "required": false,
                        "description": "Competitor id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Deleted"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/notes.php": {
            "get": {
                "operationId": "listNotes",
                "tags": [
                    "Notes"
                ],
                "summary": "Notes on a scan",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": true,
                        "description": "scan_id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Oldest first.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "notes": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Note"
                                            }
                                        }
                                    },
                                    "required": [
                                        "notes"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "addNote",
                "tags": [
                    "Notes"
                ],
                "summary": "Add a note to a scan",
                "description": "Coding agents report fix status here, for example \"PD-<id> done: ...\". Up to 50 notes per scan.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "scan_id": {
                                        "type": "string"
                                    },
                                    "note": {
                                        "type": "string",
                                        "maxLength": 280
                                    }
                                },
                                "required": [
                                    "scan_id",
                                    "note"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Note created.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "scan_id": {
                                            "type": "string"
                                        },
                                        "note": {
                                            "type": "string"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "patch": {
                "operationId": "updateNote",
                "tags": [
                    "Notes"
                ],
                "summary": "Edit a note",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "note_id": {
                                        "type": "integer"
                                    },
                                    "note": {
                                        "type": "string",
                                        "maxLength": 280
                                    }
                                },
                                "required": [
                                    "note_id",
                                    "note"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer"
                                        },
                                        "note": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "delete": {
                "operationId": "deleteNote",
                "tags": [
                    "Notes"
                ],
                "summary": "Delete a note",
                "parameters": [
                    {
                        "name": "note_id",
                        "in": "query",
                        "required": false,
                        "description": "Note id (or note_id in a JSON body).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deleted.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Deleted"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        },
        "/budgets.php": {
            "get": {
                "operationId": "getBudgets",
                "tags": [
                    "Budgets"
                ],
                "summary": "Budget status of a scan or URL, or the budgets of a project (paid plans)",
                "description": "With scan_id or url_id: pass or fail per budget, for CI gates. With fail_status=1 a failed check answers 409. With only project_id: the stored budgets and the ratchet log.",
                "parameters": [
                    {
                        "name": "scan_id",
                        "in": "query",
                        "required": false,
                        "description": "Check this scan.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "url_id",
                        "in": "query",
                        "required": false,
                        "description": "Check the latest scan of this URL.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "project_id",
                        "in": "query",
                        "required": false,
                        "description": "List budgets of this project.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "url",
                        "in": "query",
                        "required": false,
                        "description": "Limit the check to one URL of the scan.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fail_status",
                        "in": "query",
                        "required": false,
                        "description": "Answer 409 when a budget is over.",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Budget status, or the budget list with project_id.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/BudgetStatus"
                                        },
                                        {
                                            "$ref": "#/components/schemas/BudgetList"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "description": "fail_status=1 and at least one budget is over.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BudgetStatus"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            },
            "post": {
                "operationId": "setBudget",
                "tags": [
                    "Budgets"
                ],
                "summary": "Create, change or delete a budget (paid plans)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "project_id": {
                                        "type": "integer"
                                    },
                                    "url_id": {
                                        "type": "integer",
                                        "description": "Budget for one URL instead of the whole project."
                                    },
                                    "metric": {
                                        "type": "string",
                                        "enum": [
                                            "total_kb",
                                            "script_kb",
                                            "image_kb",
                                            "stylesheet_kb",
                                            "font_kb",
                                            "third_party_kb",
                                            "third_party_count",
                                            "request_count",
                                            "perf_score",
                                            "lab_lcp_ms",
                                            "tbt_ms",
                                            "lab_cls",
                                            "fcp_ms",
                                            "ttfb_ms",
                                            "field_lcp_ms",
                                            "field_inp_ms",
                                            "field_cls",
                                            "field_fcp_ms",
                                            "field_ttfb_ms"
                                        ],
                                        "description": "field_* metrics only for mobile."
                                    },
                                    "device": {
                                        "type": "string",
                                        "enum": [
                                            "mobile",
                                            "desktop"
                                        ],
                                        "default": "mobile"
                                    },
                                    "limit": {
                                        "oneOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "string"
                                            }
                                        ],
                                        "description": "Number in the metric unit or a string with unit such as \"1.5 MB\" or \"2.5 s\"."
                                    },
                                    "goal": {
                                        "oneOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "string"
                                            }
                                        ]
                                    },
                                    "ratchet": {
                                        "type": "boolean"
                                    },
                                    "ratchet_step": {
                                        "oneOf": [
                                            {
                                                "type": "string",
                                                "enum": [
                                                    "round"
                                                ]
                                            },
                                            {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 50
                                            }
                                        ]
                                    },
                                    "delete": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "project_id",
                                    "metric"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Saved budget, or deleted.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/Budget"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "deleted": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "deleted"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "PerfDelta API key, e.g. pdk_live_..."
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "Missing or invalid API key (error unauthorized). Header WWW-Authenticate: Bearer.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "email_unverified, plan_required (with required_plan and _meta.upgrade), token_scope or a plan limit such as url_limit_reached, competitor_limit, project_limit.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "Unknown or not readable id (not_found, unknown_project_id, unknown_url_id, url_not_found, ...).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "ValidationError": {
                "description": "Invalid input (missing_url, invalid_url, invalid_devices, invalid_region, invalid_metric, ...).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "TooManyRequests": {
                "description": "rate_limited (Retry-After: 60), too_many_failed_attempts, quota_exhausted (free scan window, with next_scan_at) or throttled.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Unavailable": {
                "description": "API temporarily disabled or no measuring capacity (disabled, busy, capacity_exhausted, free_capacity_exhausted).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "description": "Errors are flat: a code, usually a message, and further detail fields on the same level.",
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "required_plan": {
                        "type": "string"
                    },
                    "upgrade_url": {
                        "type": "string"
                    },
                    "retry_after": {
                        "type": "integer"
                    },
                    "next_scan_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "_meta": {
                        "$ref": "#/components/schemas/Meta"
                    }
                },
                "required": [
                    "error"
                ],
                "additionalProperties": true
            },
            "StatusNotFound": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "not_found"
                        ]
                    }
                },
                "required": [
                    "status"
                ]
            },
            "Meta": {
                "type": "object",
                "properties": {
                    "upgrade": {
                        "type": "object",
                        "properties": {
                            "reason": {
                                "type": "string"
                            },
                            "required_plan": {
                                "type": "string"
                            },
                            "unlocks": {
                                "type": "string"
                            },
                            "url": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Quota": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "rolling"
                        ]
                    },
                    "scans_used": {
                        "type": "integer"
                    },
                    "scans_limit": {
                        "type": "integer"
                    },
                    "scans_remaining": {
                        "type": "integer"
                    },
                    "window_hours": {
                        "type": "integer"
                    },
                    "next_scan_at": {
                        "anyOf": [
                            {
                                "type": "string",
                                "format": "date-time"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "Attribution": {
                "type": "object",
                "properties": {
                    "text": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    }
                }
            },
            "BudgetWarning": {
                "anyOf": [
                    {
                        "type": "object",
                        "properties": {
                            "used_pct": {
                                "type": "integer"
                            },
                            "upgrade_plan": {
                                "anyOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "upgrade_url": {
                                "type": "string"
                            }
                        }
                    },
                    {
                        "type": "null"
                    }
                ]
            },
            "ScanStarted": {
                "type": "object",
                "properties": {
                    "scan_id": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "running",
                            "done",
                            "error"
                        ]
                    },
                    "reused": {
                        "type": "boolean"
                    },
                    "devices": {
                        "type": "string"
                    },
                    "scope": {
                        "type": "string"
                    },
                    "measured_urls": {
                        "type": "integer"
                    },
                    "cost": {
                        "type": "integer"
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "budget_remaining": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "budget_warning": {
                        "$ref": "#/components/schemas/BudgetWarning"
                    },
                    "daily_remaining": {
                        "type": "integer"
                    },
                    "project_id": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "url_id": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "added_to_project": {
                        "type": "boolean"
                    },
                    "quota": {
                        "$ref": "#/components/schemas/Quota"
                    },
                    "attribution": {
                        "$ref": "#/components/schemas/Attribution"
                    }
                },
                "required": [
                    "scan_id",
                    "status"
                ]
            },
            "ScanStatus": {
                "type": "object",
                "properties": {
                    "scan_id": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "running",
                            "done",
                            "error"
                        ]
                    },
                    "started_at": {
                        "type": "string"
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "step": {
                        "type": "integer"
                    },
                    "step_total": {
                        "type": "integer"
                    },
                    "step_msg": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "mobile_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "desktop_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "measured_at": {
                        "type": "string"
                    },
                    "pages": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ScanPage"
                        }
                    }
                },
                "required": [
                    "scan_id",
                    "status"
                ]
            },
            "ScanPage": {
                "type": "object",
                "properties": {
                    "url": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "device": {
                        "type": "string"
                    },
                    "score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "lab": {
                        "anyOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "lcp_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "cls": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "fcp_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "tbt_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "ttfb_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    }
                                }
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "field": {
                        "anyOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "lcp_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "inp_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "cls": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "fcp_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "ttfb_ms": {
                                        "anyOf": [
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    }
                                }
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "engine": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "region": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "fallback_level": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "Usage": {
                "type": "object",
                "properties": {
                    "plan": {
                        "type": "string"
                    },
                    "unit": {
                        "type": "string"
                    },
                    "daily_limit": {
                        "type": "integer"
                    },
                    "daily_used": {
                        "type": "integer"
                    },
                    "daily_remaining": {
                        "type": "integer"
                    },
                    "monthly_budget": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "monthly_used": {
                        "type": "integer"
                    },
                    "monitoring_projected": {
                        "type": "integer"
                    },
                    "monitoring_remaining_need": {
                        "type": "integer"
                    },
                    "available_for_manual_scans": {
                        "type": "integer"
                    },
                    "monthly_used_pct": {
                        "type": "number"
                    },
                    "quota": {
                        "$ref": "#/components/schemas/Quota"
                    },
                    "upgrade_plan": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "upgrade_url": {
                        "type": "string"
                    },
                    "budget_warning": {
                        "$ref": "#/components/schemas/BudgetWarning"
                    }
                },
                "required": [
                    "plan"
                ]
            },
            "Report": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string"
                    },
                    "mobile_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "desktop_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "measured_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "scan_id": {
                        "type": "string"
                    },
                    "engine": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "region": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "fallback_level": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "mobile_measured_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "desktop_measured_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "latest_status": {
                        "type": "string"
                    },
                    "latest_started_at": {
                        "type": "string"
                    },
                    "competitors": {
                        "type": "object",
                        "additionalProperties": true
                    },
                    "trend": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "required": [
                    "status"
                ]
            },
            "Fixes": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string"
                    },
                    "measured_at": {
                        "type": "string"
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "platform": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "field": {
                        "type": "object",
                        "additionalProperties": true
                    },
                    "fixes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                },
                                "type": {
                                    "type": "string"
                                },
                                "resource": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ]
                                },
                                "title": {
                                    "type": "string"
                                },
                                "problem": {
                                    "type": "string"
                                },
                                "action": {
                                    "type": "string"
                                },
                                "metrics": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "fails_in_field": {
                                    "type": "boolean"
                                },
                                "basis": {
                                    "type": "string",
                                    "enum": [
                                        "lab",
                                        "field"
                                    ]
                                },
                                "impact": {
                                    "type": "object",
                                    "additionalProperties": true
                                },
                                "devices": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "pages": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "files": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "url": {
                                                "type": "string"
                                            },
                                            "wasted_bytes": {
                                                "anyOf": [
                                                    {
                                                        "type": "integer"
                                                    },
                                                    {
                                                        "type": "null"
                                                    }
                                                ]
                                            },
                                            "wasted_ms": {
                                                "anyOf": [
                                                    {
                                                        "type": "number"
                                                    },
                                                    {
                                                        "type": "null"
                                                    }
                                                ]
                                            },
                                            "estimated": {
                                                "type": "boolean"
                                            }
                                        },
                                        "additionalProperties": true
                                    }
                                },
                                "guide_url": {
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ]
                                }
                            },
                            "additionalProperties": true
                        }
                    }
                },
                "required": [
                    "status",
                    "fixes"
                ]
            },
            "Changes": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "done",
                            "no_baseline"
                        ]
                    },
                    "measured_at": {
                        "type": "string"
                    },
                    "previous_measured_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "page": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "device": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "scores": {
                        "type": "object",
                        "properties": {
                            "mobile": {
                                "anyOf": [
                                    {
                                        "type": "integer"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            },
                            "desktop": {
                                "anyOf": [
                                    {
                                        "type": "integer"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            }
                        }
                    },
                    "previous_scores": {
                        "anyOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "mobile": {
                                        "anyOf": [
                                            {
                                                "type": "integer"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "desktop": {
                                        "anyOf": [
                                            {
                                                "type": "integer"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    }
                                }
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "changes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "kind": {
                                    "type": "string"
                                },
                                "direction": {
                                    "type": "string"
                                },
                                "summary": {
                                    "type": "string"
                                }
                            },
                            "additionalProperties": true
                        }
                    },
                    "implemented": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                },
                "required": [
                    "status"
                ]
            },
            "ReportDetails": {
                "type": "object",
                "description": "Full report. Nested objects are documented on https://perfdelta.com/api-docs and may gain fields.",
                "properties": {
                    "scan_id": {
                        "type": "string"
                    },
                    "domain": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "measured_at": {
                        "type": "string"
                    },
                    "report_url": {
                        "type": "string"
                    },
                    "complete": {
                        "type": "boolean"
                    },
                    "summary": {
                        "type": "object",
                        "additionalProperties": true
                    },
                    "origin_field_data_phone": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "additionalProperties": true
                    },
                    "origin_field_data_desktop": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "additionalProperties": true
                    },
                    "competitors": {
                        "type": [
                            "array",
                            "object",
                            "null"
                        ]
                    },
                    "pages": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "third_party_recommendations": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "tech_stack": {
                        "type": [
                            "array",
                            "object",
                            "null"
                        ]
                    },
                    "ai_readiness": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "additionalProperties": true
                    },
                    "delivery": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "additionalProperties": true
                    },
                    "ai_recommendations": {
                        "type": "array"
                    },
                    "notes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Note"
                        }
                    },
                    "history": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                },
                "required": [
                    "scan_id",
                    "status"
                ],
                "additionalProperties": true
            },
            "HistoryEntry": {
                "type": "object",
                "properties": {
                    "hash": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "mobile_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "desktop_score": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "engine": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "region": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "fallback_level": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "ProjectUrl": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string"
                    },
                    "monitoring_enabled": {
                        "type": "boolean"
                    },
                    "last_monitored_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "within_plan_limit": {
                        "type": "boolean"
                    }
                }
            },
            "UrlSuggestions": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string"
                    },
                    "site": {
                        "type": "string"
                    },
                    "source": {
                        "type": "string"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "url_limit": {
                        "type": "integer"
                    },
                    "url_count": {
                        "type": "integer"
                    },
                    "free_slots": {
                        "type": "integer"
                    },
                    "preselected": {
                        "type": "integer"
                    },
                    "urls": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string"
                                },
                                "group": {
                                    "type": "string"
                                },
                                "in_project": {
                                    "type": "boolean"
                                },
                                "preselected": {
                                    "type": "boolean"
                                },
                                "field_data": {
                                    "type": [
                                        "object",
                                        "boolean",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                },
                "additionalProperties": true
            },
            "UrlsAdded": {
                "type": "object",
                "properties": {
                    "added": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "url": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "skipped": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string"
                                },
                                "reason": {
                                    "type": "string",
                                    "enum": [
                                        "invalid_url",
                                        "duplicate",
                                        "url_limit_reached"
                                    ]
                                }
                            }
                        }
                    }
                },
                "required": [
                    "added",
                    "skipped"
                ]
            },
            "Note": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "note": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    }
                }
            },
            "Deleted": {
                "type": "object",
                "properties": {
                    "deleted": {
                        "type": [
                            "integer",
                            "boolean"
                        ]
                    }
                },
                "required": [
                    "deleted"
                ]
            },
            "Budget": {
                "type": "object",
                "properties": {
                    "project_id": {
                        "type": "integer"
                    },
                    "url_id": {
                        "anyOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "metric": {
                        "type": "string"
                    },
                    "device": {
                        "type": "string"
                    },
                    "unit": {
                        "type": "string"
                    },
                    "limit": {
                        "type": "number"
                    },
                    "goal": {
                        "anyOf": [
                            {
                                "type": "number"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "ratchet": {
                        "type": "object",
                        "properties": {
                            "enabled": {
                                "type": "boolean"
                            },
                            "step": {
                                "oneOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "integer"
                                    }
                                ]
                            },
                            "next_check": {
                                "anyOf": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ]
                            }
                        }
                    }
                }
            },
            "BudgetStatus": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "scan_id": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "measured_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "report_url": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "done",
                            "running",
                            "no_budgets"
                        ]
                    },
                    "passed": {
                        "type": [
                            "boolean",
                            "null"
                        ]
                    },
                    "summary": {
                        "type": "object",
                        "properties": {
                            "over": {
                                "type": "integer"
                            },
                            "ok": {
                                "type": "integer"
                            },
                            "warn": {
                                "type": "integer"
                            },
                            "no_data": {
                                "type": "integer"
                            }
                        }
                    },
                    "urls": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                },
                "required": [
                    "status"
                ]
            },
            "BudgetList": {
                "type": "object",
                "properties": {
                    "project_id": {
                        "type": "integer"
                    },
                    "budgets": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "ratchet_log": {
                        "type": "array",
                        "maxItems": 50,
                        "items": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    },
                    "metrics": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "project_id",
                    "budgets"
                ]
            }
        }
    }
}