---
title: PDF Restrict API Reference
version: 1.0.0
description: Restrict a PDF file with permission controls. Set printing, copying, and editing restrictions with an owner password.
openapi: 3.1.1
servers:
  - https://api.apifreaks.com/v1.0
paths: 1
operations: 1
schemas: 3
---

## Table of Contents

- [PDF Restrict API Reference v1.0.0](#pdf-restrict-api-reference-v100)
  - [Authentication](#authentication)
  - [PDF Security APIs](#pdf-security-apis)
    - [restrictPdf](#restrictpdf)
      - [Parameters](#parameters)
      - [Responses](#responses)
  - [Schemas](#schemas)
    - [PDFResponse](#pdfresponse)
    - [PdfFileUploadRequest](#pdffileuploadrequest)
    - [ErrorResponse](#errorresponse)



# PDF Restrict API Reference v1.0.0

Restrict a PDF file with permission controls. Set printing, copying, and editing restrictions with an owner password.

Base URLs:

* [https://api.apifreaks.com/v1.0](https://api.apifreaks.com/v1.0)

## Authentication

* API Key (ApiKeyAuthHeader)
    - Parameter Name: **X-apiKey**, in: header. Pass your API key via the X-apiKey request header.

* API Key (ApiKeyAuthQuery)
    - Parameter Name: **apiKey**, in: query. Pass your API key via the apiKey query parameter.

## PDF Security APIs

### restrictPdf

`POST /pdf/restrict`

*Apply permission restrictions on a PDF file*

This API applies permission restrictions on a PDF file, such as disabling printing, copying, or editing. This can include password protection to enforce restrictions.

> Body parameter

```yaml
file: string

```

#### Parameters

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|format|query|string|false|Specifies the desired format for the API response. Choose 'json' for a JSON object or 'xml' for an XML structure.|
|file_id|query|string|false|The unique ID of a PDF file already uploaded to the API Freaks server. Use this as an alternative to uploading a new file directly.|
|destroy|query|boolean|false|If set to `true`, the input file(s) will be permanently deleted from the server immediately after the output PDF is generated.|
|output|query|string|false|The desired name for the output restricted PDF file. If not provided, a default name will be assigned.|
|file_password|query|string|false|The password to unlock the input file if it is already secured. Provide the owner password if available; otherwise, the user password. The owner password takes precedence. Password Length should be between 6 and 128 characters.|
|user_password|query|string|true|Sets the password users will use to open the PDF. If this is not set, only the owner password will be configured, and anyone can open the PDF file with the provided restrictions enabled. Password Length should be between 6 and 128 characters.|
|owner_password|query|string|false|Sets the password that allows full access to the PDF (e.g., removing restrictions). If not provided, the `user_password` (if set) will also be used as the owner password. Password Length should be between 6 and 128 characters.|
|restrictions|query|string|true|A comma-separated list of restrictions to apply to the PDF. These define what the end-user is *not* allowed to do with the PDF. Available options are:|
|webhook_url|query|string|false|The URL to which the webhook notification will be sent after the task is completed.|
|webhook_failure_notification|query|boolean|false|If true, a notification will also be sent by email in case the webhook request fails all the retries.  The email notification will be sent to the requesting user or their organization’s admin if part of one.|
|X-Webhook-Authorization|header|string|false|Optional custom header for webhook requests. Format: `Key:Value` (e.g., `Authorization:Bearer token123`). This will be sent as an HTTP header in the webhook call.|
|body|body|[PdfFileUploadRequest](#pdffileuploadrequest)|false|Multipart form-data body carrying the PDF file to restrict. Alternatively, reference an already-uploaded file via the file_id query parameter instead of uploading here.|

##### Detailed descriptions

**restrictions**: A comma-separated list of restrictions to apply to the PDF. These define what the end-user is *not* allowed to do with the PDF. Available options are:

* **print_high** – Disables high-quality printing.
* **print_low** – Disables low-resolution printing.
* **edit_document_assembly** – Prevents reordering or inserting pages.
* **fill_form_fields** – Disallows filling in PDF form fields.
* **edit_annotations** – Disables adding or modifying annotations or comments.
* **modify_content** – Prevents modifying existing content in the PDF.
* **copy_and_extract_content** – Disables copying text or images from the PDF.
* **use_accessibility** – Prevents screen readers or accessibility tools from accessing content. An invalid restriction keyword returns a 400 with error "Invalid PDF Restriction".

##### Enumerated Values

|Parameter|Value|
|---|---|
|format|json|
|format|xml|

> Example responses

> PDF restrict successfully

```json
{
  "taskId": "42839406-7e1b-4f64-96bb-d94bb054e8d3",
  "inputIds": [
    "2c682ade-eccc-4ab5-9c06-d16e415cbecb"
  ]
}
```

> Bad Request — Missing/invalid parameters, file ID, or password

```json
{
  "error": "Invalid Param Exception",
  "message": "please pass correct parameters",
  "path": "/v1.0/pdf/restrict",
  "status": 400,
  "timestamp": "2026-07-27T10:57:14.449Z"
}
```

```json
{
  "timestamp": "2026-07-27T10:57:25.953Z",
  "path": "/v1.0/pdf/restrict-pdf",
  "status": 400,
  "error": "Missing File or ID",
  "message": "Please provide either a file or a file ID."
}
```

```json
{
  "timestamp": "2026-07-27T10:57:24.835Z",
  "path": "/v1.0/pdf/restrict",
  "status": 400,
  "error": "Invalid File ID Provided",
  "message": "Please provide a valid file ID"
}
```

```json
{
  "timestamp": "2026-07-27T10:57:15.634Z",
  "path": "/v1.0/pdf/restrict-pdf",
  "status": 400,
  "error": "Weak Password Provided",
  "message": "Please provide a strong password. Refer to the documentation for password requirements."
}
```

```json
{
  "timestamp": "2026-07-27T10:57:16.268Z",
  "path": "/v1.0/pdf/restrict-pdf",
  "status": 400,
  "error": "Invalid PDF Restriction",
  "message": "Please provide valid PDF restrictions. Refer to the documentation for valid PDF restrictions."
}
```

> Unsupported Media Type — File type not supported

```json
{
  "timestamp": "2026-07-27T10:57:25.374Z",
  "path": "/v1.0/pdf/restrict-pdf",
  "status": 415,
  "error": "Unsupported File Type",
  "message": "The provided file type is not supported. Refer to the documentation for valid file types."
}
```

#### Responses

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|PDF restrict successfully|[PDFResponse](#pdfresponse)|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request — Missing/invalid parameters, file ID, or password|[ErrorResponse](#errorresponse)|
|415|[Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13)|Unsupported Media Type — File type not supported|[ErrorResponse](#errorresponse)|

#### Response Headers

|Status|Header|Type|Format|Description|
|---|---|---|---|---|
|200|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|400|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|415|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|

To perform this operation, you must be authenticated by means of one of the following methods:
ApiKeyAuthHeader, ApiKeyAuthQuery

## Schemas

### PDFResponse

Response containing the task ID and input file IDs for a PDF processing task.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|taskId|string|true|none|Task ID of the requested task, used to check the task status.|
|inputIds|[string]|false|none|File IDs for the input files provided for the task. Not returned when destroy parameter is true.|

### PdfFileUploadRequest

Multipart form-data request body containing the PDF file to process.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|file|string(binary)|false|none|Raw PDF file bytes sent as a multipart/form-data field named 'file'. Omit this field entirely and pass file_id in the query string instead to use an already-uploaded file.|

### ErrorResponse

Standard error envelope returned by the API on failed requests.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|string|false|none|Short error category or exception type.|
|message|string|true|none|Human-readable error message describing the failure.|
|path|string|false|none|API endpoint path that produced the error.|
|status|integer|false|none|HTTP status code returned with the error.|
|timestamp|string(date-time)|false|none|Timestamp when the error occurred (ISO 8601).|
