replace_file
Replace a file's content atomically. Cost class: job.
The replacement is atomic from a reader's perspective: the old version is stamped replaced_at and the new version is live in the same commit.
Re-ingests only if the file was ingested before (ingestion_status becomes stale); a never-ingested file returns to discovered. The actual cascade (retiring outputs, queuing re-ingestion) is the dispatch seam in the job service.
Args: context: Resolved workspace plus the caller's access predicate. session: Database session. file_id: The file to replace. file: The replacement file bytes. metadata: JSON-encoded ReplaceFileRequest from the multipart body. wait_seconds: Accepted for uniformity; the row write is already done. idempotency_key: Replaying with the same key returns the original job. response: Injected by FastAPI for status-code management.
Returns: A succeeded Job whose result is a ReplaceFileResult.
Raises: PlatformError: file_not_found when the file does not exist. PlatformError: access_denied when the caller does not hold the required access label. PlatformError: file_too_large when the upload exceeds NDI_MAX_UPLOAD_BYTES.
Request
- Base URLhttps://ndi-api.nace.ai (the document declares no server; this is the origin it was published from)
- AuthAPI key in header X-API-Key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
Workspace identifier.
Query parameters
Bounded inline wait. 0 (the default) returns 202 immediately. Above 0 the route returns 200 with a terminal job if the work finished in time, and 202 with the still-running job if it did not. Either way, read status.
Headers
Replaying a request with the same key returns the original job with 200, never a second job. The key is kept with the job for replay and never cleared, so it must not contain personal data.
Request body multipart/form-data
Response
Successful Response
Changes
No recorded changes to this operation across all 1 revision of this API.