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

# POST /v1/pdf/protect

> Password-protect a PDF document. Currently disabled.

# Protect PDF

`POST https://api.getdeckle.dev/v1/pdf/protect`

<Warning>
  **This endpoint is temporarily disabled.** Earlier behavior only set
  document metadata and did not apply real AES encryption — that
  misrepresentation has been removed. Calls now return `501 Not
      Implemented` until a qpdf-backed encryption path is wired up. Watch the
  changelog for availability.
</Warning>

Add password protection and permission controls to a PDF document.

## Request Body

| Parameter | Type | Required | Description |
| - | - | - | - |
| `pdf` | string | Yes | Base64-encoded PDF document |
| `owner_password` | string | Yes | Owner password (grants full access) |
| `user_password` | string | No | User password (required to open the document) |
| `permissions` | object | No | Permission flags (see below) |
| `output` | string | No | `"url"` (default) or `"base64"` |

### Permissions

| Parameter | Type | Default | Description |
| - | - | - | - |
| `printing` | boolean | `true` | Allow printing the document |
| `copying` | boolean | `false` | Allow copying text and images |
| `modifying` | boolean | `false` | Allow modifying the document |

## Example

```bash theme={null}
curl -X POST https://api.getdeckle.dev/v1/pdf/protect \
  -H "Authorization: Bearer dk_live_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "pdf": "<base64-encoded-pdf>",
    "owner_password": "owner-secret-123",
    "user_password": "open-me-456",
    "permissions": {
      "printing": true,
      "copying": false,
      "modifying": false
    }
  }'
```

## Response (URL mode)

```json theme={null}
{
  "url": "https://cdn.getdeckle.dev/gen_abc123.pdf",
  "file_size": 52400,
  "protected": true
}
```

## Response (base64 mode)

```json theme={null}
{
  "data": "<base64-encoded-protected-pdf>",
  "file_size": 52400,
  "protected": true
}
```

## Errors

| Status | Code | Description |
| - | - | - |
| 400 | `VALIDATION_ERROR` | Missing owner password or PDF exceeds size limit |
| 401 | `UNAUTHORIZED` | Invalid or missing API key |
| 429 | `RATE_LIMITED` | Too many requests |
| 500 | `INTERNAL_ERROR` | Server error during protection |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.