> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateEmailDesignTheme

# Package: emails

# Namespace: EmailDesignThemesService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/create-email-design-theme.md

## Permission Scopes:
Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING

## Introduction

Creates an email design theme.

The number of email design themes a site can hold is capped by the site's Wix Email Marketing plan.
When the site is at its cap, the call fails with `OUT_OF_QUOTA`. Deleting an email design theme frees
a slot, and upgrading the site's plan raises the cap. If the site's plan doesn't include email design
themes, the cap is `0`, so every call fails with `OUT_OF_QUOTA` until the plan is upgraded.

If a site downgrades to a plan with a lower cap, its existing email design themes are kept and can
still be retrieved, updated, and deleted. Creating email design themes fails until the site has fewer
email design themes than the new cap.

To check the cap before creating an email design theme, call
[Get Account Details](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/account-details/get-account-details.md)
and read `package.featureAllowances.designThemes.limit`. A `limit` of `-1` means unlimited, and a `limit`
of `0` means the site's plan doesn't include email design themes.

---

## REST API

### Schema

```
 Method: createEmailDesignTheme
 Description: Creates an email design theme.  The number of email design themes a site can hold is capped by the site's Wix Email Marketing plan. When the site is at its cap, the call fails with `OUT_OF_QUOTA`. Deleting an email design theme frees a slot, and upgrading the site's plan raises the cap. If the site's plan doesn't include email design themes, the cap is `0`, so every call fails with `OUT_OF_QUOTA` until the plan is upgraded.  If a site downgrades to a plan with a lower cap, its existing email design themes are kept and can still be retrieved, updated, and deleted. Creating email design themes fails until the site has fewer email design themes than the new cap.  To check the cap before creating an email design theme, call [Get Account Details](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/account-details/get-account-details.md) and read `package.featureAllowances.designThemes.limit`. A `limit` of `-1` means unlimited, and a `limit` of `0` means the site's plan doesn't include email design themes.
 URL: https://www.wixapis.com/emails/themes/v1/email-design-themes
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  emailDesignTheme, emailDesignTheme.title, emailDesignTheme.body
 Method parameters: 
   param name: emailDesignTheme | type: EmailDesignTheme | description: An email design theme is a reusable definition of an email's look and feel, such as its colors, fonts, and spacing. Site owners save email design themes in the Wix email editor and apply them to the emails they compose, such as Wix Email Marketing campaigns and automated emails. | required: true 
        - name: title | type: string | description: Email design theme title. Titles aren't unique, so a site can have multiple email design themes with the same title. To help site owners tell them apart, display additional context alongside the title, such as the date the email design theme was last updated. | required: true | validation: minLength 1, maxLength 200
        - name: body | type: object | description: Styling definition of the email design theme, as a free-form JSON object. Its structure is defined by the Wix email editor. For example, `palette` holds the theme's colors, and `classes` maps named styles such as `heading-text` and `primary-button` to the properties the editor applies.  The Wix email editor doesn't render styling that doesn't follow its structure. When `body` doesn't define a style class, the editor uses its default styling for that class. When `body` doesn't include `palette`, the theme's color palette is empty.  This API doesn't validate the structure of `body`, so a theme that saves successfully may still not render as expected. Don't rely on a particular set of keys being present, and ignore keys you don't recognize. Don't store personal data in `body`.  Limited to 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace. | required: true 
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the email design theme.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. Don't store personal data in extended fields.  To update extended fields, call [Update Extended Fields](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-extended-fields.md). [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) also applies any `extendedFields` specified in the request.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: tags | type: Tags | description: Tags assigned to the email design theme. Tags are owned by the Tags API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)), which you can use to resolve these GUIDs into labels and to create tags.  Specifying `tags` in [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) replaces the existing tags instead of adding to them. To assign or unassign individual tags, call [Bulk Update Email Design Theme Tags](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/bulk-update-email-design-theme-tags.md).  
           - name: privateTags | type: TagList | description: Tags that require an additional permission to access, typically restricted from site members and visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
           - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  
 Return type: CreateEmailDesignThemeResponse
  - name: emailDesignTheme | type: EmailDesignTheme | description: Created email design theme.  
     - name: id | type: string | description: Email design theme GUID.  | read-only: true | validation: format GUID
     - name: createdDate | type: string | description: Date and time the email design theme was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the email design theme was updated.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, which increments by 1 each time the email design theme is updated. To prevent conflicting changes, the current revision must be passed when updating the email design theme.  Ignored when creating an email design theme.  | read-only: true | validation: format int64
     - name: title | type: string | description: Email design theme title. Titles aren't unique, so a site can have multiple email design themes with the same title. To help site owners tell them apart, display additional context alongside the title, such as the date the email design theme was last updated.  | validation: minLength 1, maxLength 200
     - name: body | type: object | description: Styling definition of the email design theme, as a free-form JSON object. Its structure is defined by the Wix email editor. For example, `palette` holds the theme's colors, and `classes` maps named styles such as `heading-text` and `primary-button` to the properties the editor applies.  The Wix email editor doesn't render styling that doesn't follow its structure. When `body` doesn't define a style class, the editor uses its default styling for that class. When `body` doesn't include `palette`, the theme's color palette is empty.  This API doesn't validate the structure of `body`, so a theme that saves successfully may still not render as expected. Don't rely on a particular set of keys being present, and ignore keys you don't recognize. Don't store personal data in `body`.  Limited to 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the email design theme.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. Don't store personal data in extended fields.  To update extended fields, call [Update Extended Fields](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-extended-fields.md). [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) also applies any `extendedFields` specified in the request.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
     - name: tags | type: Tags | description: Tags assigned to the email design theme. Tags are owned by the Tags API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)), which you can use to resolve these GUIDs into labels and to create tags.  Specifying `tags` in [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) replaces the existing tags instead of adding to them. To assign or unassign individual tags, call [Bulk Update Email Design Theme Tags](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/bulk-update-email-design-theme-tags.md).  
        - name: privateTags | type: TagList | description: Tags that require an additional permission to access, typically restricted from site members and visitors.  
           - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
        - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: BODY_TOO_LARGE | Description: The email design theme's `body` exceeds the maximum size of 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: OUT_OF_QUOTA | Description: The site already has as many email design themes as its Wix Email Marketing plan allows, or its plan doesn't include email design themes. Delete an email design theme to free a slot, or upgrade the site's plan to raise the limit.


```

