endpoint
Metadata
POST /api/v1/metadata
Read or update the PDF info dict (title, author, subject, keywords, producer, creator, dates).
credits: 1returns: application/json (action=get) or application/pdf (action=set)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | multipart file | required | Source PDF. |
| action | "get" | "set" | required | Read or write. |
| metadata | JSON string | optional | Required when action=set. |
| replace | boolean | optional | Clear fields not present in `metadata`. |
Examples
curl
curl -X POST https://api.snappdf.au/api/v1/metadata \
-H "Authorization: Bearer $SNAPPDF_API_KEY" \
-F "file=@doc.pdf" -F "action=set" \
-F 'metadata={"title":"Quarterly Report","author":"Finance Team"}' \
-o tagged.pdfJavaScript
await snap.pdf.setMetadata({ file: bytes, metadata: { title: 'Quarterly Report', author: 'Finance Team' } });Python
snap.pdf.set_metadata(file=bytes, metadata={"title": "Quarterly Report", "author": "Finance Team"})PHP
$snap->pdf->setMetadata(file: $bytes, metadata: ['title' => 'Quarterly Report', 'author' => 'Finance Team']);Ruby
snap.pdf.set_metadata(file: bytes, metadata: { title: 'Quarterly Report', author: 'Finance Team' })Go
client.SetMetadata(ctx, &snappdf.SetMetadataInput{File: bytes, Metadata: map[string]any{"title": "Quarterly Report", "author": "Finance Team"}})