{
  "openapi": "3.1.1",
  "info": {
    "title": "BuildAPC private library API",
    "version": "1.0.0",
    "description": "Owner-private preview. Stable v1 resource/portable formats; production origin and actual native visitor integration remain pending. No server-issued API credentials, permissive CORS or service-token impersonation. Normalized schemas are structural documentation; server semantic validation remains authoritative."
  },
  "servers": [
    {
      "url": "/",
      "description": "Current Site origin. No production canonical domain has been selected."
    }
  ],
  "paths": {
    "/api/v1/library": {
      "get": {
        "operationId": "readPrivateLibraryV1",
        "summary": "Export the signed-in visitor’s portable library",
        "description": "Requires native Sites visitor sign-in. Use normal top-level sign-in and same-origin requests; the app issues no API key. Never copy cookies or use a Site service bearer as visitor identity. The response body is directly importable buildapc-library v1 JSON, not an account envelope. Cache-Control is private,no-store. Unknown references/dates remain context, never certified compatibility or live prices.",
        "x-native-sites-identity-required": true,
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Optional read condition. Matching weak/strong tags or * produce304 without a body."
          },
          {
            "name": "If-Match",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Optional read condition; a failed strong comparison produces412."
          }
        ],
        "responses": {
          "200": {
            "description": "Normalized private portable library.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Library"
                }
              }
            },
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque strong resource tag, bound to native principal, revision and canonical JSON."
              },
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "304": {
            "description": "Unchanged private representation; no response body.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque strong resource tag, bound to native principal, revision and canonical JSON."
              },
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "400": {
            "description": "Invalid JSON, format, immutable version or malformed condition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Native signed-in visitor identity required. Site service bearer access does not supply it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Exact Origin and explicit write intent required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Signed-in account changed; reload and review the destination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Entity-tag precondition failed or a concurrent save won. Keep both copies and reload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "428": {
            "description": "Concrete current ETag is required for writes. Wildcard blind replacement is not supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-principal quota exhausted. Deletion has a separate quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until retry; do not retry automatically."
              }
            }
          },
          "503": {
            "description": "Storage unavailable. Keep the pending/local copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headPrivateLibraryV1",
        "summary": "Read private library metadata without a body",
        "description": "Requires native Sites visitor sign-in. Use normal top-level sign-in and same-origin requests; the app issues no API key. Never copy cookies or use a Site service bearer as visitor identity. The response body is directly importable buildapc-library v1 JSON, not an account envelope. Cache-Control is private,no-store. Unknown references/dates remain context, never certified compatibility or live prices.",
        "x-native-sites-identity-required": true,
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Optional read condition. Matching weak/strong tags or * produce304 without a body."
          },
          {
            "name": "If-Match",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Optional read condition; a failed strong comparison produces412."
          }
        ],
        "responses": {
          "200": {
            "description": "Normalized private portable library.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque strong resource tag, bound to native principal, revision and canonical JSON."
              },
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "304": {
            "description": "Unchanged private representation; no response body.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Opaque strong resource tag, bound to native principal, revision and canonical JSON."
              },
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "400": {
            "description": "Invalid JSON, format, immutable version or malformed condition."
          },
          "401": {
            "description": "Native signed-in visitor identity required. Site service bearer access does not supply it."
          },
          "403": {
            "description": "Exact Origin and explicit write intent required."
          },
          "409": {
            "description": "Signed-in account changed; reload and review the destination."
          },
          "412": {
            "description": "Entity-tag precondition failed or a concurrent save won. Keep both copies and reload."
          },
          "428": {
            "description": "Concrete current ETag is required for writes. Wildcard blind replacement is not supported."
          },
          "429": {
            "description": "Per-principal quota exhausted. Deletion has a separate quota.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until retry; do not retry automatically."
              }
            }
          },
          "503": {
            "description": "Storage unavailable. Keep the pending/local copy."
          }
        }
      },
      "put": {
        "description": "Requires native Sites visitor sign-in. Use normal top-level sign-in and same-origin requests; the app issues no API key. Never copy cookies or use a Site service bearer as visitor identity. Requires explicit reviewed library data. Saves are normalized and retain immutable version IDs. Read again after a write to obtain the new strong ETag; successful mutation receipts do not carry an ETag.",
        "x-native-sites-identity-required": true,
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact request origin."
          },
          {
            "name": "X-BuildAPC-Intent",
            "in": "header",
            "required": true,
            "schema": {
              "const": "sync"
            }
          },
          {
            "name": "X-BuildAPC-Account",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "description": "Account pin from the last GET; not an authentication credential."
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Concrete opaque ETag from GET; weak tags do not satisfy strong comparison and * is rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Mutation receipt; GET again for the new representation/tag.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteReceipt"
                }
              }
            },
            "headers": {
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "408": {
            "description": "Upload deadline exceeded. Reload before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Raw request body exceeds1500000UTF-8 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, format, immutable version or malformed condition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Native signed-in visitor identity required. Site service bearer access does not supply it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Exact Origin and explicit write intent required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Signed-in account changed; reload and review the destination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Entity-tag precondition failed or a concurrent save won. Keep both copies and reload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "428": {
            "description": "Concrete current ETag is required for writes. Wildcard blind replacement is not supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-principal quota exhausted. Deletion has a separate quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until retry; do not retry automatically."
              }
            }
          },
          "503": {
            "description": "Storage unavailable. Keep the pending/local copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "replacePrivateLibraryV1",
        "summary": "Save an explicitly reviewed private library",
        "requestBody": {
          "required": true,
          "description": "1500000 raw UTF-8 bytes maximum. Schema describes normalized portable output; accepted input may omit default fields. The server normalizes, drops unknown properties and applies additional date, size, duplicate-ID, quantity and immutable-version checks.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Library"
              },
              "example": {
                "format": "buildapc-library",
                "version": 1,
                "builds": []
              }
            }
          }
        }
      },
      "delete": {
        "description": "Requires native Sites visitor sign-in. Use normal top-level sign-in and same-origin requests; the app issues no API key. Never copy cookies or use a Site service bearer as visitor identity. Erases library builds/versions/notes only. Community data and browser/downloaded copies are separate. Opaque account/revision and expiring quota counters remain; deletion does not reset quotas. Expired counter rows are removed in bounded batches on subsequent API requests.",
        "x-native-sites-identity-required": true,
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact request origin."
          },
          {
            "name": "X-BuildAPC-Intent",
            "in": "header",
            "required": true,
            "schema": {
              "const": "sync"
            }
          },
          {
            "name": "X-BuildAPC-Account",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "description": "Account pin from the last GET; not an authentication credential."
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Concrete opaque ETag from GET; weak tags do not satisfy strong comparison and * is rejected."
          }
        ],
        "responses": {
          "200": {
            "description": "Mutation receipt; GET again for the new representation/tag.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteReceipt"
                }
              }
            },
            "headers": {
              "X-BuildAPC-Account": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-secret Site-scoped account hash; required to pin a write destination."
              },
              "X-BuildAPC-Revision": {
                "schema": {
                  "type": "string"
                },
                "description": "Monotonic revision; deletion leaves a minimal fence."
              },
              "X-BuildAPC-Updated-At": {
                "schema": {
                  "type": "string"
                },
                "description": "Last content mutation time when a persisted record exists."
              },
              "X-BuildAPC-API-Version": {
                "schema": {
                  "type": "string"
                },
                "description": "1"
              },
              "X-BuildAPC-Rate-Limit": {
                "schema": {
                  "type": "string"
                },
                "description": "Requests in this method family per fixed window."
              },
              "X-BuildAPC-Rate-Remaining": {
                "schema": {
                  "type": "string"
                },
                "description": "Remaining requests in this window."
              },
              "X-BuildAPC-Rate-Reset": {
                "schema": {
                  "type": "string"
                },
                "description": "Window reset as Unix seconds."
              },
              "X-BuildAPC-Rate-Scope": {
                "schema": {
                  "type": "string"
                },
                "description": "read, save or erase"
              }
            }
          },
          "408": {
            "description": "Upload deadline exceeded. Reload before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Raw request body exceeds1500000UTF-8 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, format, immutable version or malformed condition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Native signed-in visitor identity required. Site service bearer access does not supply it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Exact Origin and explicit write intent required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Signed-in account changed; reload and review the destination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "Entity-tag precondition failed or a concurrent save won. Keep both copies and reload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "428": {
            "description": "Concrete current ETag is required for writes. Wildcard blind replacement is not supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-principal quota exhausted. Deletion has a separate quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until retry; do not retry automatically."
              }
            }
          },
          "503": {
            "description": "Storage unavailable. Keep the pending/local copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "erasePrivateLibraryV1",
        "summary": "Erase library content and fence stale saves"
      }
    }
  },
  "components": {
    "schemas": {
      "Draft": {
        "type": "object",
        "properties": {
          "version": {
            "const": 1
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 16
                },
                "owned_quantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 16,
                  "description": "Must not exceed quantity; server semantic validation applies."
                },
                "manual_amount": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "manual_currency": {
                  "type": "string",
                  "enum": [
                    "USD",
                    "EUR",
                    "GBP",
                    "CAD",
                    "AUD",
                    "JPY"
                  ]
                },
                "manual_condition": {
                  "enum": [
                    "new",
                    "used",
                    "refurbished",
                    "unknown"
                  ]
                },
                "manual_entered_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 40,
                      "description": "A parseable original user-entry date, retained without treating it as current."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "offer_id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                }
              },
              "required": [
                "id",
                "quantity",
                "owned_quantity",
                "manual_amount",
                "manual_currency",
                "manual_condition",
                "manual_entered_at"
              ],
              "additionalProperties": false
            },
            "maxItems": 32
          },
          "extras": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 99
                },
                "owned_quantity": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 99,
                  "description": "Must not exceed quantity."
                },
                "amount": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "type": "string",
                  "enum": [
                    "USD",
                    "EUR",
                    "GBP",
                    "CAD",
                    "AUD",
                    "JPY"
                  ]
                },
                "entered_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "Original parseable user-entry date, retained without asserting current validity."
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "quantity",
                "owned_quantity",
                "amount",
                "currency",
                "entered_at"
              ],
              "additionalProperties": false
            },
            "maxItems": 20
          },
          "profile": {
            "type": "object",
            "properties": {
              "budget": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "workload": {
                "enum": [
                  null,
                  "gaming",
                  "productivity"
                ]
              }
            },
            "required": [
              "budget",
              "workload"
            ],
            "additionalProperties": false
          },
          "layout": {
            "type": "object",
            "properties": {
              "front": {
                "enum": [
                  "stock",
                  "front_radiator",
                  "unknown"
                ]
              },
              "gpu_clearance_mm": {
                "anyOf": [
                  {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "extra_watts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000
              },
              "headroom_percent": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              }
            },
            "required": [
              "front",
              "gpu_clearance_mm",
              "extra_watts",
              "headroom_percent"
            ],
            "additionalProperties": false
          },
          "costs": {
            "type": "object",
            "properties": {
              "shipping_amount": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tax_mode": {
                "enum": [
                  "unknown",
                  "amount",
                  "percent"
                ]
              },
              "tax_value": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "When tax_mode=percent, the server requires a value <=100.00."
              },
              "extra_amount": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "discount_kind": {
                "enum": [
                  "none",
                  "instant",
                  "bundle"
                ]
              },
              "discount_amount": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "rebate_amount": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "shipping_amount",
              "tax_mode",
              "tax_value",
              "extra_amount",
              "discount_kind",
              "discount_amount",
              "rebate_amount"
            ],
            "additionalProperties": false
          },
          "installation": {
            "type": "object",
            "properties": {
              "version": {
                "const": 1
              },
              "motherboard_id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
              },
              "bound_items": {
                "type": "string",
                "maxLength": 4000
              },
              "front_layout": {
                "enum": [
                  "stock",
                  "front_radiator",
                  "unknown"
                ]
              },
              "manual_confirmed": {
                "type": "boolean"
              },
              "revision": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 40,
                    "pattern": "^[^\\x00-\\x1f<>]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bios": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 80,
                    "pattern": "^[^\\x00-\\x1f<>]*$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "storage": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "part_id": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                    },
                    "unit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 16
                    },
                    "slot": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 30,
                          "pattern": "^[A-Z0-9_]+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "part_id",
                    "unit",
                    "slot"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 128
              },
              "expansion": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "part_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "unit": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 16
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "slot": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 30,
                          "pattern": "^[A-Z0-9_]+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "blocks": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "maxLength": 30,
                        "pattern": "^[A-Z0-9_]+$"
                      },
                      "maxItems": 16
                    },
                    "footprint_checked": {
                      "type": "boolean"
                    },
                    "lanes": {
                      "enum": [
                        null,
                        1,
                        2,
                        4,
                        8,
                        16
                      ]
                    }
                  },
                  "required": [
                    "part_id",
                    "unit",
                    "slot",
                    "blocks",
                    "footprint_checked",
                    "lanes"
                  ],
                  "additionalProperties": false
                },
                "maxItems": 16
              },
              "headers": {
                "type": "object",
                "properties": {
                  "usb_c_ports": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 16
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "eps8_cables": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 8
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "atx24": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "front_panel": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "required": [
                  "usb_c_ports",
                  "eps8_cables",
                  "atx24",
                  "front_panel"
                ],
                "additionalProperties": false
              },
              "cooling": {
                "type": "object",
                "properties": {
                  "mode": {
                    "enum": [
                      "unknown",
                      "dual",
                      "raised",
                      "single"
                    ]
                  },
                  "ram_height_mm": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "installed_height_mm": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "radiator_stack_mm": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "available_stack_mm": {
                    "anyOf": [
                      {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "mode",
                  "ram_height_mm",
                  "installed_height_mm",
                  "radiator_stack_mm",
                  "available_stack_mm"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "version",
              "motherboard_id",
              "bound_items",
              "front_layout",
              "manual_confirmed",
              "revision",
              "bios",
              "storage",
              "expansion",
              "headers",
              "cooling"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "items",
          "extras",
          "profile",
          "layout",
          "costs"
        ],
        "additionalProperties": false
      },
      "Snapshot": {
        "type": "object",
        "properties": {
          "format": {
            "const": "buildapc-build"
          },
          "version": {
            "const": 1
          },
          "created_at": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}",
            "description": "A parseable original source/snapshot date. Precision is retained; this does not establish freshness."
          },
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "notes": {
            "type": "string",
            "maxLength": 4000
          },
          "draft": {
            "$ref": "#/components/schemas/Draft"
          },
          "observed_prices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "product_id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                },
                "offer_id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                },
                "amount": {
                  "type": "string",
                  "pattern": "^(0|[1-9]\\d{0,8})\\.\\d{2}$"
                },
                "currency": {
                  "type": "string",
                  "enum": [
                    "USD",
                    "EUR",
                    "GBP",
                    "CAD",
                    "AUD",
                    "JPY"
                  ]
                },
                "stock": {
                  "enum": [
                    "in_stock",
                    "out_of_stock",
                    "unknown"
                  ]
                },
                "condition": {
                  "enum": [
                    "new",
                    "used",
                    "refurbished",
                    "unknown"
                  ]
                },
                "observed_at": {
                  "type": "string",
                  "maxLength": 40,
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}",
                  "description": "A parseable original source/snapshot date. Precision is retained; this does not establish freshness."
                }
              },
              "required": [
                "product_id",
                "offer_id",
                "amount",
                "currency",
                "stock",
                "condition",
                "observed_at"
              ],
              "additionalProperties": false
            },
            "maxItems": 32
          }
        },
        "required": [
          "format",
          "version",
          "created_at",
          "name",
          "notes",
          "draft",
          "observed_prices"
        ],
        "additionalProperties": false
      },
      "Library": {
        "type": "object",
        "properties": {
          "format": {
            "const": "buildapc-library"
          },
          "version": {
            "const": 1
          },
          "builds": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "notes": {
                  "type": "string",
                  "maxLength": 4000
                },
                "versions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9-]{1,99}$"
                      },
                      "snapshot": {
                        "$ref": "#/components/schemas/Snapshot"
                      }
                    },
                    "required": [
                      "id",
                      "snapshot"
                    ],
                    "additionalProperties": false
                  },
                  "maxItems": 20,
                  "minItems": 1
                }
              },
              "required": [
                "id",
                "name",
                "notes",
                "versions"
              ],
              "additionalProperties": false
            },
            "maxItems": 20
          }
        },
        "required": [
          "format",
          "version",
          "builds"
        ],
        "additionalProperties": false
      },
      "WriteReceipt": {
        "type": "object",
        "properties": {
          "format": {
            "const": "buildapc-library-write"
          },
          "version": {
            "const": 1
          },
          "account_key": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999999999
          },
          "updated_at": {
            "type": "string",
            "maxLength": 40,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}",
            "description": "A parseable original source/snapshot date. Precision is retained; this does not establish freshness."
          },
          "library": {
            "$ref": "#/components/schemas/Library"
          },
          "deleted": {
            "type": "boolean"
          },
          "retention": {
            "type": "string"
          }
        },
        "required": [
          "format",
          "version",
          "account_key",
          "revision",
          "updated_at",
          "library",
          "deleted"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600
          }
        },
        "required": [
          "error",
          "code"
        ],
        "additionalProperties": false
      }
    }
  },
  "x-authentication": {
    "kind": "native-sites-visitor",
    "sign_in_path": "/signin-with-chatgpt?return_to=%2Fapi-reference%2F",
    "top_level_navigation": true,
    "service_access_is_visitor_identity": false,
    "cookies_or_auth_headers_to_extract": false
  },
  "x-limits": {
    "body_bytes": 1500000,
    "snapshot_bytes": 256000,
    "builds": 20,
    "versions_per_build": 20,
    "read": {
      "requests": 120,
      "window_seconds": 60
    },
    "save": {
      "requests": 30,
      "window_seconds": 3600
    },
    "erase": {
      "requests": 10,
      "window_seconds": 3600
    }
  },
  "x-compatibility": {
    "legacy_paths": [
      "/api/account",
      "/api/account/library"
    ],
    "legacy_revision_conflict_status": 409,
    "v1_precondition_failure_status": 412,
    "same_storage_and_shared_rate_buckets": true
  },
  "x-policy": "Normalized v1 body shapes are fixed. Documentation and optional metadata headers may gain compatible details; incompatible formats, authentication or resource semantics require a new major API path. No third-party competitor fetching."
}
