Unlock PDF API

Remove Passwords and Encryption from PDF Files Programmatically.

hero banner

Code Examples in Popular Languages

Integrate our Unlock PDF API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/unlock-pdf' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'file=@"/D:/laragon/www/new-toc/public/api-uploads/locked.pdf"' \
--form 'password="123"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("file", fileInput.files[0], "/D:/laragon/www/new-toc/public/api-uploads/locked.pdf");
formdata.append("password", "123");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/unlock-pdf", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/unlock-pdf"

payload = {'password': '123'}
files=[
  ('file',('locked.pdf',open('/D:/laragon/www/new-toc/public/api-uploads/locked.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/unlock-pdf"

payload = {'password': '123'}
files=[
  ('file',('locked.pdf',open('/D:/laragon/www/new-toc/public/api-uploads/locked.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/laragon/www/new-toc/public/api-uploads/locked.pdf', 'r'),
      'filename' => '/D:/laragon/www/new-toc/public/api-uploads/locked.pdf',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ],
    [
      'name' => 'password',
      'contents' => '123'
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/unlock-pdf', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("file","/D:/laragon/www/new-toc/public/api-uploads/locked.pdf",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/laragon/www/new-toc/public/api-uploads/locked.pdf")))
  .addFormDataPart("password","123")
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/unlock-pdf")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/unlock-pdf"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  file, errFile1 := os.Open("/D:/laragon/www/new-toc/public/api-uploads/locked.pdf")
  defer file.Close()
  part1,
         errFile1 := writer.CreateFormFile("file",filepath.Base("/D:/laragon/www/new-toc/public/api-uploads/locked.pdf"))
  _, errFile1 = io.Copy(part1, file)
  if errFile1 != nil {
    fmt.Println(errFile1)
    return
  }
  _ = writer.WriteField("password", "123")
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("https://theonlineconverter.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/v1/unlock-pdf", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddFile("file", "/D:/laragon/www/new-toc/public/api-uploads/locked.pdf");
request.AddParameter("password", "123");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our API provides a secure and efficient way to manage PDF permissions and remove encryption.

Simple User Interface

Effective Password Removal

Successfully removes both "user" (open) and "owner" (permissions) passwords from a PDF, provided the correct password is supplied.

Simple Data Format

Full Permission Unlocking

Removes all document restrictions, enabling actions like printing, copying text and images, form filling, and content editing on the output file.

Time

Supports Standard Encryption

Capable of decrypting PDFs secured with standard encryption algorithms, including 128-bit RC4 and 256-bit AES.

Secure Data

Automated Decryption

Integrate into your systems to automatically unlock batches of PDFs that you have the credentials for, streamlining content processing pipelines.

Universal Access

Error Handling

The API provides a clear error response if an incorrect password is provided, allowing your application to handle authentication failures gracefully.

Freedom

Secure & Confidential

All files and passwords are sent over encrypted connections. We never log or store your passwords, and files are permanently deleted after processing.

Frequently Asked Questions

Find answers to common questions about our Unlock PDF API to understand its function and security.

No. This is not a password recovery tool. You must provide the correct, existing password for the API to successfully unlock the document. It cannot bypass or "crack" a password you do not know.

You can provide either the user (open) password or the owner password. Supplying either one will result in a completely decrypted PDF with all permissions unlocked.

The API will fail to decrypt the file and will return a specific error code indicating that the password was incorrect. Your application can then handle this failure as needed.

No. Your original file is never altered. The API reads the source file, decrypts it, and creates a new, unlocked version for you to download.

The API supports all standard PDF encryption methods, including 40-bit RC4, 128-bit RC4, 128-bit AES, and the highly secure 256-bit AES.

Yes. All communication with our API is protected by end-to-end TLS encryption, the same standard used for online banking. We do not log or store your passwords, and they are only used for the duration of the decryption transaction.

You would send one API request per file you wish to unlock. This can be easily scripted or automated in your code to process a large batch of files sequentially.