{
  "openapi": "3.1.0",
  "info": {
    "title": "Open Continuity Protocol 0.4 HTTP Binding - Portable AI History",
    "version": "0.4-working-draft",
    "description": "HTTP transport binding for OCP 0.4. OCP records are never bearer credentials or external-action authority."
  },
  "servers": [
    {
      "url": "https://context-provider.example/ocp/v0.4"
    }
  ],
  "security": [
    {
      "OAuth2": [
        "ocp.context"
      ]
    }
  ],
  "paths": {
    "/.well-known/ocp-configuration": {
      "get": {
        "security": [],
        "operationId": "getDiscovery",
        "servers": [
          {
            "url": "https://context-provider.example"
          }
        ],
        "responses": {
          "200": {
            "description": "Discovery metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "discovery.schema.json"
                }
              }
            }
          }
        }
      }
    },
    "/client-declarations": {
      "post": {
        "operationId": "registerClientDeclaration",
        "description": "Registers a client-authored declaration while binding client and created_by to the authenticated publisher. Submitted assurance status tokens are untrusted claims: a 201 response confirms only registration and schema acceptance. Before relying on provider_verified or independently_assessed, the provider re-resolves the exact typed SourceRecord evidence and applies its current evaluator policy to the exact declaration representation.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/ocp+json": {
              "schema": {
                "$ref": "../../schemas/core/client-declaration.schema.json"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../../schemas/core/client-declaration.schema.json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-requests": {
      "post": {
        "operationId": "createContextRequest",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/ocp+json": {
              "schema": {
                "$ref": "context-request-create.schema.json"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../../schemas/core/context-request.schema.json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-requests/{request_id}": {
      "get": {
        "operationId": "getContextRequest",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "Request",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../../schemas/core/context-request.schema.json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-requests/{request_id}/status": {
      "get": {
        "operationId": "getContextRequestStatus",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative context-request state of record. checked_at is the observation time for the returned request state; a liveStatusRef uses last_checked_at for its own referenced-status observation, and the two values need not be equal.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContextRequestStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/grant-receipts/{grant_id}": {
      "get": {
        "operationId": "getGrantReceipt",
        "parameters": [
          {
            "$ref": "#/components/parameters/GrantId"
          }
        ],
        "responses": {
          "200": {
            "description": "Non-secret decision receipt",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../../schemas/core/grant-receipt.schema.json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/grant-receipts/{grant_id}/status": {
      "get": {
        "operationId": "getGrantStatus",
        "parameters": [
          {
            "$ref": "#/components/parameters/GrantId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative grant state of record. checked_at is the observation time for the returned grant state; a liveStatusRef uses last_checked_at for its own referenced-status observation, and the two values need not be equal.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-packages": {
      "post": {
        "operationId": "buildContextPackage",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_receipt_ref",
                  "grant_status_ref"
                ],
                "properties": {
                  "grant_receipt_ref": {
                    "$ref": "../../schemas/core/common.schema.json#/$defs/snapshotRef"
                  },
                  "grant_status_ref": {
                    "$ref": "../../schemas/core/common.schema.json#/$defs/liveStatusRef"
                  },
                  "requested_at": {
                    "description": "Optional caller wall-clock hint for tracing or scheduling only. It is not an authorization fact, trusted evaluation time, status-observation time, or package issued_at; the provider evaluates current authorization and authors issued_at from its own trusted clock.",
                    "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp-package+json": {
                "schema": {
                  "$ref": "../../schemas/core/context-package.schema.json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-packages/{package_id}": {
      "get": {
        "operationId": "getContextPackage",
        "parameters": [
          {
            "$ref": "#/components/parameters/PackageId"
          }
        ],
        "responses": {
          "200": {
            "description": "Purpose-bound minimized package",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp-package+json": {
                "schema": {
                  "$ref": "../../schemas/core/context-package.schema.json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "410": {
            "$ref": "#/components/responses/PackageExpiredProblem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-packages/{package_id}/entries/{entry_id}": {
      "get": {
        "operationId": "getPackageEntry",
        "parameters": [
          {
            "$ref": "#/components/parameters/PackageId"
          },
          {
            "$ref": "#/components/parameters/EntryId"
          }
        ],
        "responses": {
          "200": {
            "description": "Separately authorized package entry",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "../../schemas/core/context-package.schema.json#/$defs/contextEntry"
                    },
                    {
                      "$ref": "../../schemas/core/context-package.schema.json#/$defs/evidenceEntry"
                    },
                    {
                      "$ref": "../../schemas/core/context-package.schema.json#/$defs/artifactEntry"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "410": {
            "$ref": "#/components/responses/PackageExpiredProblem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/context-packages/{package_id}/status": {
      "get": {
        "operationId": "getContextPackageStatus",
        "description": "Reads the authoritative package lifecycle state; event delivery is not a substitute for this state-of-record read.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PackageId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative context-package state of record. checked_at is the observation time for the returned package state; a liveStatusRef uses last_checked_at for its own referenced-status observation.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContextPackageStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "410": {
            "$ref": "#/components/responses/PackageExpiredProblem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/update-proposals": {
      "post": {
        "operationId": "submitUpdateProposal",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/ocp+json": {
              "schema": {
                "$ref": "update-proposal-create.schema.json"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../../schemas/core/update-proposal.schema.json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/update-proposals/{proposal_id}/status": {
      "get": {
        "operationId": "getUpdateProposalStatus",
        "description": "Reads the authoritative proposal lifecycle state; event delivery is not a substitute for this state-of-record read.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProposalId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative update-proposal state of record. checked_at is the observation time for the returned proposal state; a liveStatusRef uses last_checked_at for its own referenced-status observation.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateProposalStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/update-proposals/{proposal_id}/decisions": {
      "post": {
        "operationId": "decideUpdateProposal",
        "description": "Creates an immutable review decision and, for an accepting outcome, the resulting accepted context item atomically. The server MUST bind proposal_ref.id to the proposal_id path parameter, bind its exact revision and digest to the If-Match-selected proposal revision, authenticate reviewed_by as the currently authorized reviewer, validate resulting_item_input as the exact reviewed semantics, author both persisted envelopes plus result identity/revision, creation audit fields, active lifecycle and accepted review state, and derive the decision commitment from that authored result.",
        "parameters": [
          {
            "$ref": "#/components/parameters/ProposalId"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/ocp+json": {
              "schema": {
                "$ref": "review-decision-create.schema.json"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created decision; accepting outcomes also return the atomically authored resulting item.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewDecisionCreateResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "412": {
            "$ref": "#/components/responses/Problem412"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "428": {
            "$ref": "#/components/responses/Problem428"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/transfer-manifests": {
      "post": {
        "operationId": "createTransferManifest",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/ocp+json": {
              "schema": {
                "$ref": "transfer-manifest-create.schema.json"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../transfer/transfer-manifest.schema.json"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "409": {
            "$ref": "#/components/responses/Problem409"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/transfer-manifests/{transfer_id}": {
      "get": {
        "operationId": "getTransferManifest",
        "description": "Retrieves the complete transfer manifest, including entry results, losses, and exceptions; the status resource is only a typed lifecycle projection.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TransferId"
          }
        ],
        "responses": {
          "200": {
            "description": "Complete transfer manifest",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/ocp+json": {
                "schema": {
                  "$ref": "../transfer/transfer-manifest.schema.json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/transfer-manifests/{transfer_id}/status": {
      "get": {
        "operationId": "getTransferManifestStatus",
        "description": "Reads the authoritative transfer lifecycle state; event delivery is not a substitute for this state-of-record read.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TransferId"
          }
        ],
        "responses": {
          "200": {
            "description": "Authoritative transfer-manifest state of record. checked_at is the observation time for the returned transfer state; a liveStatusRef uses last_checked_at for its own referenced-status observation.",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferManifestStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "description": "Returns notifications, not state of record. Every advertised lifecycle type is reconcilable through the typed read/status contract for its referenced request, grant, package, proposal, or transfer; the package-integrity notification uses the package contract. Other registry event types require a profile with an authoritative resolver. Page size and cursor retention are read from discovery limits; this binding defines no implicit fallback values.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque continuation token bound to the authenticated principal, authorization/filter scope, issuer, and OCP version. Omit to begin at the earliest retained visible event.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Requested page size. It MUST NOT exceed discovery limits.event_page_max_items; omission uses the server-selected size within that advertised maximum.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor-paged reference-first CloudEvents 1.0 JSON batch. SSE and webhook delivery require separate profiles.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControlNoStore"
              },
              "Next-Cursor": {
                "$ref": "#/components/headers/NextCursor"
              }
            },
            "content": {
              "application/cloudevents-batch+json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EventNotification"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "410": {
            "$ref": "#/components/responses/EventCursorGoneProblem"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          },
          "503": {
            "$ref": "#/components/responses/TemporarilyUnavailableProblem"
          }
        }
      }
    },
    "/history/imports": {
      "post": {
        "operationId": "createHistoryImport",
        "summary": "Create a loss-aware history import; parsing and mapping do not accept context",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "202": {
            "description": "Import accepted into raw/parsed processing zones"
          },
          "400": {
            "$ref": "#/components/responses/Problem400"
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    },
    "/history/imports/{import_id}/loss-report": {
      "get": {
        "operationId": "getHistoryImportLossReport",
        "summary": "Retrieve a privacy-filtered machine-readable loss report",
        "parameters": [
          {
            "name": "import_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Loss report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../../schemas/loss-report.schema.json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "404": {
            "$ref": "#/components/responses/Problem404"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitedProblem"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://authorization.example/authorize",
            "tokenUrl": "https://authorization.example/token",
            "scopes": {
              "ocp.context": "Access OCP protected resources subject to authorization_details"
            }
          }
        }
      }
    },
    "schemas": {
      "Problem": {
        "$ref": "problem.schema.json"
      },
      "Problem400Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 400
              }
            }
          }
        ]
      },
      "Problem401Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 401
              }
            }
          }
        ]
      },
      "Problem403Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 403
              }
            }
          }
        ]
      },
      "Problem404Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 404
              }
            }
          }
        ]
      },
      "Problem409Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 409
              }
            }
          }
        ]
      },
      "Problem412Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 412
              }
            }
          }
        ]
      },
      "Problem422Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 422
              }
            }
          }
        ]
      },
      "Problem428Body": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "const": 428
              }
            }
          }
        ]
      },
      "RateLimitedProblemBody": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status",
              "code",
              "retryable"
            ],
            "properties": {
              "status": {
                "const": 429
              },
              "code": {
                "const": "OCP_RATE_LIMITED"
              },
              "retryable": {
                "const": true
              }
            }
          }
        ]
      },
      "TemporarilyUnavailableProblemBody": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status",
              "code",
              "retryable"
            ],
            "properties": {
              "status": {
                "const": 503
              },
              "code": {
                "const": "OCP_TEMPORARILY_UNAVAILABLE"
              },
              "retryable": {
                "const": true
              }
            }
          }
        ]
      },
      "EventCursorGoneProblemBody": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status",
              "code",
              "retryable"
            ],
            "properties": {
              "status": {
                "const": 410
              },
              "code": {
                "enum": [
                  "OCP_EVENT_CURSOR_EXPIRED",
                  "OCP_EVENT_GAP"
                ]
              },
              "retryable": {
                "const": false
              }
            }
          }
        ]
      },
      "PackageExpiredProblemBody": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "status",
              "code",
              "retryable"
            ],
            "properties": {
              "status": {
                "const": 410
              },
              "code": {
                "const": "OCP_PACKAGE_EXPIRED"
              },
              "retryable": {
                "const": false
              }
            }
          }
        ]
      },
      "ContextRequestStatus": {
        "type": "object",
        "required": [
          "request_id",
          "revision",
          "status",
          "checked_at"
        ],
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uri"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "enum": [
              "submitted",
              "awaiting_decision",
              "partially_approved",
              "approved",
              "denied",
              "expired",
              "withdrawn",
              "superseded"
            ]
          },
          "checked_at": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
          },
          "grant_receipt_ref": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/snapshotRef"
          },
          "grant_status_ref": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/liveStatusRef"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "enum": [
                    "approved",
                    "partially_approved"
                  ]
                }
              },
              "required": [
                "status"
              ]
            },
            "then": {
              "properties": {
                "grant_receipt_ref": {},
                "grant_status_ref": {}
              },
              "required": [
                "grant_receipt_ref",
                "grant_status_ref"
              ]
            },
            "else": {
              "not": {
                "anyOf": [
                  {
                    "properties": {
                      "grant_receipt_ref": {}
                    },
                    "required": [
                      "grant_receipt_ref"
                    ]
                  },
                  {
                    "properties": {
                      "grant_status_ref": {}
                    },
                    "required": [
                      "grant_status_ref"
                    ]
                  }
                ]
              }
            }
          }
        ],
        "additionalProperties": false
      },
      "GrantStatus": {
        "type": "object",
        "required": [
          "grant_id",
          "revision",
          "status",
          "checked_at"
        ],
        "properties": {
          "grant_id": {
            "type": "string",
            "format": "uri"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "enum": [
              "active",
              "suspended",
              "expired",
              "revoked",
              "superseded"
            ]
          },
          "checked_at": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
          }
        },
        "additionalProperties": false
      },
      "ContextPackageStatus": {
        "type": "object",
        "required": [
          "package_id",
          "revision",
          "status",
          "checked_at"
        ],
        "properties": {
          "package_id": {
            "type": "string",
            "format": "uri"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "enum": [
              "built",
              "available",
              "delivered",
              "expired",
              "invalidated",
              "rejected"
            ]
          },
          "checked_at": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
          }
        },
        "additionalProperties": false
      },
      "UpdateProposalStatus": {
        "type": "object",
        "required": [
          "proposal_id",
          "revision",
          "status",
          "checked_at"
        ],
        "properties": {
          "proposal_id": {
            "type": "string",
            "format": "uri"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "enum": [
              "submitted",
              "under_review",
              "deferred",
              "accepted",
              "accepted_with_changes",
              "rejected",
              "disputed",
              "withdrawn",
              "expired",
              "superseded"
            ]
          },
          "checked_at": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
          },
          "latest_review_decision_ref": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/snapshotRef"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "enum": [
                    "deferred",
                    "accepted",
                    "accepted_with_changes",
                    "rejected",
                    "disputed"
                  ]
                }
              },
              "required": [
                "status"
              ]
            },
            "then": {
              "properties": {
                "latest_review_decision_ref": {}
              },
              "required": [
                "latest_review_decision_ref"
              ]
            }
          }
        ],
        "additionalProperties": false
      },
      "TransferManifestStatus": {
        "type": "object",
        "required": [
          "transfer_id",
          "revision",
          "state",
          "checked_at"
        ],
        "properties": {
          "transfer_id": {
            "type": "string",
            "format": "uri"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "enum": [
              "prepared",
              "delivered",
              "importing",
              "validated",
              "validated_with_exceptions",
              "rejected",
              "aborted"
            ]
          },
          "checked_at": {
            "$ref": "../../schemas/core/common.schema.json#/$defs/timestamp"
          }
        },
        "additionalProperties": false
      },
      "EventNotification": {
        "$ref": "event-notification.schema.json"
      },
      "ReviewDecisionCreateResult": {
        "type": "object",
        "required": [
          "decision"
        ],
        "properties": {
          "decision": {
            "$ref": "../../schemas/core/review-decision.schema.json"
          },
          "resulting_item": {
            "$ref": "../../schemas/core/context-item.schema.json"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "decision": {
                  "type": "object",
                  "properties": {
                    "outcome": {
                      "enum": [
                        "accepted",
                        "accepted_with_changes"
                      ]
                    }
                  },
                  "required": [
                    "outcome"
                  ]
                }
              },
              "required": [
                "decision"
              ]
            },
            "then": {
              "required": [
                "resulting_item"
              ],
              "properties": {
                "resulting_item": {
                  "allOf": [
                    {
                      "$ref": "../../schemas/core/context-item.schema.json"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "review": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "const": "accepted"
                            }
                          },
                          "required": [
                            "status"
                          ]
                        },
                        "lifecycle": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "const": "active"
                            }
                          },
                          "required": [
                            "status"
                          ]
                        }
                      },
                      "required": [
                        "review",
                        "lifecycle"
                      ]
                    }
                  ]
                }
              }
            },
            "else": {
              "not": {
                "required": [
                  "resulting_item"
                ]
              }
            }
          }
        ],
        "additionalProperties": false
      }
    },
    "responses": {
      "Problem400": {
        "description": "OCP 400 problem; body status is exactly 400.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem400Body"
            }
          }
        }
      },
      "Problem401": {
        "description": "OCP 401 problem; body status is exactly 401.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem401Body"
            }
          }
        }
      },
      "Problem403": {
        "description": "OCP 403 problem; body status is exactly 403.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem403Body"
            }
          }
        }
      },
      "Problem404": {
        "description": "OCP 404 problem; body status is exactly 404.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem404Body"
            }
          }
        }
      },
      "Problem409": {
        "description": "OCP 409 problem; body status is exactly 409.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem409Body"
            }
          }
        }
      },
      "Problem412": {
        "description": "OCP 412 problem; body status is exactly 412.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem412Body"
            }
          }
        }
      },
      "Problem422": {
        "description": "OCP 422 problem; body status is exactly 422.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem422Body"
            }
          }
        }
      },
      "Problem428": {
        "description": "OCP 428 problem; body status is exactly 428.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem428Body"
            }
          }
        }
      },
      "RateLimitedProblem": {
        "description": "OCP rate-limit problem; Retry-After indicates the minimum retry delay.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/RateLimitedProblemBody"
            }
          }
        }
      },
      "TemporarilyUnavailableProblem": {
        "description": "Temporary-unavailability problem; Retry-After indicates the minimum retry delay.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/TemporarilyUnavailableProblemBody"
            }
          }
        }
      },
      "EventCursorGoneProblem": {
        "description": "Cursor cannot continue. The problem code is OCP_EVENT_CURSOR_EXPIRED when its advertised retention elapsed, or OCP_EVENT_GAP when continuity cannot be established. The client reconciles through authoritative status resources before starting a new cursorless page.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/EventCursorGoneProblemBody"
            }
          }
        }
      },
      "PackageExpiredProblem": {
        "description": "The requested context package has expired. The body code, HTTP status, and retryability are exact.",
        "headers": {
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlNoStore"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/PackageExpiredProblemBody"
            }
          }
        }
      }
    },
    "headers": {
      "ETag": {
        "description": "Strong entity tag for the exact returned resource revision.",
        "schema": {
          "type": "string",
          "minLength": 3,
          "maxLength": 256,
          "pattern": "^\"(?:[^\"\\\\]|\\\\.)+\"$"
        }
      },
      "CacheControlNoStore": {
        "description": "Cache policy for non-public OCP representations; the value must include no-store.",
        "schema": {
          "type": "string",
          "pattern": "(?:^|,\\s*)no-store(?:\\s*,|$)"
        }
      },
      "RetryAfter": {
        "description": "Required minimum retry delay, expressed as non-negative delta-seconds or an IMF-fixdate.",
        "required": true,
        "schema": {
          "type": "string",
          "oneOf": [
            {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            {
              "type": "string",
              "pattern": "^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:0[1-9]|[12][0-9]|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4} (?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9] GMT$"
            }
          ]
        }
      },
      "NextCursor": {
        "description": "Opaque cursor for the next batch, usable for at least discovery limits.event_cursor_retention_seconds unless its authorization context changes. Omitted when no later event is currently available.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Bound to the authenticated principal, endpoint, OCP version, and canonical request digest; reuse with different content is a conflict.",
        "schema": {
          "type": "string",
          "minLength": 16,
          "maxLength": 128
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": true,
        "description": "Strong entity tag for the exact current proposal revision.",
        "schema": {
          "type": "string",
          "minLength": 3,
          "maxLength": 256,
          "pattern": "^\"(?:[^\"\\\\]|\\\\.)+\"$"
        }
      },
      "RequestId": {
        "name": "request_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "GrantId": {
        "name": "grant_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "PackageId": {
        "name": "package_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "EntryId": {
        "name": "entry_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "ProposalId": {
        "name": "proposal_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "TransferId": {
        "name": "transfer_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    }
  }
}
