Remove PDF pages

Drop the pages you do not need from a PDF with a single API call.

Overview

The Remove PDF Pages endpoint takes a PDF and a list of page numbers, and returns a link to a copy of the PDF without those pages.

Removing pages

Send a POST request to the following endpoint:

POST https://www.givemepdf.com/api/v1/pdf/remove-pages

Credits required: 1 / 50 pages

The cost is based on the page count of the uploaded file, not on how many pages you remove, with a minimum of 1 credit: 1–50 pages cost 1 credit, 51–100 pages cost 2 credits and a 500-page PDF costs 10 credits. Credits are only charged when the request succeeds.

Authentication

Every API call must include an API-KEY header.

You can find your API key in your dashboard.

Request body

Send the request as multipart/form-data.

Parameter Accepted value Required
file A PDF file up to 20 MB and 500 pages Yes
pages[] The 1-based page numbers to remove, one pages[] field per page. You can also send a single pages field like 2, 4-6. Yes
document_name String, up to 60 characters No

Example

curl -X POST https://www.givemepdf.com/api/v1/pdf/remove-pages \
  -H "API-KEY: your-api-key" \
  -F "file=@contract.pdf" \
  -F "pages[]=2" \
  -F "pages[]=5"

Response

When the pages are removed, you will receive a JSON response with status code 200. Here is a sample response:

{
    "message": "OK",
    "data": {
        "location": "https://givemepdf.com/storage/8b6293cb05ee815c/ossrPslsisxeRLp0.pdf",
        "page_count": 5,
        "credit_used": 1,
        "file_ttl_days": 1,
        "warning": "This file is available for 1 day(s). Please download as soon as possible."
    },
    "meta": {
        "remaining_free_credit": 3470,
        "remaining_paid_credit": 10000
    }
}

Possible errors

Status Message How to fix it
401 Unauthorized API-KEY missing Make sure your request includes the API-KEY header with a value.
401 Unauthorized Invalid API Key Your API key is incorrect, expired or revoked. Sign in to your dashboard to copy a valid key or generate a new one.
402 Payment Required This 120-page PDF costs 3 credits. You have 1 credit left. The cost depends on the page count of the uploaded file. Top up your credits and try again.
422 Unprocessable Entity Page 9 does not exist. This PDF has 7 pages. Only send page numbers that exist in the uploaded PDF.
422 Unprocessable Entity You cannot remove every page of the PDF. Keep at least one page.
422 Unprocessable Entity This PDF has 640 pages. The maximum is 500. Split the PDF into smaller files first.
422 Unprocessable Entity This file is not a readable PDF. The file is damaged or not a PDF.
422 Unprocessable Entity Password protected or encrypted PDFs are not supported. Remove the password from the PDF and try again.
500 Internal Server Error Could not remove pages from this PDF. Something went wrong while processing the file. No credits were charged. If the problem persists, contact us. Contact us

Troubleshooting

  • Links and bookmarks that point to a removed page are dropped.
  • Page numbers always refer to the original file, starting at 1.