Skip to main content
POST
/
documents
/
add-password
curl --request POST \ --url https://api.luminpdf.com/v1/documents/add-password \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <api-key>' \ --data ' { "document_id": "695dd6880d951f4de70a7c5d", "password": "YOUR_PDF_PASSWORD" } '
{
  "document_name": "<string>",
  "signed_url": "<string>",
  "expires_at": 123
}
This endpoint requires the following scope:pdf:files

Authorizations

X-API-Key
string
header
required

Provide your API key in the X-API-Key header, e.g., X-API-Key: YOUR_API_KEY.

Body

application/json
password
string
required

The new password to apply to the document.

Required string length: 4 - 32
document_id
string

Lumin document ID of the PDF. Required when file_url is not provided. Takes priority if both are provided.

To obtain a document ID, upload the file to Lumin first using Upload Document.

file_url
string<uri>

Publicly accessible URL of the PDF file. Required when document_id is not provided. Ignored if document_id is also provided.

document_name
string

Name of the output file. Defaults to protected_{original document name}.

Required string length: 1 - 255
current_password
string

The document's existing password. Required if the document is already password-protected.

Response

Returns a temporary download URL for the password-protected PDF.

document_name
string
required

Name of the output document.

signed_url
string<uri>
required

Temporary HTTPS URL to download the output file. Expires after 30 minutes.

expires_at
integer<unix-epoch>
required

Unix epoch timestamp (in milliseconds) when signed_url becomes invalid.