Tutorial
Document Processing
8 min reading

How to Redact Documents (PDF, JPG, PNG) using JavaScript

Summarize this article with:

summary
  • 1.
  • Eden AI provides several advantages: multiple AI providers to compare results, easy integration with a single API key, and cost efficiency with pay-as-you-go pricing.
  • Document redaction is essential for protecting sensitive information in compliance-heavy environments.
  • You'll need an Eden AI account and API key.
  • With Eden AI's standardized API and ready-to-use code examples, most developers can integrate the feature in under an hour.

In this tutorial, you will learn how to use the Document Redaction API in 5 minutes using JavaScript. Eden AI provides an easy and developer-friendly API that allows you to redact sensitive information from your documents.

What is the Document Redaction API?

Document redaction refers to the process of removing, obscuring, or blanking out sensitive or confidential information from documents.

This could include personal details like names, addresses, social security numbers, financial data, or any other sensitive content that must be protected for privacy or legal reasons.

Getting Started with Document Redaction

Set Up Your Eden AI Account

1. Sign Up: If you don't have an Eden AI account, create a free here. Once you do that you can obtain your API key, which you can use to access Document Redaction.

2. Access the Redaction Feature: Once logged in, go to the document section of the platform.

3. Choose the Redaction feature: Select the Redaction tool.

How to Implement Document Redaction API using JavaScript?

Eden AI allows you to redact a file from a URL or from a local file.

Redact from a URL

const axios = require("axios").default;
const options = {
method: "POST",
url: "https://api.edenai.run/v2/ocr/anonymization",
headers: { Authorization: "Bearer YOUR_API_TOKEN" },
data: { providers: ["microsoft"], file_url: "https://your-file-url.com/document.pdf" },
};
axios.request(options).then((response) => { console.log(response.data); }).catch((error) => { console.error(error); });

Redact from a local file

const axios = require("axios").default;
const fs = require("fs");
const FormData = require("form-data");
const form = new FormData();
form.append("providers", "microsoft");
form.append("file", fs.createReadStream("path/to/your/document.pdf"));
const options = { method: "POST", url: "https://api.edenai.run/v2/ocr/anonymization", headers: { Authorization: "Bearer YOUR_API_TOKEN", ...form.getHeaders() }, data: form };
axios.request(options).then((response) => { console.log(response.data); }).catch((error) => { console.error(error); });

Why Eden AI is the Best for Document Redaction

Eden AI provides several advantages: multiple AI providers to compare results, easy integration with a single API key, and cost efficiency with pay-as-you-go pricing.

Conclusion

Document redaction is essential for protecting sensitive information in compliance-heavy environments. Eden AI's Document Redaction API makes it easy to integrate this capability into JavaScript applications with just a few lines of code.

Sign up for free on Eden AI and start redacting documents today!

FAQ — Redact Documents (PDF, JPG, PNG)

You need an API key from your chosen AI provider. Eden AI lets you access multiple providers with a single key, removing the need for separate vendor accounts.
Any language that supports HTTP requests works — Python, JavaScript, PHP, Ruby, Go, and more. Ready-to-use code snippets are available for the most common languages.
Most developers complete a basic integration in under an hour using standardized API endpoints and ready-to-use code examples.
Implement exponential backoff for rate limit errors and use try-catch blocks for network failures. Eden AI's built-in fallback routing automatically redirects requests if a provider is unavailable.
Eden AI supports GDPR-compliant provider filtering and does not store or reuse your data, ensuring compliance with European privacy regulations.

Similar articles

Tutorial
Generative AI
How to Generate Videos Using Python
9/4/2025
·
Written byTaha Zemmouri
let’s start

Start building with Eden AI

A single interface to integrate the best AI technologies into your products.