Write Metadata
This endpoint updates the XMP metadata of one or more PDF files.
Use the metadata form field to inject XMP metadata into the generated PDF. This allows you to set properties like
Author, Title, Copyright, and Keywords by passing a JSON-formatted object.
Valid Keys
Not all metadata tags are writable. Gotenberg relies on ExifTool for this operation. See the XMP Tag Name documentation for a list of potential keys.
Compliance Warning
Writing metadata involves modifying the PDF structure and usually breaks PDF/A compliance.
POST/forms/pdfengines/metadata/write
Headers
Gotenberg-Output-Filenamestring
The filename of the resulting file - Gotenberg automatically appends the file extension. Defaults to a random UUID filename.
Gotenberg-Tracestring
A custom request ID to identify the request in the logs; overrides the default UUID.
Form Fields
metadatajsonrequired
The metadata to write (JSON format). e.g. `{"Author": "Gotenberg"}`
Form Files
filesfile[]required
PDF files to update.
Example Request
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/metadata/write \
--form files=@/path/to/file.pdf \
--form 'metadata={"Author":"Gotenberg","Producer":"Gotenberg","Keywords":["guide","documentation"]}' \
-o my.pdf
Responses
- 200 OK
- 400 Bad Request
- 503 Service Unavailable
The updated PDF file.
Content-Disposition: attachment; filename={output-filename.pdf}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}
The request had one ore more invalid form fields.
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
The request did not complete within the configured maximum duration.
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: Service Unavailable
