---
title: "Import and export XFDF PDF annotation data server-side"
canonical_url: "https://www.nutrient.io/guides/document-engine/annotations/import-and-export/xfdf/"
md_url: "https://www.nutrient.io/guides/document-engine/annotations/import-and-export/xfdf.md"
last_updated: "2026-05-25T09:22:39.175Z"
description: "Learn how to import XFDF annotations into PDFs using Nutrient’s Document Engine, ensuring better file synchronization and management of existing annotations."
---

# Import and export Instant XFDF PDF annotation data

XFDF is an XML-like standard from Adobe [XFDF (ISO 19444-1:2016)](https://www.iso.org/obp/ui/#iso:std:iso:19444:-1:ed-1:v1:en) for encoding annotations and forms. It’s compatible with Adobe Acrobat and several other third-party frameworks.

XFDF has various limitations. In most cases, using [Instant JSON] will result in a smaller file and better synchronization.

## Importing XFDF

Document Engine supports importing annotations from an XFDF file when uploading a document via the `/api/documents` endpoint. Send a `multipart/form-data` `POST` request including the PDF and the XFDF file to import the annotations in the given PDF file. This will replace all existing annotations in the uploaded PDF with the annotations from the uploaded XFDF file. If you want to keep the existing annotations in the document, you can set `keep_current_annotations` to `true`:

**Request**

```http

POST /api/documents
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token="<secret token>"

--customboundary
Content-Disposition: form-data; name="file"; filename="Example Document.pdf"
Content-Type: application/pdf

<PDF data>
--customboundary
Content-Disposition: form-data; name="attachment"; filename="attachment.xfdf"
Content-Type: application/vnd.adobe.xfdf

<annotations data>
--customboundary
Content-Disposition: form-data; name="keep_current_annotations"

true
--customboundary--

```

## Exporting to XFDF

You can export the current annotations of a document as an XFDF file via a `GET` request to `/api/documents/:document_id/document.xfdf`. To get the current annotation of a document’s layer, send a `GET` request to `/api/documents/:document_id/layers/:layer_name/document.xfdf`:

**Request**

```http

GET /api/documents/:document_id/document.xfdf
Authorization: Token token="<secret token>"

```

```bash

$ curl "http://localhost:5000/api/documents/abc/document.xfdf" \
   -H "Authorization: Token token=<secret token>"

```

**Response**

```http

HTTP/1.1 200 OK
Content-Type: application/vnd.adobe.xfdf

<XFDF data>

```
---

## Related pages

- [Import and export Instant JSON PDF annotation data](/guides/document-engine/annotations/import-and-export/instant-json.md)

