# Apply storage recovery

Source: https://holofolder.com/app/docs/reference/collection/apply-storage-recovery

POST https://app.holofolder.com/app/api/v1/storage/recovery/apply

OpenAPI operation (parameters, authentication, request body and responses):

```json
{
  "operationId": "apply_storage_recovery",
  "summary": "Apply storage recovery",
  "description": " A committed terminal rejection returns REST 409 storage_recovery_rejected or MCP isError with strict error.rejection (outcome, original operationId, code, inventoryRevision). Only recovery_plan_conflict and recovery_dependency_conflict are terminal. Accepted/rejected exact replay precedes mutable plan reconstruction but requires current authority. Preserve unknown requests; status, billing errors and cancellation are not proof. After proof, obtain a fresh complete current owner/session read and explicitly discard, or review a new preview and confirm a new operationId. MCP outputSchema describes accepted receipts only; holofolder.com/errorSchemas metadata declares errors. Apply exactly reviewed native version-1 recovery with confirmation, planToken and retry-stable operationId. Current authority and newer/ABA changes remain enforced. No fallback to legacy recovery.\n\nRequired permissions: `collection:read`, `collection:write`, `binders:write`. MCP tool: `apply_storage_recovery`.",
  "tags": [
    "Collection"
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "parameters": [],
  "x-max-body-bytes": 1048576,
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "eventId": {
              "type": "string",
              "pattern": "^[1-9]\\d{0,18}$"
            },
            "restoreUnassignedItemIds": {
              "maxItems": 16384,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            },
            "operationId": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "planToken": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "confirmed": {
              "type": "boolean",
              "const": true
            },
            "planVersion": {
              "type": "number",
              "const": 1
            }
          },
          "required": [
            "eventId",
            "restoreUnassignedItemIds",
            "operationId",
            "planToken",
            "confirmed",
            "planVersion"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "inventoryRevision": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "eventId": {
                "type": "string",
                "pattern": "^[1-9]\\d{0,18}$"
              },
              "recoveredEventId": {
                "type": "string",
                "pattern": "^[1-9]\\d{0,18}$"
              },
              "collections": {
                "maxItems": 4096,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "collectionId": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "layoutRevision": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "collectionId",
                    "version",
                    "layoutRevision"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "inventoryRevision",
              "eventId",
              "recoveredEventId",
              "collections"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "401": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "402": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "403": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "404": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "409": {
      "description": "Only the bound terminal ledger rejection carries proof; ordinary conflicts do not.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "error": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "requestId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "message",
                      "requestId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "error"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "error": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "const": "storage_recovery_rejected"
                      },
                      "message": {
                        "type": "string",
                        "const": "The original recovery did not commit. Read current storage before explicitly discarding or reviewing a new recovery."
                      },
                      "requestId": {
                        "type": "string"
                      },
                      "rejection": {
                        "type": "object",
                        "properties": {
                          "outcome": {
                            "type": "string",
                            "const": "rejected"
                          },
                          "operationId": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 100
                          },
                          "code": {
                            "type": "string",
                            "enum": [
                              "recovery_plan_conflict",
                              "recovery_dependency_conflict"
                            ]
                          },
                          "inventoryRevision": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "outcome",
                          "operationId",
                          "code",
                          "inventoryRevision"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "code",
                      "message",
                      "requestId",
                      "rejection"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "error"
                ],
                "additionalProperties": false
              }
            ]
          }
        }
      }
    },
    "413": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "422": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "429": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "503": {
      "description": "See the API conventions page.",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message",
                  "requestId"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "error"
            ],
            "additionalProperties": false
          }
        }
      }
    }
  }
}
```
