API / deployment

Batch redaction without losing the one file that failed

A practical guide to batch redaction api: the boundary, the controls and the failure modes that matter before the first document.

Batch Redaction API: Deployment and Limits

Batch redaction without losing the one file that failed. Volume changes the failure mode. One corrupt PDF, one unsupported format or one timeout cannot be allowed to stop the run, and a silent success for a file that was never processed is worse than a visible error.

What changes in this environment

A queue in front of workers, a manifest as the source of truth, and an output layout that mirrors the input. Each job gets an idempotency key and a stable output name. Failures go to a dead-letter list with a reason, not to a log line nobody reads.

Where the data hides

The visible page is only one layer. In this environment, check:

The redaction flow

  1. Build a manifest with path, type and policy.
  2. Submit in chunks and keep the job ids.
  3. Poll or accept callbacks; record every terminal state.
  4. Download the output and the report per file.
  5. Reconcile the manifest against the outputs before release.

Controls to verify

  • Idempotency keys so a retry does not duplicate work.
  • A dead-letter list with an owner and a reason.
  • Per-file report hashes linked to the manifest line.
  • Rate limits and backpressure that match the workers.
  • A sample review after every large batch, not only at go-live.

Retention and evidence

Keep the manifest, the reports and the exception list for the same window as the output. A batch that produced 998 files and no explanation for the other two is not auditable. Delete the inputs on a schedule and prove it on a sample.

Limits

Batch APIs are less interactive: the review happens after the run, so a bad policy can waste the whole batch. Very large files, unusual encodings and scans still fail. Partial success is normal; silent success is not.

The job lifecycle

A batch API is a small state machine: submitted, validating, processing, completed, failed, partially-failed. The useful design exposes every transition with a timestamp, because the questions that matter — when will it finish, what failed, what did the failure touch — are all questions about states. Partial failure is the state worth designing for explicitly: one corrupt file should not condemn the batch, and the result set must distinguish 'masked', 'failed', and 'skipped by policy' without ambiguity.

The manifest as contract

The batch manifest is the contract between submitter and processor: input references, per-file policies, output destinations, and the expected report shape. When the completed batch comes back, the result manifest should mirror the input line for line, so a diff answers 'did everything I sent get an answer'. Keep both manifests with the removal reports — together they are the audit trail for a bulk release. A batch without manifests is a folder with confidence.

What the client does while waiting

Batch clients should poll on the job's state endpoint with backoff, and treat 'processing' without progress for longer than a documented window as a question to ask, not a wait to extend. The state endpoint's timestamps are the answer to 'is it stuck': a job whose last transition predates the timeout is a support ticket, and the ticket that names the job id and the timestamps gets answered first. Design the client around that behavior from the start.

How Veilbrook fits

Veilbrook accepts a document and a policy, returns the redacted file and a report, and can run as a batch job. The manifest and reconciliation pattern is the part you own.

Before you release

Open the output in the same tool the recipient will use. Select each masked area and paste it into a text editor. Search for every value you removed, including the header, the attachment, the comment and the OCR layer. Compare the report with the file and keep both. If a value survives, the job is not done.

What to ask before you build

Questions

What happens to a file that fails?

It should land in an exception list with a reason, while the rest of the batch continues. Reconcile the list before release.

Can we retry a batch?

Use idempotency keys and a manifest. A blind retry can duplicate outputs or overwrite a reviewed file.

Is batch cheaper?

It is often more efficient, but the review and reconciliation work is real. Price the whole workflow, not only the API call.