---
title: "Import and export JSON PDF annotation data server-side"
canonical_url: "https://www.nutrient.io/guides/document-engine/annotations/import-and-export/instant-json/"
md_url: "https://www.nutrient.io/guides/document-engine/annotations/import-and-export/instant-json.md"
last_updated: "2026-05-19T09:44:53.439Z"
description: "Learn to easily import and export document annotations using Instant JSON in Document"
---

# Import and export Instant JSON PDF annotation data

You can import and export annotations from documents you’ve uploaded to Document Engine. One of the supported formats for this is [Instant JSON](https://www.nutrient.io/guides/document-engine/json.md). This guide explains how to import and export annotations in the Instant JSON format.

## Exporting Instant JSON

You can export the current annotations of a document as an Instant JSON file via a `GET` request to `/api/documents/:document_id/document.json`. To get the current annotations of a layer, send a `GET` request to `/api/documents/:document_id/layers/:layer_name/document.json`:

**Request**

```http

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

```

```bash

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

```

**Response**

```http

HTTP/1.1 200 OK
Content-Type: application/json

<JSON data>

```

## Importing Instant JSON

Document Engine supports importing annotations from an Instant JSON file when uploading a document via the `/api/documents` endpoint. Send a `multipart/form-data` `POST` request, including the PDF and the Instant JSON 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 Instant JSON file. If you want to add annotations to already existing ones instead of replacing them, 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.json"
Content-Type: application/json

<annotations data>
--customboundary

```

## Importing Instant JSON on existing documents

Document Engine supports importing annotations from an Instant JSON file on an existing document via three different endpoints:

- [`POST /apply_instant_json`](https://www.nutrient.io/api/reference/document-engine/instant-json/) receives an `instant.json` file and updates the document in place using the `instant.json` file.

- [`POST /pdf_with_instant_json`](https://www.nutrient.io/api/reference/document-engine/instant-json/) receives an `instant.json` file and responds with the resulting PDF of the document/layer and the imported `instant.json`.

- [`POST /copy_with_instant_json`](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Documents/operation/copy-document) can optionally receive an `instant.json` file and will persist the resulting PDF of the document/layer and the imported `instant.json` file as a new document. The JSON response will include the `document_id` of the document.
---

## Related pages

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

