How can I apply a saved template on an image using API?

I have a template which shows a product with marketing phrases at the bottom right corner. I want to apply this template on other product images where I will provide new marketing phrases relevant to that product and I want it applied in a similar fashion at the bottom right corner of the image.
I want to do this using API. How can I do that?

Hi @ashwin.kambli ,

That’s a great question.

Do you have any image examples you’d be able to provide? That would be extremely useful.

Thank you!

Absolutely!!
Here is the template.

I would then provide another similar image and would I want to apply the template to it.
I’ll provide 3 phrases such as: “Super comfortable!!”, “Stretchy!!” and “Trendy!!”. I want to overlay these 3 phrases on the provided image at the same position as in the template, using the same font, etc.

I see that I can render using a template using the v1 API. But, I don’t see how we can send custom text to that API which will replace the text in the template.

Hi @ashwin.kambli ,

Would you be open to a 15 minute zoom call so that we can discuss your use-case further, and chat through a potential solution for you to get your feedback?

If so, I will send through an email to cordinate :slight_smile:

Thanks!

Sure!! Please send me the zoom invite.

1 Like

I have sent you a DM to inquire on personal details (email and timezone) to get this scheduled :slight_smile:

Hi @ashwin.kambli ,

To follow up:

You can now use the API with templates by applying a predefined design to an existing image. To use templates, you need to include three main parameters in your API call:

  1. apiKey: Your personal Photoroom API key.

  2. templateId: The identifier of the template you want to apply. This ID is either obtained from one of the default templates provided or created from your own custom template through the PhotoRoom web app (by creating, turning it into a template, and sharing it).

  3. imageUrl: The URL of the image that will be processed.

In practice, you integrate the API by taking your existing image URL and adding it (as the last parameter) to the API call which includes the apiKey and templateId. This simple structure enables the API to automatically apply the specific template to your image.

Let me know if this doesn’t work for the flow we went through?

Best,

Hi Allie,
This is what is currently available. But, what I want to be able to do is replace items in the template: for example, replace the subject with the subject from the image, replace the text, etc. What I got from the call was that you are still a few weeks away from making that available through APIs.
Please correct me if I am wrong.
Thanks,
Ashwin

Dear,

do you have known issues with templateID? in V2/edit? the API woks fine but returns an empty image when using the template ID. It used to work beatuifly. Now i get an empty image. both in GET and also in POST.

Looking forward to your help
BR
Seb

Hi @teamMaid ,

Would you be able to share the templateID along with the params you’re using? We will be able to take a look at this closer for you.

Thanks for flagging.

Dear, the TemplateID is: 1978ac0d-7a88-496e-8fdc-6d7adce67e0e

the query params i use are:

scaling : fit
imageUrl : [url}
background.color : f3f3f3

It used to work and stopped without me changing anything.
Thanky ou for your help

Dear @Photoroom

is there anything else you need to support?

Hi @teamMaid ,

We are in the process of investigating the issue for you. Thanks for providing the details and I will come back to you as soon as possible with any next steps on this

Hi there,

On my end it is showing that you do not have any replaceable layers currently enabled. Do you need guidance on how to do so?

Happy to help if need be.