{
  "openapi": "3.1.0",
  "info": {
    "title": "Time to Power site registry",
    "version": "0.9.0",
    "description": "Capacity and density screening for existing AI data halls. Generated from the engine's own tool list. Screening-mode output: not an issued engineering opinion. The deployed engine serves 23 endpoints; this document describes 22 of them plus /mcp. /v1/revoke is operator-only and deliberately undocumented. It does not quote equipment, state megawatts available from a utility, or act as an EPC, utility or trader. gridforge_qualify and gridforge_estimate are free and need no key. Everything else meters. Every figure is modelled from the inputs supplied and carries an evidence class; where the calibration block (GET /v1/calibration, and on the responses that carry it) says uncalibrated, it means uncalibrated. This document states no price: it gives each operation's weight in units, and the unit price, free allowance, minimum invoice and cap behaviour are the engine's own `payg` object at GET /v1/version. Send an Idempotency-Key header (at most 150 characters) on a POST, or on an /mcp tools/call. A longer key is refused: HTTP 400 on REST; over /mcp, JSON-RPC error -32602 with data.status 400 inside an HTTP 200. It takes effect only on a request that carries a valid API key, and never on /v1/estimate: a keyless call to a free operation is not deduplicated. The key is scoped to your account and to the endpoint (over /mcp, the tool's endpoint), so the same string on another endpoint is a different request. For 24 hours after the first successful answer, a retry with the same key and the same body is answered with that first result and is not charged again; the replay carries X-GridForge-Idempotent-Replay: true (also sent as Idempotent-Replay: true) and its units are 0. \"The same body\" is exact: on REST it is the same bytes, so a re-indented or re-ordered JSON body is a different body; over /mcp it is the same arguments in any key order. The same key with a different body is refused and nothing runs: HTTP 422 on REST; over /mcp, JSON-RPC error -32602 with data.status 422 inside an HTTP 200. In an /mcp batch each message is keyed as <key>#<position in the batch>; a batch that mixes replays with new messages carries X-GridForge-Idempotent-Replay: true at the HTTP level, and X-GridForge-Units is the units actually charged for its new messages, not 0. Only a successful answer is remembered: a refused or failed call was refunded, so retrying it runs it afresh. If the stored answer has been evicted from the engine's memory, or the engine has restarted, the engine recomputes it and still does not charge twice only when it keeps its ledger durably (GET /v1/version reports metering.ledger_durable: true; keys with a spending cap or a free allowance are refused with 503 without one). Without a durable ledger such a retry is a new, charged request. A recomputed answer is the same except for date-stamped fields (a generated date, provenance.report_date) and the code digest if the engine was redeployed inside the window. A replay still counts toward the rate limit. After 24 hours the key is forgotten and a repeat is a new, chargeable request. The paths under /api/orgs, /api/sites and /api/halls are the website's signed-in site and hall registry: they are served by the website (see each path's server), require a confirmed signed-in person's session token instead of an API key, and are never engine-metered. A 503 signals a server-side configuration, dependency or required-schema failure; it is not the normal state of these routes."
  },
  "servers": [
    {
      "url": "https://timetopower.ai",
      "description": "The website (not the engine)."
    }
  ],
  "paths": {
    "/api/orgs": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "listOrganisations",
        "summary": "The organisations the signed-in caller belongs to, with their role in each.",
        "responses": {
          "200": {
            "description": "The caller's organisations.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "orgs"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "orgs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Organisation"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "post": {
        "operationId": "createOrganisation",
        "summary": "Register an organisation; the caller becomes its owner.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "org"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "org": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/orgs/{id}/members": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "listOrganisationMembers",
        "summary": "Who is in the organisation. Any member may read.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The active members.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "members"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a valid id.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "post": {
        "operationId": "addOrganisationMember",
        "summary": "Add a person by the address they sign in with. Owners only. Nothing is emailed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "role"
                ],
                "additionalProperties": false,
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "billing",
                      "editor",
                      "viewer"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Added.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "memberId"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "memberId": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "delete": {
        "operationId": "removeOrganisationMember",
        "summary": "An owner removes a member, or anyone removes themselves. The last owner can never be removed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The organisation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "The membership to close (a member's `id`, or the caller's own `memberId`).",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed. `sessionsClosed: false` appears only when the membership was closed but the member's command-line and Cloud Shell sessions could not be: they stay valid until their keys expire.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "sessionsClosed": {
                      "type": "boolean",
                      "enum": [
                        false
                      ],
                      "description": "Present, and false, only when those sessions could not be closed."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/sites": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "listSites",
        "summary": "The sites, with their halls, of every organisation the caller belongs to, or of one of them.",
        "parameters": [
          {
            "name": "org",
            "in": "query",
            "required": false,
            "description": "Limit to one organisation.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The sites.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "sites"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "sites": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Site"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a valid id.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "post": {
        "operationId": "createSite",
        "summary": "Add a site to an organisation. Editors and owners. `dataOrigin` is required and is fixed once written.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "orgId",
                  "name",
                  "dataOrigin"
                ],
                "additionalProperties": false,
                "properties": {
                  "orgId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "dataOrigin": {
                    "type": "string",
                    "enum": [
                      "production",
                      "test",
                      "synthetic"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "site"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "site": {
                      "$ref": "#/components/schemas/Site"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/sites/{id}/halls": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "listHalls",
        "summary": "The site and its halls. Any member of the site's organisation.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The site.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The site and its halls.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "site",
                    "halls"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "site": {
                      "$ref": "#/components/schemas/Site"
                    },
                    "halls": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Hall"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a valid id.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "post": {
        "operationId": "createHall",
        "summary": "Add a hall to a site. Editors and owners.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The site.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "label"
                ],
                "additionalProperties": false,
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "hall"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "hall": {
                      "$ref": "#/components/schemas/Hall"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/halls/{id}/inputs": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "listHallInputs",
        "summary": "The hall's current recorded figures, or (history=1) every claim ever made, newest first.",
        "description": "A field nobody has recorded is simply not listed. Each figure carries its declared origin and evidence class, its date, its source label and who recorded it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The hall.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "history",
            "in": "query",
            "required": false,
            "description": "1 or true: every claim, including replaced ones, newest first, bounded.",
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "true"
              ]
            }
          },
          {
            "name": "field",
            "in": "query",
            "required": false,
            "description": "With history: one dotted field path.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 500; default 500.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The figures.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "hall",
                    "inputs",
                    "truncated",
                    "history"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "hall": {
                      "type": "object"
                    },
                    "inputs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/HallInput"
                      }
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "More claims exist than were returned."
                    },
                    "history": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a valid id or field path.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "post": {
        "operationId": "recordHallInput",
        "summary": "Append one claim about a field. Nothing is overwritten: a correction names the claim it replaces (`supersedes`). Editors and owners.",
        "description": "Origin and class are the recorder's declaration. The database refuses the combinations that would let a declared figure pass for a measured one: a measured, observed or quoted figure needs a source file; an assumed or modelled one cannot claim above E3; a missing figure has no value, no source and class E0; a class above E3 needs a reviewed and verified project file.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The hall.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "fieldPath",
                  "value",
                  "evidenceClass",
                  "origin",
                  "asOf"
                ],
                "additionalProperties": false,
                "properties": {
                  "fieldPath": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "value": {
                    "type": [
                      "number",
                      "string",
                      "boolean",
                      "null"
                    ]
                  },
                  "unit": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 24
                  },
                  "evidenceClass": {
                    "type": "string",
                    "enum": [
                      "E0",
                      "E1",
                      "E2",
                      "E3",
                      "E4",
                      "E5",
                      "E6",
                      "E7"
                    ]
                  },
                  "origin": {
                    "type": "string",
                    "enum": [
                      "measured",
                      "observed",
                      "vendor",
                      "quotation",
                      "modelled",
                      "assumed",
                      "missing"
                    ]
                  },
                  "projectEvidenceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "intakeEvidenceFileId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  },
                  "asOf": {
                    "type": "string",
                    "format": "date"
                  },
                  "supersedes": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Recorded.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "id",
                    "input"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "input": {
                      "$ref": "#/components/schemas/HallInput"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The request conflicts with what is recorded (a name already used, a limit reached, a figure corrected first by someone else). `reason` says which.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "422": {
            "description": "The cited file or earlier figure cannot be used for this hall (it does not exist, is not this hall's, or was reviewed and rejected).",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/halls/{id}/timeline": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "get": {
        "operationId": "getHallTimeline",
        "summary": "What happened at the hall, newest first: figures recorded, the log of its attached projects, supplier delivery dates and observations submitted.",
        "description": "Read only. Every event says what it is and what stands behind it. No project link token, storage location or log payload is in it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The hall.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 500; default 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` of the previous page, passed back verbatim. It is opaque: do not parse or construct it.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 600
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of events.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "hall",
                    "truncated",
                    "nextCursor",
                    "events"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "hall": {
                      "type": "object"
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Null on the last page."
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimelineEvent"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a valid id, or the cursor is not valid (reason invalid_cursor): start again from the newest.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such item. A person who is not a member of the organisation gets exactly this answer, so nothing is learned about what exists.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    },
    "/api/halls/{id}/projects": {
      "servers": [
        {
          "url": "https://timetopower.ai",
          "description": "The website (not the engine)."
        }
      ],
      "post": {
        "operationId": "attachProjectToHall",
        "summary": "Attach an existing project to the hall by its link token. Editors and owners.",
        "description": "The project's link token is the credential for that engagement and is never returned. Attaching makes the project's history, supplier dates and observations appear on the hall's timeline, and writes a project_attached_to_hall event to the project's own log. A project is in at most one hall at a time. A project attached to a test or synthetic site is not eligible for the calibration ledger, and that is permanent: attaching to such a site is refused with 422 unless the request carries confirmNonProductionSite: true. That confirmation is enforced by this route, not by the database function (the calibration ledger gate is the backstop behind it).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The hall.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "projectToken"
                ],
                "additionalProperties": false,
                "properties": {
                  "projectToken": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  },
                  "confirmNonProductionSite": {
                    "type": "boolean",
                    "description": "Must be exactly true to attach to a hall whose site is test or synthetic; it changes nothing for a production site. Any other type is a 400."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The project was already attached to this hall.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "projectId",
                    "projectName",
                    "alreadyAttached"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "projectId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "projectName": {
                      "type": "string"
                    },
                    "alreadyAttached": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Attached.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "projectId",
                    "projectName",
                    "alreadyAttached"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "projectId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "projectName": {
                      "type": "string"
                    },
                    "alreadyAttached": {
                      "type": "boolean",
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such hall, or no project has that link token.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "409": {
            "description": "The project already belongs to another hall; it has to be detached from it first (reason project_in_other_hall).",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "422": {
            "description": "The hall's site is test or synthetic and the request did not carry confirmNonProductionSite: true (reason non_production_site_unconfirmed; the body also names dataOrigin). Attaching a project to a test or synthetic site PERMANENTLY excludes its observations from the calibration ledger; detaching does not undo it. Nothing was written. Send true to confirm.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      },
      "delete": {
        "operationId": "detachProjectFromHall",
        "summary": "Take a project out of the hall. Owners only. Recorded, and logged in the project's own log.",
        "description": "The hall's timeline stops showing the project's log from then on; the attachment and this detachment stay in the history. The project can then be attached to another hall.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The hall.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "project",
            "in": "query",
            "required": true,
            "description": "The project's id (not its link token).",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detached.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body, an id or a query value is not valid. Names the fields that are wrong (issues[].field, message) and never echoes their values.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "401": {
            "description": "No valid sign-in, or the session has expired. Sign in again.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "403": {
            "description": "The address on the session has not been confirmed (sign in with the emailed link), or the caller's role in the organisation does not allow this.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "404": {
            "description": "No such hall, or the project is not attached to it.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 8 KiB.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "429": {
            "description": "The per-account request allowance was exceeded; wait and retry. Counted per verified account, not per network address.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          },
          "503": {
            "description": "Server-side failure: the registry's Supabase configuration, Auth service, PostgREST store, required RPC/schema, or fail-closed request counter is unavailable or returned an invalid response. Nothing was changed.",
            "headers": {
              "Cache-Control": {
                "description": "Always no-store: every answer is for one signed-in person.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "no-store"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryError"
                }
              }
            }
          }
        },
        "tags": [
          "registry"
        ],
        "security": [
          {
            "SupabaseSession": []
          }
        ]
      }
    }
  },
  "components": {
    "headers": {
      "x-request-id": {
        "description": "Correlation identifier for this request, echoed or generated for tracing and error diagnostics.",
        "schema": {
          "type": "string",
          "maxLength": 64
        }
      },
      "X-GridForge-Units": {
        "description": "Units this request was weighted at (0 on an idempotent replay).",
        "schema": {
          "type": "string"
        }
      },
      "X-GridForge-Units-Month": {
        "description": "Units used so far this UTC month, counted against this key's own scope (free allowance, pay-as-you-go cap or plan).",
        "schema": {
          "type": "string"
        }
      },
      "X-GridForge-Units-Remaining": {
        "description": "Units left under the cap or plan allowance for the month. Present only when the key has one.",
        "schema": {
          "type": "string"
        }
      },
      "X-GridForge-Charge-Cents": {
        "description": "Pay-as-you-go keys only: what this request adds to the invoice, in cents.",
        "schema": {
          "type": "string"
        }
      },
      "X-GridForge-Key-Expires": {
        "description": "Present when the key has an expiry date.",
        "schema": {
          "type": "string"
        }
      },
      "X-GridForge-Idempotent-Replay": {
        "description": "\"true\" when the response is a replay of an earlier request with the same Idempotency-Key. The engine also sends the same value as Idempotent-Replay.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Per-window request ceiling (see rate_limit_per_minute at GET /v1/version).",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests remaining in the current window.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the current rate-limit window resets.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "Deprecation": {
        "description": "RFC 9745 structured deprecation timestamp (@<unix-epoch>) present only when an operation is deprecated.",
        "schema": {
          "type": "string"
        }
      },
      "Sunset": {
        "description": "RFC 8594 HTTP-date indicating the earliest removal date (at least 90 days after deprecation), present only when scheduled.",
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "The key goes in X-API-Key; the engine also accepts the same key as Authorization: Bearer <key>."
      },
      "SupabaseSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "The access token of a signed-in session whose email address is confirmed. The caller's address is read from the token, never from a request."
      }
    },
    "schemas": {
      "RegistryError": {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "A short stable code for the refusal, for example name_taken, last_owner, superseded, invalid_reference."
          },
          "currentId": {
            "type": "string",
            "format": "uuid",
            "description": "On a refused correction: the figure that replaced the one named."
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Organisation": {
        "type": "object",
        "required": [
          "id",
          "name",
          "role",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "billing",
              "editor",
              "viewer"
            ],
            "description": "The caller's role in it."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "memberId": {
            "type": "string",
            "format": "uuid",
            "description": "The caller's own membership, the id to pass to DELETE .../members?id= to leave."
          },
          "addedBy": {
            "type": "string",
            "description": "Who added the caller. There is no acceptance step: an owner adds an address and its holder is a member when they next sign in."
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "An organisation is a group of people who share a registry. It is NOT a billing entity and is unrelated to a subscription's seats."
      },
      "Member": {
        "type": "object",
        "required": [
          "id",
          "email",
          "role",
          "addedBy",
          "addedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "billing",
              "editor",
              "viewer"
            ]
          },
          "addedBy": {
            "type": "string"
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Hall": {
        "type": "object",
        "required": [
          "id",
          "siteId",
          "label",
          "createdBy",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "label": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Site": {
        "type": "object",
        "required": [
          "id",
          "orgId",
          "name",
          "country",
          "dataOrigin"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "orgId": {
            "type": "string",
            "format": "uuid"
          },
          "orgName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Z]{2}$"
          },
          "dataOrigin": {
            "type": "string",
            "enum": [
              "production",
              "test",
              "synthetic"
            ],
            "description": "What KIND of data the site holds, declared by whoever created it and fixed once written. It is a declaration, not verified. A project attached to a test or synthetic site is kept out of the calibration ledger."
          },
          "createdBy": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "halls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Hall"
            }
          }
        }
      },
      "HallInput": {
        "type": "object",
        "required": [
          "id",
          "fieldPath",
          "value",
          "unit",
          "evidenceClass",
          "origin",
          "asOf",
          "recordedBy",
          "recordedAt",
          "supersedesId",
          "superseded",
          "source"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "fieldPath": {
            "type": "string",
            "description": "A dotted lower-case path such as grid.firm_capacity_mva."
          },
          "value": {
            "type": [
              "number",
              "string",
              "boolean",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceClass": {
            "type": "string",
            "enum": [
              "E0",
              "E1",
              "E2",
              "E3",
              "E4",
              "E5",
              "E6",
              "E7"
            ],
            "description": "As DECLARED by the recorder. The database enforces the rules between origin and class; nothing verifies that a declared class is deserved."
          },
          "origin": {
            "type": "string",
            "enum": [
              "measured",
              "observed",
              "vendor",
              "quotation",
              "modelled",
              "assumed",
              "missing"
            ],
            "description": "Where the figure came from, as declared by the recorder."
          },
          "asOf": {
            "type": "string",
            "format": "date"
          },
          "recordedBy": {
            "type": "string"
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          },
          "supersedesId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "superseded": {
            "type": "boolean"
          },
          "source": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "project_evidence",
                  "intake_evidence"
                ]
              },
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "filename": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reviewStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The file's review status now, read live."
              }
            }
          }
        }
      },
      "TimelineEvent": {
        "type": "object",
        "required": [
          "occurredAt",
          "kind",
          "subject",
          "summary",
          "origin",
          "basis",
          "actor",
          "superseded",
          "sourceTable",
          "sourceId"
        ],
        "properties": {
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "description": "input_recorded, project_event, supplier_date, observation or project_attached."
          },
          "subject": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "origin": {
            "type": "string"
          },
          "evidenceClass": {
            "type": [
              "string",
              "null"
            ]
          },
          "basis": {
            "type": "string",
            "description": "What stands behind the event, in words. Nothing appears without one."
          },
          "actor": {
            "type": "string"
          },
          "projectId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "superseded": {
            "type": "boolean"
          },
          "sourceTable": {
            "type": "string"
          },
          "sourceId": {
            "type": "string"
          }
        }
      },
      "CalibrationBlock": {
        "type": "object",
        "description": "How far the engine has been reconciled against instrumented sites, carried on the responses that name it. Where `state` is uncalibrated, it means uncalibrated: the figures are modelled and their accuracy is unquantified.",
        "required": [
          "state",
          "statement"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "uncalibrated",
              "indicative",
              "calibrated"
            ]
          },
          "statement": {
            "type": "string"
          },
          "observations": {
            "type": "integer"
          },
          "observations_total": {
            "type": "integer"
          },
          "observations_without_source_ref": {
            "type": "integer"
          },
          "sites": {
            "type": "integer"
          },
          "halls": {
            "type": "integer"
          },
          "keys_asserted": {
            "type": "integer"
          },
          "keys_with_site_observations": {
            "type": "integer"
          },
          "keys_calibrated": {
            "type": "integer"
          },
          "coverage": {
            "type": "number"
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "uncalibrated_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "AssumptionGap": {
        "type": "object",
        "description": "One input the request did not supply and what the engine assumed in its place.",
        "required": [
          "path",
          "input",
          "unit",
          "required",
          "assumed",
          "why_it_binds",
          "how_to_get_it"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "input": {
            "type": "string"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "assumed": {
            "type": "string",
            "description": "What the engine used instead, in words."
          },
          "why_it_binds": {
            "type": "string"
          },
          "how_to_get_it": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "schema_version": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "On a 402: free_allowance_exhausted, spending_cap_reached or plan_quota_exhausted."
          },
          "request_id": {
            "type": "string",
            "description": "Correlation identifier when present."
          },
          "units_required": {
            "type": "integer"
          },
          "units_used": {
            "type": "integer"
          },
          "monthly_quota": {
            "type": "integer"
          },
          "cap_units": {
            "type": "integer"
          },
          "month": {
            "type": "string"
          },
          "resets_at": {
            "type": "string",
            "format": "date-time",
            "description": "On a 402: when the allowance renews (start of next UTC month)."
          },
          "fix": {
            "type": "string",
            "description": "What to do next, in words."
          },
          "retryable": {
            "type": "boolean"
          }
        },
        "additionalProperties": true
      },
      "Error401": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ],
        "description": "401 Unauthorized — missing, unrecognised, expired, or revoked API key.",
        "example": {
          "schema_version": "gridforge/api/1",
          "error": "an API key is required for this endpoint",
          "public_endpoint": "/v1/qualify",
          "tool_schemas": "/v1/tools"
        }
      },
      "Error402": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ],
        "description": "402 Payment Required — monthly allowance, prepaid credits, or spend cap reached.",
        "example": {
          "schema_version": "gridforge/api/1",
          "error": "monthly unit allowance reached",
          "reason": "spending_cap_reached",
          "units_required": 5,
          "units_used": 25,
          "cap_units": 25,
          "retryable": false
        }
      },
      "Error409": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ],
        "description": "409 Conflict — action conflicts with current readiness or resource state.",
        "example": {
          "schema_version": "gridforge/api/1",
          "error": "'GRID + GENERATION' is not RFQ-ready; no RFQ was prepared",
          "blocking": [
            "reliability"
          ]
        }
      },
      "Error422": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ],
        "description": "422 Unprocessable Entity — invalid input figure, out-of-bounds value, or Idempotency-Key body mismatch.",
        "example": {
          "schema_version": "gridforge/api/1",
          "error": "this Idempotency-Key was already used with a different request body"
        }
      },
      "Error429": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ],
        "description": "429 Too Many Requests — per-caller rate limit exceeded.",
        "example": {
          "schema_version": "gridforge/api/1",
          "error": "rate limit exceeded",
          "limit_per_minute": 30
        }
      }
    }
  }
}