AEM Assets API: DUPLICATE_URLS error when importing assets with the same source URL

This article describes how to resolve the DUPLICATE_URLS error that occurs when importing multiple assets with the same source URL but different filenames and metadata in a single batch request using the AEM Assets API.

Description description

Environment

Adobe Experience Manager (AEM) Assets (all versions)

Symptoms

  • When submitting a batch import request to the AEM Assets /adobe/assets/import/fromUrl API endpoint, if two or more files in the same request reference the same url value (source URL), but have different fileName values and different metadata, the API returns a 400 Bad Request with error code DUPLICATE_URLS.
  • The error occurs even when the fileName and asset metadata are unique for each entry.
  • The expected behavior is to allow the same source URL to be ingested as separate assets with unique filenames and metadata in the same folder.

Cause

The AEM Assets batch import API validates uniqueness based on the source URL within a single batch request. Multiple entries referencing the same URL are rejected, regardless of differing filenames or metadata. This isn’t configurable in current releases.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Split the batch into separate import requests. Instead of including multiple files with the same source URL in a single /fromUrl batch request, submit each file as a separate API call. These calls can be issued in parallel, as there’s no ordering dependency when targeting different fileName values in the same folder.

  2. Alternatively, use the Assets HTTP API COPY operation:

    • Ingest the asset once using /fromUrl.

    • Use the Assets HTTP API COPY operation to duplicate the ingested asset to a new fileName in the same folder.

    • Update the metadata on the copied asset, as needed. This avoids a second fetch of the binary and bypasses the DUPLICATE_URLS check.

After following these steps, verify that each asset appears in the target folder with the correct filename and metadata.

recommendation-more-help
experience-cloud-kcs-help-kbarticles