Free plan

Protect / unprotect Office file

Lock an Office file with a password, or remove the lock
POST
/v1/documents/protect

About this tool

This tool adds a password that is needed to open a Word, Excel or PowerPoint file, using strong encryption. It can also remove the password if you know it, mark the file as read-only recommended, or remove editing limits that have no password. You can also just check what protection a file has. Do not forget the password; it cannot be recovered.
For example, you lock a Word file with a password before sending it by e-mail.

How to use it

  1. Choose this tool.
  2. Add your Word, Excel or PowerPoint file.
  3. Choose what to do: check, add a password, remove a password, or the read-only options.
  4. Type the password if the action needs one.
  5. Press Generate.

What you get back

You get a new protected or unprotected file to download, or a short report on screen if you only checked.
GOOD TO KNOW
A forgotten password cannot be recovered. A restriction protected by a password is refused, not removed. OpenDocument files cannot be encrypted here. Counts as one document.
TEST IT LIVE

Try Protect / unprotect Office file in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/protect
Tool ID
documents.protect
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/protect" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'operation=status' \
  -F 'password=a long passphrase' \
  -F 'response=url'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.protect({
    "file": 'document.pdf',
    "operation": "status",
    "password": "a long passphrase",
    "response": "url"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->protect([
    'file' => 'document.pdf',
    'operation' => 'status',
    'password' => 'a long passphrase',
    'response' => 'url',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Give a Word, Excel or PowerPoint file an opening password (AES-256 Office encryption) or take it off with the password, mark a file read-only recommended, remove editing restrictions that have no password, or check what protection a file has.

Protect / unprotect Office file works from text and settings, so no file is needed. Every input is optional.

Protect / unprotect Office file is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/protect with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.