PDFHQ logo

Documents

DocumentationPDF operations

Annotate PDF API

Add extractable text, coloured highlights and rectangle overlays with precise coordinates.

Server-side API keys Signed storage uploads

Endpoint and task semantics#

Operation code: annotate

Start this operation with POST /v1/tasks and the tool code shown above. Upload and attach source PDFs (or use task-scoped upload endpoints), then call POST /v1/tasks/{task_id}/process with operation settings.

Review a report, add approval notes or visually mark regions without editing underlying text.

Inputs: One verified PDF; 1–200 annotations on up to 500 unrotated pages.

Configuration and extra parameters#

SettingTypeBehaviour
annotationsrequired object[]Each annotation requires kind ('text', 'highlight' or 'rectangle'), page (1-based), x0/y0/x1/y1 in PDF points, and color (yellow,blue,red,green,black). Text requires text and font_size (6–48).

Options are validated by the API. Unknown settings and unsupported values return an error instead of being ignored.

Working request sequence#

Programming language: cURL

Choose a language · scroll horizontally for all 10 SDK languages

API example · cURL
# Server-side API calls. Save the returned task_id.
curl -fsS -X POST 'https://api.pdfhq.io/v1/tasks' \
  -H 'x-api-key: YOUR_API_KEY' -H 'Content-Type: application/json' \
  -d '{"tool":"annotate"}'

# Upload and verify 1 PDF(s), then obtain and approve a credit quote:
curl -fsS 'https://api.pdfhq.io/v1/tasks/TASK_ID/quote' -H 'x-api-key: YOUR_API_KEY'

# ONLY after explicit customer approval:
test "$PDFHQ_APPROVE_QUOTE" = yes || { echo "Approval required" >&2; exit 1; }
curl -fsS -X POST 'https://api.pdfhq.io/v1/tasks/TASK_ID/process' \
  -H 'x-api-key: YOUR_API_KEY' -H 'Content-Type: application/json' \
  -d '{"options":{"annotations":[{"kind":"text","page":1,"x0":50,"y0":100,"x1":420,"y1":175,"color":"blue","text":"Reviewed","font_size":16}]}}'

curl -fsS 'https://api.pdfhq.io/v1/tasks/TASK_ID' -H 'x-api-key: YOUR_API_KEY'

After starting a task, upload and verify PDFs, review the credit quote, and get explicit approval before processing. API keys belong on your server, never on signed storage uploads.

All 10 SDKs ↓Complete Python walkthrough ↓ Complete Bash/cURL walkthrough ↓ All endpoints → Direct uploads → Error handling →

Generated downloadable packages cover the task workflow only. Full-service SDKs require a verified runtime OpenAPI specification; the Python, JavaScript and TypeScript task SDKs stream file uploads; the other languages require signed multipart uploads implemented by the caller.

The returned task ID is used for both status polling and retrieval. After the task succeeds, request a signed output URL rather than embedding a download secret.

Output and important details#

A new PDF with real visible overlay text/shapes. It is not a secure redaction.

This adds visual content; it does not modify existing text or permanently erase underlying information. Use Redact PDF for confidentiality; digital signatures are rejected.

Errors, retries and billing
PDFHQ logo

PDF tools and document intelligence. Prepare, understand and work with your documents.

© 2026 PDFHQ. All rights reserved.