---
title: "Migrate documents to Document Engine | Nutrient"
canonical_url: "https://www.nutrient.io/guides/document-engine/file-management/migrate/from-other/"
md_url: "https://www.nutrient.io/guides/document-engine/file-management/migrate/from-other.md"
last_updated: "2026-05-22T14:49:21.615Z"
description: "Migrate documents to Document Engine by using the remote document URL API. Learn to fetch documents directly from URLs without incurring storage costs."
---

# Migrate documents from other locations to Document Engine

You can migrate documents stored in your existing infrastructure to Document Engine using the [remote document URL API](https://www.nutrient.io/guides/document-engine/file-management/create-a-document-from-url.md). This enables Document Engine to fetch the documents directly from the provided URL when required, which means you won’t incur any additional storage costs.

For this to work correctly, the URLs you provide cannot require any authentication, and they need to stay valid for as long as the document exists. Furthermore, the file returned by the URL needs to match exactly with the file that’s returned on the initial upload. If, at any point, the URL for a document becomes invalid, you’ll have to delete the document and reupload it. There’s no way to update the URL for an existing document.

You can either upload the documents all together in one go, or on demand.

### Uploading all documents

To upload all your documents in one go, use the [API to add a document from a URL](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Documents/operation/upload-document). Call this API for each document URL to register them with Document Engine. If your application already assigns unique IDs to documents, you can include them in the request to maintain consistency across systems:

### HTTP

```http

POST /api/documents
Content-Type: application/json
Authorization: Token token="<secret token>"

{
  "url": "http://file.example.com/sample.pdf",
  "document_id": "my_document_id_1"
}

```

### CURL

```bash

curl http\://127.0.0.1\:5000/api/documents \
    -X POST \
    -H "Authorization: Token token=<secret token>" \
    -H "Content-type: application/json" \
    -d '{"url": "http://file.example.com/sample.pdf", "document_id": "my_document_id_1"}'

```



### Uploading documents on demand

When a user requests a document, first check if it already exists in Document Engine. If the document is available, serve it immediately. Otherwise, upload it using the same ID the user provided.

For example, if your application has a route like `/documents/:id` and a user requests `my_document_id_1`, you can check if the document exists using the [document info endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Documents/operation/fetch-document-info):

`GET /api/documents/my_document_id_1/document_info`

If the document doesn’t exist, the request returns a 404 error. In that case, upload the document using the [adding a document from a URL](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Documents/operation/upload-document) endpoint:

### HTTP

```http

POST /api/documents
Content-Type: application/json
Authorization: Token token="<secret token>"

{
  "url": "http://file.example.com/sample.pdf",
  "document_id": "my_document_id_1"
}

```

### CURL

```bash

curl http\://127.0.0.1\:5000/api/documents \
    -X POST \
    -H "Authorization: Token token=<secret token>" \
    -H "Content-type: application/json" \
    -d '{"url": "http://file.example.com/sample.pdf", "document_id": "my_document_id_1"}'

```
---

## Related pages

- [Migrate documents from Amazon S3](/guides/document-engine/file-management/migrate/from-amazon-s3.md)