### Examples

### Create Email Design Theme
Creates an email design theme with a title and a body

```curl
curl -X POST \
'https://www.wixapis.com/emails/themes/v1/email-design-themes' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "emailDesignTheme": {
    "title": "Timeless Editorial Elegance",
    "body": {
      "body": {
        "width": "700px",
        "backgroundColor": "#E3E0D8"
      },
      "classes": {
        "heading-text": {
          "style": {
            "color": "#0C1622",
            "fontFamily": "Georgia,'\''Times New Roman'\'',serif",
            "fontSize": "44px"
          }
        },
        "section": {
          "style": {
            "padding": "40px 32px",
            "backgroundColor": "#F3F1EC"
          }
        },
        "primary-button": {
          "style": {
            "backgroundColor": "#0C1622",
            "innerPadding": "16px 28px",
            "color": "#F3F1EC",
            "fontFamily": "Helvetica,Arial,sans-serif",
            "fontSize": "13px"
          }
        }
      },
      "palette": [
        "#F3F1EC",
        "#0C1622",
        "#080E16",
        "#2E3742"
      ]
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.emailDesignThemes.emailDesignThemes.createEmailDesignTheme(emailDesignTheme)
 Description: Creates an email design theme.  The number of email design themes a site can hold is capped by the site's Wix Email Marketing plan. When the site is at its cap, the call fails with `OUT_OF_QUOTA`. Deleting an email design theme frees a slot, and upgrading the site's plan raises the cap. If the site's plan doesn't include email design themes, the cap is `0`, so every call fails with `OUT_OF_QUOTA` until the plan is upgraded.  If a site downgrades to a plan with a lower cap, its existing email design themes are kept and can still be retrieved, updated, and deleted. Creating email design themes fails until the site has fewer email design themes than the new cap.  To check the cap before creating an email design theme, call [Get Account Details](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/account-details/get-account-details.md) and read `package.featureAllowances.designThemes.limit`. A `limit` of `-1` means unlimited, and a `limit` of `0` means the site's plan doesn't include email design themes.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  emailDesignTheme, emailDesignTheme.title, emailDesignTheme.body
 Method parameters: 
   param name: emailDesignTheme | type: EmailDesignTheme | description: An email design theme is a reusable definition of an email's look and feel, such as its colors, fonts, and spacing. Site owners save email design themes in the Wix email editor and apply them to the emails they compose, such as Wix Email Marketing campaigns and automated emails. | required: true 
        - name: title | type: string | description: Email design theme title. Titles aren't unique, so a site can have multiple email design themes with the same title. To help site owners tell them apart, display additional context alongside the title, such as the date the email design theme was last updated. | required: true | validation: minLength 1, maxLength 200
        - name: body | type: object | description: Styling definition of the email design theme, as a free-form JSON object. Its structure is defined by the Wix email editor. For example, `palette` holds the theme's colors, and `classes` maps named styles such as `heading-text` and `primary-button` to the properties the editor applies.  The Wix email editor doesn't render styling that doesn't follow its structure. When `body` doesn't define a style class, the editor uses its default styling for that class. When `body` doesn't include `palette`, the theme's color palette is empty.  This API doesn't validate the structure of `body`, so a theme that saves successfully may still not render as expected. Don't rely on a particular set of keys being present, and ignore keys you don't recognize. Don't store personal data in `body`.  Limited to 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace. | required: true 
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the email design theme.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. Don't store personal data in extended fields.  To update extended fields, call [Update Extended Fields](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-extended-fields.md). [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) also applies any `extendedFields` specified in the request.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: tags | type: Tags | description: Tags assigned to the email design theme. Tags are owned by the Tags API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)), which you can use to resolve these GUIDs into labels and to create tags.  Specifying `tags` in [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) replaces the existing tags instead of adding to them. To assign or unassign individual tags, call [Bulk Update Email Design Theme Tags](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/bulk-update-email-design-theme-tags.md).  
           - name: privateTags | type: TagList | description: Tags that require an additional permission to access, typically restricted from site members and visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
           - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  
 Return type: PROMISE<EmailDesignTheme>
  - name: _id | type: string | description: Email design theme GUID.  | read-only: true | validation: format GUID
  - name: _createdDate | type: Date | description: Date and time the email design theme was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the email design theme was updated.  | read-only: true 
  - name: revision | type: string | description: Revision number, which increments by 1 each time the email design theme is updated. To prevent conflicting changes, the current revision must be passed when updating the email design theme.  Ignored when creating an email design theme.  | read-only: true | validation: format int64
  - name: title | type: string | description: Email design theme title. Titles aren't unique, so a site can have multiple email design themes with the same title. To help site owners tell them apart, display additional context alongside the title, such as the date the email design theme was last updated.  | validation: minLength 1, maxLength 200
  - name: body | type: object | description: Styling definition of the email design theme, as a free-form JSON object. Its structure is defined by the Wix email editor. For example, `palette` holds the theme's colors, and `classes` maps named styles such as `heading-text` and `primary-button` to the properties the editor applies.  The Wix email editor doesn't render styling that doesn't follow its structure. When `body` doesn't define a style class, the editor uses its default styling for that class. When `body` doesn't include `palette`, the theme's color palette is empty.  This API doesn't validate the structure of `body`, so a theme that saves successfully may still not render as expected. Don't rely on a particular set of keys being present, and ignore keys you don't recognize. Don't store personal data in `body`.  Limited to 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace.  
  - name: extendedFields | type: ExtendedFields | description: Custom field data for the email design theme.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. Don't store personal data in extended fields.  To update extended fields, call [Update Extended Fields](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-extended-fields.md). [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) also applies any `extendedFields` specified in the request.  
     - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
  - name: tags | type: Tags | description: Tags assigned to the email design theme. Tags are owned by the Tags API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)), which you can use to resolve these GUIDs into labels and to create tags.  Specifying `tags` in [Update Email Design Theme](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/update-email-design-theme.md) replaces the existing tags instead of adding to them. To assign or unassign individual tags, call [Bulk Update Email Design Theme Tags](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-design-theme/bulk-update-email-design-theme-tags.md).  
     - name: privateTags | type: TagList | description: Tags that require an additional permission to access, typically restricted from site members and visitors.  
        - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
     - name: publicTags | type: TagList | description: Tags that are exposed to anyone with access to the entity, including site members and visitors.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: BODY_TOO_LARGE | Description: The email design theme's `body` exceeds the maximum size of 256 KB (262,144 bytes), measured on the JSON encoding without insignificant whitespace.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: OUT_OF_QUOTA | Description: The site already has as many email design themes as its Wix Email Marketing plan allows, or its plan doesn't include email design themes. Delete an email design theme to free a slot, or upgrade the site's plan to raise the limit.


```

