How Large Agencies Can Use Existing Customer Content to Build Websites at Scale

By Jordan Chelli

Here at Duda, we work hard to ensure that our platform provides you with a differentiated offering for your customers. Among other things, we have a powerful set of content injection APIs that allow you to push customer-specific content into new website builds or push custom content from sources outside of Duda into websites.

We recently expanded our API offering, enabling you to inject content automatically into your websites with the Content Injection API. Similar to our content library and collection form features, this new API enables you to collect any content that you want from a database, CRM, Google sheet, etc., and inject it anywhere that you want in a website. For example, you can add text, images, or even a business address that is injected directly into the Map widget.

Using this tool, you’ll be able to speed up the development process and reduce the number of development hours. If your project fits with the use cases of the content injection API, it will be more cost-effective and accelerate your revenue stream.

Indeed, the faster you deliver websites to your customers, the faster you start getting paid. By using the content injection API, you can boost your revenue and reduce your costs all at the same time, making your business more efficient and more profitable.

How Content Injection API can help you build and manage websites at scale 

For large agencies, building websites quickly and managing them at scale is really important. Here are a few examples of how this new API can help you achieve both of these goals:

  • Quickly build one-page microsites with data that have already been collected from customers.
  • Automatically create parking pages for domains that do not have a website. When the client is ready, you can then customize the parking page’s content to turn it into a conversion-driving website.
  • Create localized templates for a multi-language market by injecting dedicated content for each locale.
  • Automate the process of building hundreds of websites for a specific niche. In such cases, the sites need to be the same, but the content needs to be different.
  • Quickly build sites for potential customers who prefer to fill in a form and have their sites built automatically.
  • Regularly update websites for several branches of the same company with the same information.

The Content Injection API in Action

Here’s how you can use this new API:

  1. Create a template
    You can use one of the templates Duda provides, or create your own by converting one of your existing websites into a template. That template then forms the foundation of the websites you’ll create.
  2. Prepare your template to receive the content
    There are three types of values that you can inject:

    • An attribute on an element
    • The Innerhtml of an element
    • Some CSS values

    You must have the data-inject=value set on the element, which defines that you are going to inject content into that area. For CSS, you must have a data-inject:value CSS property set within a declaration block.

    This feature primarily works by sending the type value to alter the markup or styling in multiple ways. Also, once the data-inject is set on your element, you will be able to update the values that have been injected whenever you want. We’ll look at a few examples later.

  3. Create a website from a template
    Now that your template is ready, you have to create a new website from it. You can do this using the Duplicate Site API.
  4. Inject content using the Content Injection API
    It’s here that the magic happens. You can inject the content with an API call directly to the website you’ve created. You’ll find all the API references to inject content here.
  5. Manually edit the site you’ve created
    This step is not mandatory, but as with every Duda website, you can manually edit the website in the editor.
  6. Publish the website manually or use the Publish API
    Now that your website is finished, you just need to publish it. This can be done either manually or via the Publish API.

That was the theory. Now here’s the practice.

Implementation Examples – Just a Few Ideas of What You Can Do

Updating an Attribute on an Element
Let’s prepare a Map widget to inject an address into it. We need to add “data-inject” in the <span> and define the key (MyMap in the example below).

Now we have to run the API to update the attributes.

The type here is DOMATTR. We use it in this example because we want to update the attributes of the Map widget.

The key MyMap was defined earlier in the Span. It will enable the API to identify where the content has to be injected.

The value is the content you want to inject and the refs are the attributes you want to update.

In this case, we want the street and the address display to be the same.

Thanks to this API call, the Map widget will display the address of the Empire State Building: 350 5th Ave, New York, USA.

Updating InnerHTML of an Element

In this example, we’ll prepare a paragraph widget to receive some text we want to inject. As we did previously, we add “data-inject” in the <span> and define a key.


Here is the API call.

The type is INNERHTML because we want to update the content contained in the Span.

The key is MyParagraph, as defined in the HTML of the paragraph widget, and the value “The text I want to add” will be displayed in the paragraph widget.

Updating CSS Values

You may need to update a CSS value, for example, to edit the background of a row. Let’s add an image as a background.

As always, let’s first prepare the code to receive the content by adding data-inject as a CSS property.

Now let’s run the API call.

The type is CSS because the background image will be displayed via CSS. The key is what we’ve defined earlier in the CSS of the element.

The values will be the URL of the image you want to use as a background, and the refs are the CSS properties that you want to update with the value.

Please note: If you want to inject an image, you must first upload it to Duda’s servers:

Also, note that you can do a global call directly for all the values you want to inject, whatever the types.

Ready to explore Duda’s Content Injection API for yourself?

Duda’s API is available exclusively to Duda partners. If you’re already a partner, you can request your API access here. If you’re new to the platform, give it a try right now! To learn more about migrating your old sites to Duda (also through an API) read this detailed blog post.



About Jordan Chelli

Blog Comment Policy