# Photomerge two documents with API

**URL:** <https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771>\
**Category:** Photoshop\
**Created:** [April 10, 2024, 8:42am UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771 "2024-04-10T08:42:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![karanag](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@karanag](https://forums.creativeclouddeveloper.com/u/karanag)\
**Post date:** [April 10, 2024, 8:42am UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/1 "2024-04-10T08:42:58Z")

</div>

Hi,

I read the documentation and I know it is explicitly mentioned that working with multiple documents is not supported currently.

But usually, when things are not natively supported - there are some workarounds and I was wondering if there is any workaround for this? I just want to automate a process where I can pass in two images via API and get a single photomerged image back.

Any way this could be possible?

---

<div class="post-metadata">

**Author:** ![dotproduct](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dotproduct](https://forums.creativeclouddeveloper.com/u/dotproduct)\
**Post date:** [April 10, 2024, 3:04pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/2 "2024-04-10T15:04:40Z")

</div>

Where is it mentioned that you can’t use multiple documents? In fact, the first example on the [API doc’s for Photoshop document](https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/) specifically shows how to open two docs. You can easily open each image separately, duplicate one of them over to the other and then merge.

---

<div class="post-metadata">

**Author:** ![karanag](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@karanag](https://forums.creativeclouddeveloper.com/u/karanag)\
**Post date:** [April 10, 2024, 4:30pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/3 "2024-04-10T16:30:28Z")

</div>

Hi,

Thank you for your reply.

Sorry, I couldn’t find the example on the link that you shared. I feel so dumb asking for it, but can you please let me know exactly where to look?

This is where I read [Known Limitations](https://developer.adobe.com/photoshop/photoshop-api-docs/features/#:~:text=Known%20Limitations,-The%20following%20are&text=The%20API%20cannot%20automatically%20detect%20missing%20fonts%20in%20the%20layers.) that I can’t work with multiple docs in actions. Maybe the link you share will help me achieve what I want.

Thanks,  
Karan

---

<div class="post-metadata">

**Author:** ![dotproduct](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dotproduct](https://forums.creativeclouddeveloper.com/u/dotproduct)\
**Post date:** [April 10, 2024, 4:47pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/4 "2024-04-10T16:47:36Z")

</div>

I think we’re talking about different APIs 😁 I was referring to the UXP API, for plugins. It sounds like you want to use the REST API?

---

<div class="post-metadata">

**Author:** ![karanag](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@karanag](https://forums.creativeclouddeveloper.com/u/karanag)\
**Post date:** [April 10, 2024, 4:59pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/5 "2024-04-10T16:59:47Z")

</div>

Yes, I want to use REST APIs

---

<div class="post-metadata">

**Author:** ![dotproduct](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dotproduct](https://forums.creativeclouddeveloper.com/u/dotproduct)\
**Post date:** [April 10, 2024, 5:14pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/6 "2024-04-10T17:14:11Z")

</div>

Ah, gotcha. I apologize, I think that particular API does have limitations as you noted yourself. I’m not super familiar with that API. Maybe someone else here is. That said, have you taken a look at the [examples code](https://developer.adobe.com/photoshop/photoshop-api-docs/code-sample/#executing-an-actionjson) page? It looks like you can specify multiple image inputs for your action JSON. Another option also would be to have one of the images be your input psd and then add the other image as a smart object layer and then execute actions to merge.

---

<div class="post-metadata">

**Author:** ![karanag](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@karanag](https://forums.creativeclouddeveloper.com/u/karanag)\
**Post date:** [April 11, 2024, 2:31pm UTC](https://forums.creativeclouddeveloper.com/t/photomerge-two-documents-with-api/7771/7 "2024-04-11T14:31:16Z")

</div>

Hi,

Managed to solve this. I simply created a new document with two layers, each layer carrying the image file I needed for merging.

Thanks for your help,  
Karan