### Examples

### Create an email design theme
Creates an email design theme with a title and a body

```javascript
import { emailDesignThemes } from "@wix/email-design-themes";

async function createEmailDesignTheme() {
  const response = await emailDesignThemes.createEmailDesignTheme({
    title: "Timeless Editorial Elegance",
    body: {
      body: {
        width: "700px",
        backgroundColor: "#E3E0D8",
      },
      classes: {
        "heading-text": {
          style: {
            color: "#0C1622",
            fontFamily: "Georgia,'Times New Roman',serif",
            fontSize: "44px",
          },
        },
        section: {
          style: {
            padding: "40px 32px",
            backgroundColor: "#F3F1EC",
          },
        },
        "primary-button": {
          style: {
            backgroundColor: "#0C1622",
            innerPadding: "16px 28px",
            color: "#F3F1EC",
            fontFamily: "Helvetica,Arial,sans-serif",
            fontSize: "13px",
          },
        },
      },
      palette: ["#F3F1EC", "#0C1622", "#080E16", "#2E3742"],
    },
  });
}

```

### createEmailDesignTheme (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { emailDesignThemes } from '@wix/email-design-themes';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { emailDesignThemes },
  // Include the auth strategy and host as relevant
});


async function createEmailDesignTheme(emailDesignTheme) {
  const response = await myWixClient.emailDesignThemes.createEmailDesignTheme(emailDesignTheme);
};
```

---