Control permission to retain encrypted source
Reading source into memory and retaining it are separate decisions. These endpoints let you inspect, grant and revoke permission to store the exact source snapshot already recorded for a run. Granting permission does not transfer files, start execution, or permit source backups. A separate stage operation can retain a previously read memory snapshot when configured.
Grant storage permission
POST /api/runs/{runId}/storage-consents
An owner or maintainer must use fresh human step-up authentication. The run needs a completed source-read receipt, a current project connection and a storage account belonging to the same customer.
sourceConsentDigest: the digest of that completed source-read consent.accountId: optional; the server otherwise selects the workspace account used by its usage ledger. Repeating a request keeps its original account binding.retentionSeconds: an integer from 3600 to 86400.idempotencyKey: a string of 16 to 128 letters, digits, underscores or hyphens.acknowledgement: exactlyALLOW_ENCRYPTED_SOURCE_STAGING_FOR_THIS_RUN.
The single-use write permission expires within five minutes and never outlives the fresh authentication window. Retention begins when storage occurs. Repeating the same request returns the original permission; it does not refresh its expiry.
Retain the approved memory snapshot
Inspect sourceStageEndpointAvailable. When enabled, send an empty JSON object to POST /api/runs/{runId}/storage-consents/{storageConsentDigest}/stage. The same authenticated session must have a current memory snapshot from the source-read operation. The run page shows ?Save approved snapshot encrypted? only when the server confirms the snapshot, permission and project access are current. The server validates the exact source and storage consent, encrypts the package, and clears the memory buffer. No file upload or provider credential is accepted in this request.
A completed stage request can be repeated to retrieve its existing package reference without another write. If memory expired or the process restarted before staging, a new source-read permission and snapshot are needed. Storage never authorizes code execution.
Inspect status
GET /api/runs/{runId}/storage-consents
Project members can inspect the exact snapshot, retention, permission expiry, use and revocation state. A started operation is not a completed write. A failed operation can explicitly report that cleanup is still required. Stored status is a storage observation, not independent verification of the software.
Check retained storage and cleanup evidence
storageState distinguishes no write, a retained-storage record, recorded removal and unverified state. These checks validate retained metadata and receipts; they do not perform a fresh read of the stored file. cleanupEvidence reports whether cleanup is required, unverified or confirmed by a checked receipt. Confirmed entries include the receipt digest, observation time and removal scope. Shared bytes may remain for another retained artifact; the response states that explicitly.
These are runtime observations, not independent certification of the software. An interrupted operation stays failed after cleanup. Invalid, mismatched or future-dated cleanup evidence is refused instead of being displayed as confirmed. The run page shows storage and cleanup evidence. When the server confirms fresh management authority, it also offers an unchecked consent box, snapshot and retention selectors, and grant/revoke controls. Granting permission transfers no files. Refreshing invalid evidence clears the previous confirmation.
Revoke before storage
POST /api/runs/{runId}/storage-consents/{storageConsentDigest}/revoke with an empty JSON object.
Fresh human management authority is required. Repeated revocation is safe. Revocation cannot delete a completed stored package; use its separate package deletion operation. An in-progress operation must complete cleanup before it can be treated as removed.
Response boundaries
Requests accept no query parameters or additional fields. Credentials, session identifiers, artifact storage keys and file content are excluded from responses. Unauthenticated requests return 401, unavailable runs 404, insufficient authority 403, invalid input 400 and conflicting or stale state 409.
The API accepts no source upload and provides no execution endpoint. Source-read consent alone never authorizes encrypted storage. Source transfer and staging remain unavailable unless the server explicitly configures their runtime.