API / deployment

A redaction API that returns evidence, not just a file

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

Redaction API: Deployment and Limits

A redaction API that returns evidence, not just a file. An API is a contract. The caller sends a document and a policy, and receives a redacted file plus a report. If the contract only promises a file, the reviewer cannot tell what happened, and the integration cannot handle failure.

What changes in this environment

A submit call returns a job id; a poll or a signed callback returns the terminal state; a download returns the output and the report. The policy is a named object, not a prompt. Idempotency keys make retries safe, and errors are typed rather than a generic failure.

Where the data hides

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

The redaction flow

  1. Submit the file with a policy id and an idempotency key.
  2. Receive a job id immediately.
  3. Poll or accept the callback; do not guess from a timeout.
  4. Download the redacted file and the report.
  5. Reconcile the report against the review before release.

Controls to verify

  • Typed errors: unsupported, too large, unreadable, policy invalid.
  • Per-request authentication and scoped roles.
  • Rate limits and a documented retry policy.
  • Report fields that name the policy, the model version and the reviewer.
  • A deletion endpoint or a documented retention window.

Retention and evidence

The API should state where the input and output live, for how long and who can read them. A job id is not a retention policy. If the output is stored for download, it needs the same access control as the input.

Limits

The API is not a reviewer. It returns candidates and a report; a person still decides on uncertain spans. File size, page count, language and OCR quality bound what it can do. No endpoint makes a document anonymous.

The design questions that matter

An endpoint that returns a masked file is the easy half; the design is decided by the questions around it. Is the call idempotent — can the client retry safely when the network blips? What does the error taxonomy look like: validation, format-unsupported, and content-too-complex should be distinguishable by code, not by message text. What comes back besides the file — a per-category report, the input hash, the policy version — because the response is the evidence the integration will be audited against.

What to put in the contract

The API contract is where security and evidence get negotiated in advance. Specify the transport and authentication, the maximum payload, the retention of inputs and outputs, and the shape of the removal report. Specify the failure contract too: what happens to the input when processing fails, and what the client must do to avoid a half-written state on its side. A contract that names only the happy path produces an integration that works in the demo and improvises in production.

The integration test that counts

Test with your hardest files, not the vendor's samples: the skewed scan, the password-protected export, the sixty-page bundle. Assert on the report as well as the output — a silent drop in detected categories between versions is a regression that file-comparison tests will miss. Record the policy version per test run, so a behavior change is attributable to something. The suite is small — a few dozen files — and it is the difference between an API you operate and one you merely call.

How Veilbrook fits

Veilbrook exposes a document redaction service with a policy, an output and a removal report. Ask for the current API guide and test the error paths, not only the happy path.

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

Is there an OpenAPI spec?

Ask for the current API guide. This page describes the contract shape, not the live schema.

Can we send a folder?

Use the batch pattern: a manifest and one job per file. A folder is not a document type.

What does the report contain?

At minimum the policy, the removed spans, the remaining uncertain spans and the model version. Ask for a sample.