Security
Password protect and encrypt PDF
Add password protection and set permissions on a PDF document.
Password Types
- User Password (document open password): Required to open and view the PDF
- Owner Password (permissions password): Required to change restrictions
Recipients don't need the owner password to open the document, only to modify permissions.
Encryption Algorithms
| Algorithm | Security Level | Compatibility |
|---|---|---|
| Standard40Bit | Low | Acrobat 3+ |
| Standard128Bit | Medium | Acrobat 5+ |
| Aes128Bit | High | Acrobat 7+ |
| Aes256Bit | Highest | Acrobat 9+ (recommended) |
Permissions
Control what users can do with the document:
| Permission | Description |
|---|---|
| print_document | Allow printing |
| print_faithful_copy | Allow high-quality printing |
| copy_contents | Allow copy/paste of text and graphics |
| modify_contents | Allow editing document content |
| modify_annotations | Allow adding comments and form fields |
| fill_form_fields | Allow filling forms and signing |
| extract_contents | Allow text/graphic extraction |
| assemble_document | Allow page manipulation (insert, delete, rotate) |
Example
import httpx
response = httpx.post(
"https://api.filegraph.ai/security/pdf/lock",
headers={"X-API-Key": "your-api-key"},
files={"file": open("document.pdf", "rb")},
data={
"user_password": "openme123",
"owner_password": "admin456",
"encryption_algorithm": "Aes256Bit",
"print_document": "true",
"copy_contents": "false"
}
)
post/security/pdf/lock
Request
- Base URL: https://api.filegraph.ai (the document declares no server; this is the origin it was published from)
- URL: https://api.filegraph.ai/security/pdf/lock
- Auth: API key in header X-API-Key
Response
Successful Response
Example response
{
"content_base64": "JVBERi0xLjQK...",
"content_type": "application/pdf",
"encryption_algorithm": "Aes256Bit",
"filename": "protected.pdf",
"has_owner_password": true,
"has_user_password": true,
"permissions": [
"print",
"copy"
],
"size_bytes": 102400
}Changes
No recorded changes to this operation across all 1 revision of this API.