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

# Document Redaction

> Configure document redaction in Affinda to mask or remove sensitive data such as PII before exporting redacted versions of documents downstream.

While the most common export from the Affinda platform is structured data to be ingested into a downstream system, Affinda also offers document redaction capabilities on any document type. With these redaction capabilities, we edit the PDF so that the original text is completely removed and not just masked by an overlay.

<Card title="Resume Redaction" href="/resumes/resume-redactor">
  Click here for information about our pre-configured Resume Redactor.
</Card>

## Configuring a Document Type for redaction

The steps to create a new Document Type that is suitable for redaction are very similar to those required for the typical extraction of structure data.

1. [Follow this tutorial to create your new Document Type](/academy/model-creation)
2. Edit every field to ensure 'Allow Multiple Values' (found in Advanced Settings) is enabled (this ensures that if a field is repeated within the document, each version is redacted)
3. Upload documents to view fields to be redacted in the document validation interface
4. (optionally) Edit and update model predictions
5. Use the **Get Redacted Document** endpoint to return a redacted PDF version of the original document

<Note>
  Get in contact with the Affinda team to discuss your redaction use case and to enable a 'redaction' setting on your document type that will optimise for this output
</Note>

<img className="border-2 border-gray-300 rounded-lg" src="https://mintcdn.com/affinda-44/8O48gu_z8QeuNsDM/images/redacted.jpg?fit=max&auto=format&n=8O48gu_z8QeuNsDM&q=85&s=e90757e330947329224c453f593bd3e8" alt="Redacted Document example" style={{ width:"100%" }} width="1519" height="901" data-path="images/redacted.jpg" />

## Exporting redacted file via API

```bash theme={null}
curl -L -X GET "https://api.affinda.com/v3/documents/<DOCUMENT_ID>/redacted" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -o redacted_<DOCUMENT_ID>.pdf
```

### Frequently Asked Questions about Redaction

<AccordionGroup>
  <Accordion title="What if the model only redacted the first instance of a field?">
    To ensure the model redacts every version of the field on your document, you need to enable 'allow multiple' in your fields configuration.

    To do this, go to your Configure Document Type Interface >Locate your field > navigate to Advanced Settings > enable "Allow Multiple Values"

    <Tip>
      For Redaction, we recommend setting all fields to "Allow Multiple Values" to avoid this issue.
    </Tip>
  </Accordion>

  <Accordion title="How do I improve the performance of my redaction?">
    The performance of the redaction is determined by the performance of the underlying extraction model. To improve, we recommend adding more example documents and validating correct example documents to build Model Memory.

    Follow the [Improving Model Accuracy Tutorial](/academy/improving-accuracy) for step-by-step instructions.
  </Accordion>
</AccordionGroup>
