---
title: "Permanently redact personal information"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Permanently redact personal information

Path: CloudRaker Paperwork API › Spaces

`POST /v1/spaces/{spaceId}/redact`

Destructively removes personal information from a document or an audio file and returns a new file.

The removal is real, not cosmetic: text is stripped out of the PDF content stream rather than covered with a black box, and audio is beeped or silenced with its transcript rewritten to match.

**Routing is by the input's media type**, and the parameters are not interchangeable:

- **Documents** — `mode`: `targeted` (default, per-entity boxes) or `lines` (whole lines).
- **Audio and video** — `style`: `beep` or `silence`.

Sending the other medium's parameter is a `400`.

**Choosing what to remove.** `categories` lists what counts as sensitive. A list you send **replaces** the [defaults](https://docs.cloudraker.com/paperwork/capabilities/redact#what-counts-as-sensitive); it never adds to them, so narrowing the list leaves everything else in the file. `instructions` adds free-form guidance on top.

**Reading the result.** `output.entities` counts what was removed, per category. Its keys are open, not a closed set: a finding your categories do not cover reports under its own label, such as `Passport number` or `MRN`. Iterate the map; never switch on a fixed set of keys. `output.skipped` counts the inputs that held nothing to redact. A skipped input produces no new file, so there is nothing to download for it.

**One file per call.** `file` is singular, and `{ "files": […] }` is a `400`. To redact a set in one call, send a [pipeline](https://docs.cloudraker.com/paperwork/capabilities/pipeline) with a single `{ "redact": … }` step.

```json
{
  "file": { "id": "a04d6597-4e34-4a99-94ea-964c289a4c68" },
  "categories": ["ssn", "ein"],
  "mode": "targeted"
}
```

### Waiting for the result

Sync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).

| Outcome | Response |
| --- | --- |
| Finished inside the window | `200` with the full run |
| Still running at the cap | `202` with `{object, id, status, statusUrl}` |

> **Note:** The `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/paperwork/api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/paperwork/api/webhook-endpoints/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.

**Learn more:** [Redaction guide](https://docs.cloudraker.com/paperwork/capabilities/redact)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`spaceRedact.path.spaceId`; string, required)

## Query parameters

- `wait` (`spaceRedact.query.wait`; integer, optional) — How many seconds to hold the request open waiting for the run to finish. Finishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`.
  - min 0; max 120; default `60`

## Request body

_Required._

- `file` (`spaceRedact.file`; any of, required) — An input file, given one of two ways. - `{ "url": "…", "name"?: "…", "processing"?: "…" }` — fetched over http(s) for this run and purged with it. - `{ "id": "…" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed. - `{ "id": "…", "ephemeral": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses.
  - any of:
    - `object`
      - `url` (`spaceRedact.file.1.url`; string, required)
        - format `uri`
      - `name` (`spaceRedact.file.1.name`; string, optional)
        - minLength 1
      - `processing` (`spaceRedact.file.1.processing`; string, optional)
        - one of `"auto"`, `"ocr"`, `"simple"`, `"transcribe"`, `"transcribe_diarize"`
    - `object`
      - `id` (`spaceRedact.file.2.id`; string, required)
        - minLength 1
      - `ephemeral` (`spaceRedact.file.2.ephemeral`; boolean, optional) — Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.
- `categories` (`spaceRedact.categories`; array<string>, optional) — What counts as sensitive, as free text, not an enum. Each hit reports back under the label you asked for, copied exactly. **This list replaces the [defaults](https://docs.cloudraker.com/paperwork/capabilities/redact#what-counts-as-sensitive); it does not extend them.** Sending a shorter list leaves everything outside it in the file. To keep the defaults and add to them, repeat the defaults next to your own entries.
  - minLength 1
- `instructions` (`spaceRedact.instructions`; string, optional)
  - maxLength 4000
- `mode` (`spaceRedact.mode`; string, optional)
  - one of `"targeted"`, `"lines"`
- `style` (`spaceRedact.style`; string, optional)
  - one of `"beep"`, `"silence"`
- `action` (`spaceRedact.action`; string, optional)
  - minLength 1
- `metadata` (`spaceRedact.metadata`; map<unknown>, optional) — Arbitrary JSON you attach to the run and get back on every read of it. Use it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized.
- `webhook` (`spaceRedact.webhook`; any of, optional) — Where to deliver this run's events, given one of two ways. - `{ "url": "…" }` — a one-off https endpoint for this run only. - `{ "id": "whe_…" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too. Deliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`.
  - any of:
    - `object`
      - `url` (`spaceRedact.webhook.1.url`; string, required)
        - format `uri`
    - `object`
      - `id` (`spaceRedact.webhook.2.id`; string, required)
        - minLength 1
- `ttl` (`spaceRedact.ttl`; integer, optional) — How long, in seconds, to keep this run and its files before purging them automatically. The maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently. E-signature runs are exempt — an envelope waits for its signers however long that takes.
  - min 1; max 604800; default `86400`

## Example request

```json
{
  "categories": [
    "string"
  ],
  "instructions": "string",
  "mode": "targeted",
  "style": "beep",
  "action": "string",
  "file": {
    "url": "http://example.com",
    "name": "string",
    "processing": "auto"
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "webhook": {
    "url": "http://example.com"
  },
  "ttl": 86400
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/spaces/<spaceId>/redact' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "categories": [
    "string"
  ],
  "instructions": "string",
  "mode": "targeted",
  "style": "beep",
  "action": "string",
  "file": {
    "url": "http://example.com",
    "name": "string",
    "processing": "auto"
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "webhook": {
    "url": "http://example.com"
  },
  "ttl": 86400
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/spaces/<spaceId>/redact';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    categories: ['string'],
    instructions: 'string',
    mode: 'targeted',
    style: 'beep',
    action: 'string',
    file: {url: 'http://example.com', name: 'string', processing: 'auto'},
    metadata: {property1: null, property2: null},
    webhook: {url: 'http://example.com'},
    ttl: 86400
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/spaces/<spaceId>/redact"

payload = {
    "categories": ["string"],
    "instructions": "string",
    "mode": "targeted",
    "style": "beep",
    "action": "string",
    "file": {
        "url": "http://example.com",
        "name": "string",
        "processing": "auto"
    },
    "metadata": {
        "property1": None,
        "property2": None
    },
    "webhook": { "url": "http://example.com" },
    "ttl": 86400
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The finished run.

#### Example

```json
{
  "object": "redact_run",
  "id": "string",
  "status": "queued",
  "expiresAt": "string",
  "statusUrl": "string",
  "files": [
    {
      "id": "string",
      "name": "string",
      "status": "string",
      "error": "string"
    }
  ],
  "file": {
    "id": "string",
    "name": "string",
    "status": "string",
    "error": "string"
  },
  "error": {
    "code": "string",
    "message": "string"
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "output": {
    "file": {
      "id": "string",
      "name": "string",
      "url": "string"
    },
    "files": [
      {
        "id": "string",
        "name": "string",
        "url": "string"
      }
    ],
    "entities": {
      "property1": 0,
      "property2": 0
    },
    "skipped": 0
  }
}
```

- `object` (`spaceRedact.response.200.object`; string, required)
- `id` (`spaceRedact.response.200.id`; string, required)
- `status` (`spaceRedact.response.200.status`; string, required) — Where the run is in its life. | Status | Meaning | | --- | --- | | `queued` | Accepted, not started | | `processing` | Work in flight | | `needs_input` | Waiting for an external action, such as an e-signature | | `processed` | Finished; `output` is populated | | `failed` | Finished unsuccessfully | | `cancelled` | Stopped on request | | `expired` | TTL elapsed and the data was purged | The last four are terminal.
  - one of `"queued"`, `"processing"`, `"processed"`, `"failed"`, `"cancelled"`, `"expired"`, `"needs_input"`
- `expiresAt` (`spaceRedact.response.200.expiresAt`; string | null, required)
- `statusUrl` (`spaceRedact.response.200.statusUrl`; string, required)
- `files` (`spaceRedact.response.200.files`; array<object>, required)
  - `id` (`spaceRedact.response.200.files.id`; string, required)
  - `name` (`spaceRedact.response.200.files.name`; string, required)
  - `status` (`spaceRedact.response.200.files.status`; string, required)
  - `error` (`spaceRedact.response.200.files.error`; string, optional)
- `file` (`spaceRedact.response.200.file`; object, optional)
  - `id` (`spaceRedact.response.200.file.id`; string, required)
  - `name` (`spaceRedact.response.200.file.name`; string, required)
  - `status` (`spaceRedact.response.200.file.status`; string, required)
  - `error` (`spaceRedact.response.200.file.error`; string, optional)
- `error` (`spaceRedact.response.200.error`; object, optional) — Why the run failed. Present whenever `status` is `failed`, and only then. `code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.
  - `code` (`spaceRedact.response.200.error.code`; string, required)
  - `message` (`spaceRedact.response.200.error.message`; string, required)
- `metadata` (`spaceRedact.response.200.metadata`; map<unknown>, optional)
- `output` (`spaceRedact.response.200.output`; object, optional) — The redacted files. Present once `status` is `processed`. `files[]` holds the new documents — `file` is an alias of the first for single-file runs — each with a signed download link. A `/v1/redact` call takes one input, so it returns at most one file; a `redact` pipeline step over many files returns one per input that had a match. `entities` tallies what was removed per category. Its keys are open, not a closed set: a finding the `categories` list does not cover reports under its own label. `skipped` counts documents that contained nothing to redact and so produced no new file.
  - `files` (`spaceRedact.response.200.output.files`; array<object>, required)
    - `id` (`spaceRedact.response.200.output.files.id`; string, required)
    - `name` (`spaceRedact.response.200.output.files.name`; string, required)
    - `url` (`spaceRedact.response.200.output.files.url`; string, optional)
  - `file` (`spaceRedact.response.200.output.file`; object, optional)
    - `id` (`spaceRedact.response.200.output.file.id`; string, required)
    - `name` (`spaceRedact.response.200.output.file.name`; string, required)
    - `url` (`spaceRedact.response.200.output.file.url`; string, optional)
  - `entities` (`spaceRedact.response.200.output.entities`; map<number>, optional)
  - `skipped` (`spaceRedact.response.200.output.skipped`; number, optional)

### 202

Accepted — still running, or awaiting human input.

#### Example

```json
{
  "object": "string",
  "id": "string",
  "status": "queued",
  "statusUrl": "string",
  "envelopeUrl": "string"
}
```

- `object` (`spaceRedact.response.202.object`; string, required)
- `id` (`spaceRedact.response.202.id`; string, required)
- `status` (`spaceRedact.response.202.status`; string, required) — Where the run is in its life. | Status | Meaning | | --- | --- | | `queued` | Accepted, not started | | `processing` | Work in flight | | `needs_input` | Waiting for an external action, such as an e-signature | | `processed` | Finished; `output` is populated | | `failed` | Finished unsuccessfully | | `cancelled` | Stopped on request | | `expired` | TTL elapsed and the data was purged | The last four are terminal.
  - one of `"queued"`, `"processing"`, `"processed"`, `"failed"`, `"cancelled"`, `"expired"`, `"needs_input"`
- `statusUrl` (`spaceRedact.response.202.statusUrl`; string, required)
- `envelopeUrl` (`spaceRedact.response.202.envelopeUrl`; string, optional)

### 400

Invalid request (`invalid_request` / `invalid_schema`).

### 422

Unusable input file or webhook endpoint.

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`spaceRedact.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`spaceRedact.response.429.message`; string, required)
- `retryable` (`spaceRedact.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`spaceRedact.response.429.requestId`; string, required)
- `docUrl` (`spaceRedact.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/spaces/space-redact/index.md
