Flatten PDF API

Flatten preexisting annotations in PDF files to prevent unauthorized edits with our PDF flattening API.

Try It Out

This example will flatten all the annotations in your supplied document into the PDF. This ensures they’re no longer editable.


Use Your Free Credits

Sign up to get 100 free credits, or log in to automatically add your API key to sample code.

Add a File

Add an annotated PDF named document.pdf to your project folder. You can also use our sample file. The file name is case sensitive. Make sure the file name matches the file name in the sample code.

Run a Command

Copy the curl command and run it in that same folder via the terminal or your editor’s terminal.

View the Results

Open result.pdf in your project folder to view the results.

    curl -X POST https://api.pspdfkit.com/build \
        -H "Authorization: Bearer your_api_key_here" \
        -o result.pdf \
        -F document=@document.pdf \
        -F instructions='{
            "parts": [
              { "file": "document" }
            "actions": [
              { "type": "flatten" }

Using Postman? Download our official collection and start using the API with a single click. Read more 

Your API Key