> 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 # CreateStorageItem # Package: automations # Namespace: StorageService # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/create-storage-item.md ## Permission Scopes: Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS ## Introduction Creates a storage item. Each storage item has a unique key and a value of a specific data type. Once created, you can't change the value type. > **Note**: You can currently create up to 100 storage items. --- ## REST API ### Schema ``` Method: createStorageItem Description: Creates a storage item. Each storage item has a unique key and a value of a specific data type. Once created, you can't change the value type. > **Note**: You can currently create up to 100 storage items. URL: https://www.wixapis.com/v1/storage-items Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: storageItem, storageItem.key, storageItem.displayName, storageItem.type Method parameters: param name: storageItem | type: StorageItem | description: A storage item is a global data container that you can use across multiple automations to store different types of data in key-value pairs. This include data such as Wix user preferences, counters, and configuration settings. | required: true - ONE-OF: - required: true - name: stringValue | type: StringValue | description: When the item type is `STRING`, the string value. - name: value | type: string | description: String value. - name: format | type: Format | description: String format. - enum: - PLAIN_TEXT: Plain text. - URI: [Universal Resource Identifier (URI)](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier). - EMAIL: Email. - DATETIME: Datetime string in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). - name: booleanValue | type: BooleanValue | description: When the item type is `BOOLEAN`, the boolean value. - name: value | type: boolean | description: Boolean value. - name: numberValue | type: NumberValue | description: When the item type is `NUMBER`, the numeric value. - name: value | type: string | description: Numeric decimal value, represented as a string. - name: counterValue | type: CounterValue | description: When the item type is `COUNTER`, the counter value. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: value | type: string | description: Counter decimal value, represented as a string. - name: key | type: string | description: Unique storage item key. The key can only contain letters, numbers, and underscores. Once you create the item, you can't update its key. | required: true - name: displayName | type: string | description: Storage item display name. The display name appears when you [add or edit steps to your automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-3-add-steps-to-you-automation). | required: true - name: description | type: string | description: Storage item description. - name: type | type: Type | description: Data type of the storage item's value. Once created, you can't change the value's type. | required: true - enum: - STRING: String. - BOOLEAN: Boolean. - NUMBER: Number. - COUNTER: Counter. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/api-reference/business-management/tags/introduction.md) assigned to the storage item. You can use public and private tags for categorization and filtering. - name: privateTags | type: TagList | description: List of private tags. Private tags require additional permissions to access. They are usually hidden from site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: publicTags | type: TagList | description: List of public tags. Public tags are visible to anyone with access to the main storage item, including site members and visitors. - name: extendedFields | type: ExtendedFields | description: Extended fields. - 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). Return type: CreateStorageItemResponse - name: storageItem | type: StorageItem | description: Created storage item. - ONE-OF: - name: stringValue | type: StringValue | description: When the item type is `STRING`, the string value. - name: value | type: string | description: String value. - name: format | type: Format | description: String format. - enum: - PLAIN_TEXT: Plain text. - URI: [Universal Resource Identifier (URI)](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier). - EMAIL: Email. - DATETIME: Datetime string in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). - name: booleanValue | type: BooleanValue | description: When the item type is `BOOLEAN`, the boolean value. - name: value | type: boolean | description: Boolean value. - name: numberValue | type: NumberValue | description: When the item type is `NUMBER`, the numeric value. - name: value | type: string | description: Numeric decimal value, represented as a string. - name: counterValue | type: CounterValue | description: When the item type is `COUNTER`, the counter value. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: value | type: string | description: Counter decimal value, represented as a string. - name: id | type: string | description: Storage item GUID. - name: key | type: string | description: Unique storage item key. The key can only contain letters, numbers, and underscores. Once you create the item, you can't update its key. - name: displayName | type: string | description: Storage item display name. The display name appears when you [add or edit steps to your automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-3-add-steps-to-you-automation). - name: description | type: string | description: Storage item description. - name: type | type: Type | description: Data type of the storage item's value. Once created, you can't change the value's type. - enum: - STRING: String. - BOOLEAN: Boolean. - NUMBER: Number. - COUNTER: Counter. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: createdDate | type: string | description: When the storage item was created. - name: updatedDate | type: string | description: When the storage item was last updated. - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/api-reference/business-management/tags/introduction.md) assigned to the storage item. You can use public and private tags for categorization and filtering. - name: privateTags | type: TagList | description: List of private tags. Private tags require additional permissions to access. They are usually hidden from site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: publicTags | type: TagList | description: List of public tags. Public tags are visible to anyone with access to the main storage item, including site members and visitors. - name: extendedFields | type: ExtendedFields | description: Extended fields. - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: STORAGE_ITEM_VALUE_VALIDATION_EXCEPTION | Description: Invalid storage item value. The value has an invalid format. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_STORAGE_ITEM_KEY_EXCEPTION | Description: Invalid storage item key. The storage item key can only contain letters, numbers, and underscores. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_STORAGE_ITEMS | Description: The site has too many storage items. ``` ### Examples ### Create a Storage Item ```curl curl -X POST \ 'https://www.wixapis.com/storage-service/v1/storage-items' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ --data-binary '{ "storageItem": { "key": "user_preference", "displayName": "User Preference Setting", "type": "STRING", "stringValue": { "value": "dark_mode", "format": "PLAIN_TEXT" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.automations.StorageService.createStorageItem(storageItem) Description: Creates a storage item. Each storage item has a unique key and a value of a specific data type. Once created, you can't change the value type. > **Note**: You can currently create up to 100 storage items. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: storageItem, storageItem.key, storageItem.displayName, storageItem.type Method parameters: param name: storageItem | type: StorageItem | description: A storage item is a global data container that you can use across multiple automations to store different types of data in key-value pairs. This include data such as Wix user preferences, counters, and configuration settings. | required: true - ONE-OF: - required: true - name: stringValue | type: StringValue | description: When the item type is `STRING`, the string value. - name: value | type: string | description: String value. - name: format | type: Format | description: String format. - enum: - PLAIN_TEXT: Plain text. - URI: [Universal Resource Identifier (URI)](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier). - EMAIL: Email. - DATETIME: Datetime string in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). - name: booleanValue | type: BooleanValue | description: When the item type is `BOOLEAN`, the boolean value. - name: value | type: boolean | description: Boolean value. - name: numberValue | type: NumberValue | description: When the item type is `NUMBER`, the numeric value. - name: value | type: string | description: Numeric decimal value, represented as a string. - name: counterValue | type: CounterValue | description: When the item type is `COUNTER`, the counter value. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: value | type: string | description: Counter decimal value, represented as a string. - name: key | type: string | description: Unique storage item key. The key can only contain letters, numbers, and underscores. Once you create the item, you can't update its key. | required: true - name: displayName | type: string | description: Storage item display name. The display name appears when you [add or edit steps to your automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-3-add-steps-to-you-automation). | required: true - name: description | type: string | description: Storage item description. - name: type | type: Type | description: Data type of the storage item's value. Once created, you can't change the value's type. | required: true - enum: - STRING: String. - BOOLEAN: Boolean. - NUMBER: Number. - COUNTER: Counter. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/api-reference/business-management/tags/introduction.md) assigned to the storage item. You can use public and private tags for categorization and filtering. - name: privateTags | type: TagList | description: List of private tags. Private tags require additional permissions to access. They are usually hidden from site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: publicTags | type: TagList | description: List of public tags. Public tags are visible to anyone with access to the main storage item, including site members and visitors. - name: extendedFields | type: ExtendedFields | description: Extended fields. - 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). Return type: PROMISE - ONE-OF: - name: stringValue | type: StringValue | description: When the item type is `STRING`, the string value. - name: value | type: string | description: String value. - name: format | type: Format | description: String format. - enum: - PLAIN_TEXT: Plain text. - URI: [Universal Resource Identifier (URI)](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier). - EMAIL: Email. - DATETIME: Datetime string in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). - name: booleanValue | type: BooleanValue | description: When the item type is `BOOLEAN`, the boolean value. - name: value | type: boolean | description: Boolean value. - name: numberValue | type: NumberValue | description: When the item type is `NUMBER`, the numeric value. - name: value | type: string | description: Numeric decimal value, represented as a string. - name: counterValue | type: CounterValue | description: When the item type is `COUNTER`, the counter value. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: value | type: string | description: Counter decimal value, represented as a string. - name: _id | type: string | description: Storage item GUID. - name: key | type: string | description: Unique storage item key. The key can only contain letters, numbers, and underscores. Once you create the item, you can't update its key. - name: displayName | type: string | description: Storage item display name. The display name appears when you [add or edit steps to your automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-3-add-steps-to-you-automation). - name: description | type: string | description: Storage item description. - name: type | type: Type | description: Data type of the storage item's value. Once created, you can't change the value's type. - enum: - STRING: String. - BOOLEAN: Boolean. - NUMBER: Number. - COUNTER: Counter. > **Note**: Counters are numeric values used for running totals. They support [atomic increment and decrement operations](https://dev.wix.com/docs/api-reference/business-management/automations/storage-item/introduction.md#atomic-updates). - name: _createdDate | type: Date | description: When the storage item was created. - name: _updatedDate | type: Date | description: When the storage item was last updated. - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/api-reference/business-management/tags/introduction.md) assigned to the storage item. You can use public and private tags for categorization and filtering. - name: privateTags | type: TagList | description: List of private tags. Private tags require additional permissions to access. They are usually hidden from site members and visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: publicTags | type: TagList | description: List of public tags. Public tags are visible to anyone with access to the main storage item, including site members and visitors. - name: extendedFields | type: ExtendedFields | description: Extended fields. - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: STORAGE_ITEM_VALUE_VALIDATION_EXCEPTION | Description: Invalid storage item value. The value has an invalid format. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_STORAGE_ITEM_KEY_EXCEPTION | Description: Invalid storage item key. The storage item key can only contain letters, numbers, and underscores. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TOO_MANY_STORAGE_ITEMS | Description: The site has too many storage items. ``` ### Examples ### createStorageItem ```javascript import { storageItem } from '@wix/automations'; async function createStorageItem(storageItem) { const response = await storageItem.createStorageItem(storageItem); }; ``` ### createStorageItem (with elevated permissions) ```javascript import { storageItem } from '@wix/automations'; import { auth } from '@wix/essentials'; async function myCreateStorageItemMethod(storageItem) { const elevatedCreateStorageItem = auth.elevate(storageItem.createStorageItem); const response = await elevatedCreateStorageItem(storageItem); } ``` ### createStorageItem (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 { storageItem } from '@wix/automations'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { storageItem }, // Include the auth strategy and host as relevant }); async function createStorageItem(storageItem) { const response = await myWixClient.storageItem.createStorageItem(storageItem); }; ``` ---