# Update Template Modifications

> Update text and image content in template layers

- **URL**: https://orshot.com/docs/api-reference/enterprise-update-modifications

---

Update the content of text and image layers in a studio template. This endpoint allows you to modify parameterized elements directly without re-saving the entire template structure. Supports updating multiple parameters across multiple pages in a single request.

For detailed information about the template data structure, see [Anatomy of a Template](https://orshot.com/docs/definitions/template-anatomy).

## Endpoint```markdown tab="Endpoint"
https://api.orshot.com/v1/studio/templates/:templateId/update-modifications
```## Query Parameters

| Parameter           | Type    | Required | Default | Description                                                                                                                                                                                                    |
| ------------------- | ------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `includeThumbnails` | Boolean | No       | `false` | When `true`, thumbnails are regenerated for the pages that had modifications applied, and the response waits for all renders to complete. When `false` or absent, thumbnails regenerate asynchronously after the response. |

## Request Examples

<Tabs items=>
<Tab value="Single Page">```js
// Update text and image on a single page
await fetch("https://api.orshot.com/v1/studio/templates/12345/update-modifications", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <ORSHOT_API_KEY>",
  },
  body: JSON.stringify({
    data: [
      {
        page: 1,
        modifications: {
          headline: "Flash Sale: 24 Hours Only!",
          subtitle: "Don't miss out on amazing deals",
          product_image: "https://cdn.example.com/sale-banner.png",
          price: "$49.99"
        }
      }
    ],
    embed_user_id: "your-external-user-id" // Optional
  }),
});
```</Tab>
<Tab value="Multi-Page">```js
// Update multiple pages in a carousel template
await fetch("https://api.orshot.com/v1/studio/templates/12345/update-modifications", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <ORSHOT_API_KEY>",
  },
  body: JSON.stringify({
    data: [
      {
        page: 1,
        modifications: {
          headline: "Welcome to Our Store",
          hero_image: "https://cdn.example.com/hero.png"
        }
      },
      {
        page: 2,
        modifications: {
          headline: "Featured Products",
          product_1: "https://cdn.example.com/product1.png",
          product_2: "https://cdn.example.com/product2.png"
        }
      },
      {
        page: 3,
        modifications: {
          headline: "Contact Us",
          email: "hello@example.com",
          phone: "+1 234 567 8900"
        }
      }
    ]
  }),
});
```</Tab>
<Tab value="With Styles">```js
// Update content and styles together
await fetch("https://api.orshot.com/v1/studio/templates/12345/update-modifications", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <ORSHOT_API_KEY>",
  },
  body: JSON.stringify({
    data: [
      {
        page: 1,
        modifications: {
          // Content updates
          headline: "Black Friday Sale",
          discount: "70% OFF",
          
          // Style updates using dot notation
          "headline.fontSize": 72,
          "headline.color": "#ffffff",
          "discount.backgroundColor": "#ff0000",
          "discount.color": "#ffffff"
        }
      }
    ]
  }),
});
```</Tab>
<Tab value="Response">```json
{
  "success": true,
  "template_id": 12345,
  "applied": [
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "headline", "type": "text" },
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "subtitle", "type": "text" },
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "product_image", "type": "image" },
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "price", "type": "text" },
    { "page": 2, "page_id": "b2c3d4e5-6f78-9012-bcde-f23456789012", "key": "headline", "type": "text" }
  ]
}
```</Tab>
<Tab value="Partial Success">```json
{
  "success": true,
  "template_id": 12345,
  "applied": [
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "headline", "type": "text" },
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "product_image", "type": "image" }
  ],
  "failed": [
    {
      "page": 1,
      "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890",
      "key": "nonexistent_param",
      "error": "Element with parameterId 'nonexistent_param' not found"
    },
    {
      "page": 5,
      "page_id": null,
      "error": "Page 5 does not exist. Template has 3 page(s)."
    }
  ]
}
```</Tab>
<Tab value="Response (?includeThumbnails=true)">```json
{
  "success": true,
  "template_id": 12345,
  "applied": [
    { "page": 1, "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890", "key": "headline", "type": "text" },
    { "page": 2, "page_id": "b2c3d4e5-6f78-9012-bcde-f23456789012", "key": "headline", "type": "text" }
  ],
  "thumbnails": {
    "success": true,
    "pages": [
      {
        "page": 1,
        "page_id": "a1b2c3d4-5e6f-7890-abcd-ef1234567890",
        "thumbnail_url": "https://storage.orshot.com/cloud/w-50/renders/thumbnails/xy7.png",
        "error": null
      },
      {
        "page": 2,
        "page_id": "b2c3d4e5-6f78-9012-bcde-f23456789012",
        "thumbnail_url": "https://storage.orshot.com/cloud/w-50/renders/thumbnails/xy8.png",
        "error": null
      }
    ]
  }
}
```</Tab>
</Tabs>

## Rate Limits

| Limit                         | Value |
| ----------------------------- | ----- |
| Requests per minute           | 30    |
| Max modifications per request | 50    |

## URL Parameters

| Parameter    | Type    | Required | Description                      |
| ------------ | ------- | -------- | -------------------------------- |
| `templateId` | Integer | Yes      | The ID of the template to update |

## Request Body Structure

The request body uses a `data` array format, where each item specifies the page number and modifications to apply:```json
{
  "data": [
    {
      "page": 1,
      "modifications": {
        "headline": "New Headline Text",
        "product_image": "https://cdn.example.com/new-image.png",
        "price": "$99.99"
      }
    }
  ]
}
```### Request Body Parameters

| Parameter       | Type   | Required | Description                                                                                                                                                                           |
| --------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | Array  | Yes      | Array of page modification objects                                                                                                                                                    |
| `embed_user_id` | String | No       | Assign or update the template's embed user. Accepts either an external user ID (resolved using your workspace's embed configuration) or an Orshot internal ID (prefixed with `eui_`). |

### Data Object Structure

Each object in the `data` array should include:

| Field           | Type    | Required | Description                                       |
| --------------- | ------- | -------- | ------------------------------------------------- |
| `page`          | Integer | Yes      | Page number (1-indexed) to apply modifications to |
| `modifications` | Object  | Yes      | Key-value pairs of parameterId to new value       |

## Supported Modification Types

### Text Content

Update text element content by its `parameterId`:```json
{
  "page": 1,
  "modifications": {
    "headline": "Summer Sale 2026!",
    "subtitle": "Up to 50% off all items",
    "cta_text": "Shop Now"
  }
}
```### Image URLs

Update image sources by providing a URL:```json
{
  "page": 1,
  "modifications": {
    "product_image": "https://cdn.example.com/product.png",
    "logo": "https://cdn.example.com/logo.svg",
    "background": "https://cdn.example.com/bg.jpg"
  }
}
```### Style Properties

Update style properties using dot notation:```json
{
  "page": 1,
  "modifications": {
    "headline.fontSize": 48,
    "headline.color": "#ff0000",
    "cta_button.backgroundColor": "#007bff",
    "subtitle.fontFamily": "Inter"
  }
}
```## Response Fields

| Field         | Type    | Description                                                                                                     |
| ------------- | ------- | --------------------------------------------------------------------------------------------------------------- |
| `success`     | Boolean | Whether the operation completed                                                                                 |
| `template_id` | Integer | ID of the updated template                                                                                      |
| `applied`     | Array   | List of successfully applied modifications                                                                      |
| `failed`      | Array   | List of failed modifications (only if any failed)                                                               |
| `thumbnails`  | Object  | Only present when `?includeThumbnails=true`. See [Thumbnails Object Structure](#thumbnails-object-structure) below |

### Applied/Failed Object Structure

| Field     | Type    | Description                                                                                                                    |
| --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `page`    | Integer | Page number where the modification was applied/failed                                                                          |
| `page_id` | String  | Stable UUID of the page where the modification was applied/failed. `null` if the requested page number does not exist on the template |
| `key`     | String  | The parameter ID or style path                                                                                                 |
| `type`    | String  | Type of modification: `text`, `image`, or `style`                                                                              |
| `error`   | String  | Error message (only for failed items)                                                                                          |

### Thumbnails Object Structure

When `?includeThumbnails=true` is passed, a PNG thumbnail is regenerated for **only the pages that had modifications applied** (not all pages). The `thumbnails` object in the response has this shape:

| Field                   | Type         | Description                                                                   |
| ----------------------- | ------------ | ----------------------------------------------------------------------------- |
| `success`               | Boolean      | `true` if at least one page rendered successfully                             |
| `pages[].page`          | Integer      | 1-based page number                                                           |
| `pages[].page_id`       | String       | Stable UUID of the page                                                       |
| `pages[].thumbnail_url` | String\|null | Public URL of the new thumbnail PNG. `null` if this page failed               |
| `pages[].error`         | String\|null | Error message if this page failed. `null` on success                          |

When `?includeThumbnails` is not passed, thumbnails regenerate in the background for the modified pages and appear on the template shortly after the response.

## Supported Style Properties

When using dot notation for style updates, the following properties are commonly supported:

| Property          | Type          | Description                          |
| ----------------- | ------------- | ------------------------------------ |
| `fontSize`        | Number        | Font size in pixels                  |
| `fontFamily`      | String        | Font family name                     |
| `color`           | String        | Text color (hex, rgb, rgba)          |
| `backgroundColor` | String        | Background color                     |
| `opacity`         | Number        | Opacity (0-1)                        |
| `fontWeight`      | String/Number | Font weight (normal, bold, 100-900)  |
| `textAlign`       | String        | Text alignment (left, center, right) |
| `letterSpacing`   | Number        | Letter spacing in pixels             |
| `lineHeight`      | Number        | Line height multiplier               |

## Error Responses

| Status Code | Error                         | Description                                  |
| ----------- | ----------------------------- | -------------------------------------------- |
| 400         | data required                 | Request body missing data array              |
| 400         | data array empty              | Empty data array                             |
| 400         | page must be positive integer | Invalid page number                          |
| 400         | modifications must be object  | Invalid modifications format                 |
| 403         | Access Forbidden              | Invalid API key or template not in workspace |
| 404         | Template not found            | Template ID doesn't exist                    |
| 429         | Rate limit exceeded           | Too many requests (max 30/min)               |
| 500         | Internal server error         | Server-side error                            |

## Cache Invalidation

When modifications are applied:

1. Template render cache is automatically invalidated
2. Dynamic URL cache for the template is cleared
3. Subsequent render requests will use the updated content

## Best Practices

1. **Use Parameter IDs**: Ensure your template has `parameterId` set on elements you want to update
2. **Batch Updates**: Combine multiple page modifications in a single request to reduce API calls
3. **Validate URLs**: Ensure image URLs are accessible and return valid images
4. **Error Handling**: Always check the `failed` array in responses for partial failures
5. **Style Consistency**: When updating styles, ensure values are compatible with the element type