> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateFunctionProduction

# Package: functions

# Namespace: FunctionProductions

# Method link: https://dev.wix.com/docs/api-reference/business-management/functions/function-productions/create-function-production.md

## Permission Scopes:
Manage Functions: SCOPE.DC-FUNCTIONS.MANAGE-FUNCTIONS

## Introduction

Creates a function production.

This method creates a function, an automation, and a service plugin configuration. It also creates a function method that links the function to the automation. Learn more about [function creation](https://dev.wix.com/docs/api-reference/business-management/functions/about-function-creation-and-activation.md#quick-creation-and-configuration).

You can create a function production from a function type or a function template. If you create a function production from a function type, the automation created will not contain any logic. If you create a function production from a function template, the automation created will contain the template's automation logic.

> **Note:** Some function types have a default template applied, in which case the automation created will contain the default template's automation logic.

Once created, all parts of the function production can be updated using the [Update Function Production](https://dev.wix.com/docs/api-reference/business-management/functions/function-productions/update-function-production.md) method or other APIs. They work together so if you update the function, or anything related to it, the function production object will be updated to reflect the changes.

---

## REST API

### Schema

```
 Method: createFunctionProduction
 Description: Creates a function production.  This method creates a function, an automation, and a service plugin configuration. It also creates a function method that links the function to the automation. Learn more about [function creation](https://dev.wix.com/docs/api-reference/business-management/functions/about-function-creation-and-activation.md#quick-creation-and-configuration).  You can create a function production from a function type or a function template. If you create a function production from a function type, the automation created will not contain any logic. If you create a function production from a function template, the automation created will contain the template's automation logic.  > **Note:** Some function types have a default template applied, in which case the automation created will contain the default template's automation logic.  Once created, all parts of the function production can be updated using the [Update Function Production](https://dev.wix.com/docs/api-reference/business-management/functions/function-productions/update-function-production.md) method or other APIs. They work together so if you update the function, or anything related to it, the function production object will be updated to reflect the changes.
 URL: https://www.wixapis.com/functions/v1/productions
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  functionProduction, functionProduction.type, functionProduction.appId
 Method parameters: 
   param name: functionProduction | type: FunctionProduction | description: A function production defines a function and its related entities. | required: true 
    - ONE-OF: - required: true
     - name: blankOptions | type: BlankOptions | description: Options for creating a function from a function type.  
        - name: functionExtensionId | type: string | description: GUID of the function type that the function was created from.  | validation: format GUID
     - name: templateOptions | type: TemplateOptions | description: Options for creating a function from a function template.  
        - name: functionTemplateExtensionId | type: string | description: GUID of the function template that the function was created from.  | validation: format GUID
        - name: appId | type: string | description: App GUID of the business solution that created the function type the function production is based on. | required: true | validation: format GUID
        - name: type | type: Type | description: Type that the function is created from. | required: true 
             - enum:
             -     BLANK: Function created from a function type.
             -     TEMPLATE: Function created from a function template.
        - name: functionSpiConfiguration | type: FunctionSpiConfiguration | description: Service plugin configuration for the function.  
           - name: configuration | type: object | description: Function SPI configuration dev center component payload.  
        - name: function | type: Function | description: Function created from the function production.  
           - name: functionName | type: string | description: Function name.  | validation: maxLength 100
 Return type: CreateFunctionProductionResponse
  - name: functionProduction | type: FunctionProduction | description: The created function production.  
     - ONE-OF: 
        - name: blankOptions | type: BlankOptions | description: Options for creating a function from a function type.  
           - name: functionExtensionId | type: string | description: GUID of the function type that the function was created from.  | validation: format GUID
        - name: templateOptions | type: TemplateOptions | description: Options for creating a function from a function template.  
           - name: functionTemplateExtensionId | type: string | description: GUID of the function template that the function was created from.  | validation: format GUID
     - name: id | type: string | description: Function production GUID. This is the same as the created function's GUID.  | read-only: true | validation: format GUID
     - name: appId | type: string | description: App GUID of the business solution that created the function type the function production is based on.  | validation: format GUID
     - name: type | type: Type | description: Type that the function is created from.  
         - enum:
         -     BLANK: Function created from a function type.
         -     TEMPLATE: Function created from a function template.
     - name: functionSpiConfiguration | type: FunctionSpiConfiguration | description: Service plugin configuration for the function.  
        - name: id | type: string | description: SpiConfiguration GUID.  | read-only: true | validation: format GUID
        - name: revision | type: string | description: SpiConfiguration revision.  | read-only: true | validation: format int64
        - name: createdDate | type: string | description: Date and time the SpiConfiguration was created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the SpiConfiguration was last updated.  | read-only: true | validation: format date-time
        - name: functionId | type: string | description: Function GUID  | read-only: true | validation: format GUID
        - name: configuration | type: object | description: Function SPI configuration dev center component payload.  
     - name: function | type: Function | description: Function created from the function production.  
        - name: id | type: string | description: Function GUID.  | read-only: true | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the function is updated. To prevent conflicting changes, the current revision must be passed when updating the function.  Ignored when creating a function.  | read-only: true | validation: format int64
        - name: createdDate | type: string | description: Date and time the function was created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the function was last updated.  | read-only: true | validation: format date-time
        - name: functionExtensionId | type: string | description: The function's app extension GUID.  | read-only: true | validation: format GUID
        - name: functionName | type: string | description: Function name.  | validation: maxLength 100
        - name: activationStatus | type: ActivationStatus | description: Activation status  | read-only: true 
             - enum:
             -     ACTIVE: Function is activated.
             -     INACTIVE: Function is deactivated.
             -     DRAFT: Function is saved but has never been activated.
        - name: appId | type: string | description: GUID of the app that defines the function.  | read-only: true | validation: format GUID
        - name: functionExtensionName | type: string | description: The function's app extension name.  | read-only: true | validation: minLength 1, maxLength 100
        - name: functionTemplateExtensionId | type: string | description: Function template extension id  | read-only: true | validation: format GUID
     - name: functionMethods | type: array<FunctionMethod> | description: Function methods created from the function production.  | read-only: true | validation: maxItems 100
        - name: id | type: string | description: Function method GUID.  | read-only: true | validation: format GUID
        - name: revision | type: string | description: Function method revision.  | read-only: true | validation: format int64
        - name: createdDate | type: string | description: Date and time the function method was created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the function method was last updated.  | read-only: true | validation: format date-time
        - name: automationId | type: string | description: GUID of the automation to link to the function.  | validation: format GUID
        - name: functionId | type: string | description: GUID of the function that this method links to an automation.  | validation: format GUID
        - name: methodName | type: string | description: Display name for the function method.  | validation: maxLength 160
     - name: automations | type: array<Automation> | description: Automations created from the function production.  | read-only: true | validation: maxItems 100
        - ONE-OF: 
           - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it.  
              - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id).  You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard.  | validation: format GUID
           - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation.  
              - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md).  | validation: format GUID
              - name: override | type: boolean | description: Whether the automation is an override.  When a user modifies the preinstalled automation installed on their site, a site-specific version of the automation is created that overrides the automation that was originally installed. This override automation is assigned a **new** automation GUID — it does not reuse the GUID of the original preinstalled automation.  > **Note**: Once an override exists, [Get Automation](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/get-automation.md) on the *original* preinstalled automation's GUID returns `404 Not Found`. Use [Query Automations](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/query-automations.md) (for example, by `configuration.trigger.triggerKey`) to find the current automation, or retrieve `automationId` from the activation log. > > An override automation can no longer be updated by the app that originally installed it. > > To revert to the original preinstalled version, the user must delete the override by calling the Delete Automation method. Calling Delete Automation on an override automation removes the override and restores the preinstalled automation that was previously installed, once again accessible via its original GUID.  Default: `false`.  | read-only: true | validation: immutable
           - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation.  
              - name: appId | type: string | description: GUID of the app that added the template automation.  | validation: format GUID
        - name: id | type: string | description: Automation GUID.  | read-only: true | validation: format GUID
        - name: revision | type: string | description: Revision number. This increments by 1 whenever the automation is updated. Specify the current revision number whenever updating an existing automation.  | read-only: true | validation: format int64
        - name: createdBy | type: AuditInfo | description: Who created the automation.  | read-only: true | validation: immutable
           - ONE-OF: 
              - name: userId | type: string | description: [User GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#user-id).  | validation: format GUID
              - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id).  You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard.  | validation: format GUID
        - name: createdDate | type: string | description: When the automation was created.  | read-only: true | validation: format date-time
        - name: updatedBy | type: AuditInfo | description: Who last updated the automation.  | read-only: true 
        - name: updatedDate | type: string | description: When the automation was last updated.  | read-only: true | validation: format date-time
        - name: name | type: string | description: Automation name as displayed on the user's site.  | validation: minLength 1, maxLength 500
        - name: description | type: string | description: Automation description.  | validation: maxLength 2000
        - name: configuration | type: AutomationConfiguration | description: Automation configuration.  
           - name: status | type: Status | description: Status of the automation on the site.  
                 - enum:
                 -     ACTIVE: Active. Active automations can be triggered.
                 -     INACTIVE: Inactive. Inactive automations cannot be triggered.
           - name: trigger | type: Trigger | description: Trigger configuration.  
              - name: appId | type: string | description: GUID of the app that defines the trigger.  | validation: format GUID
              - name: triggerKey | type: string | description: Trigger key.  Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger).  | validation: minLength 1, maxLength 100
              - name: filters | type: array<Filter> | description: Schema field filters. All filter conditions must be met for the automation to run.  Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters).  | validation: maxItems 5
                 - name: id | type: string | description: Filter GUID.  | validation: format GUID
                 - name: fieldKey | type: string | description: Field key.  You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md).  | validation: minLength 1, maxLength 110
                 - name: filterExpression | type: string | description: Filter expression in bracket notation.  For the automation to run, the expression must evaluate to `true`.  | validation: maxLength 5000
              - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs.  Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events).  
                 - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation.  > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action).  | validation: maxLength 1000
                 - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset.  
                         - enum:
                         -     MINUTES: Minutes.
                         -     HOURS: Hours.
                         -     DAYS: Days.
                         -     WEEKS: Weeks.
                         -     MONTHS: Months.
              - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema.  
           - name: rootActionIds | type: array<string> | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel.  > **Note**: You can currently only specify 1 root action.  | validation: maxItems 20, format GUID
           - name: actions | type: Map<string,Action> | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below.  | validation: format map
              - ONE-OF: 
                 - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`.  
                    - name: appId | type: string | description: GUID of the app that defines the action.  | validation: format GUID
                    - name: actionKey | type: string | description: Action key.  | validation: minLength 1, maxLength 100
                    - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md).  The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema.  
                    - name: postActionIds | type: array<string> | description: IDs of actions that run in parallel after the action completes.  | validation: maxItems 1, format GUID
                    - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema.  
                 - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`.  
                    - name: orExpressionGroups | type: array<ConditionExpressionGroup> | description: Condition is `true` if one or more of the expression groups evaluates to `true`.  | validation: minItems 1, maxItems 10
                       - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions.  
                                 - enum:
                                 -     OR: `OR` operator.
                                 -     AND: `AND` operator.
                       - name: booleanExpressions | type: array<string> | description: Expressions evaluated using the selected operator.  | validation: minItems 1, maxItems 20, maxLength 5000
                    - name: truePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `true`.  | validation: maxItems 1, format GUID
                    - name: falsePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `false`.  | validation: maxItems 1, format GUID
                    - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior).  | validation: format GUID
                 - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`.  
                    - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean.  
                       - name: language | type: Language | description: Logical operator used to evaluate the condition expressions.  
                                 - enum:
                                 -     JAVASCRIPT: JavaScript.
                       - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format  | validation: maxLength 3000
                    - name: dynamicVariableExpressions | type: array<string> | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose.  | validation: maxItems 50, maxLength 100
                    - name: truePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `true`.  | validation: maxItems 1, format GUID
                    - name: falsePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `false`.  | validation: maxItems 1, format GUID
                    - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior).  | validation: format GUID
                 - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`.  
                    - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes.  > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`.  | validation: maxLength 1000
                    - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs.  
                    - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation.  > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset.  | validation: maxLength 1000
                    - name: postActionIds | type: array<string> | description: IDs of actions to run in parallel after the time delay.  | validation: maxItems 1, format GUID
                 - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`.  
                    - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run.  | validation: maxLength 1000
                    - name: rateLimitDurationExpression | type: string | description: Rate limit duration.  When empty, the rate limit does not expire.  | validation: maxLength 1000
                    - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit.  
                    - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations.  | validation: minLength 1, maxLength 400
                    - name: postActionIds | type: array<string> | description: IDs of actions to run in parallel after the action completes.  | validation: maxItems 1, format GUID
              - name: id | type: string | description: Action GUID.  Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow.  If not specified, automatically generated by Wix.  | validation: format GUID
              - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type).  
                     - enum:
                     -     APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard.
                     -     CONDITION: Condition action. Evaluates a condition to determine which action runs next.  Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations.  > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped.
                     -     CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next.  Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations.  > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped.
                     -     DELAY: Delay. The automation must wait before executing the next step.
                     -     RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions.
              - name: displayName | type: string | description: Editable display name for the action.  | validation: minLength 1, maxLength 60
              - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type.  If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten.  | validation: minLength 1, maxLength 100
              - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs.  When empty, the action runs.  | validation: maxLength 1000
        - name: origin | type: Origin | description: How the automation was added to the user's site.  | validation: immutable
             - enum:
             -     USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user).
             -     APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site.
             -     PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md).
        - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations  
           - name: hidden | type: boolean | description: Whether the automation is hidden from users.  Default: `false`  
           - name: readonly | type: boolean | description: Whether the automation is read-only.  When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`.  Default: `false`.  > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`.  
           - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site.  Default: `false`.  
           - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`.  Default: `false`.  
           - name: actionSettings | type: ActionSettings | description: Automation action settings.  
              - name: permanentActionIds | type: array<string> | description: IDs of actions whose `skipActionExpression` can't be modified.  An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed.  When empty, the `skipActionExpression` of all actions can be edited.  | validation: maxItems 30, format GUID
              - name: readonlyActionIds | type: array<string> | description: IDs of read-only actions. Read-only actions cannot be modified.  When empty and the automation's `settings.readonly` is `false`, all actions are modifiable.  | validation: maxItems 30, format GUID
        - name: draftInfo | type: DraftInfo | description: Draft details. Returned only when the automation is a draft.  | read-only: true 
           - name: originalAutomationId | type: string | description: GUID of the automation that the draft is based on.  Empty when the draft isn't based on an existing automation.  | read-only: true | validation: format GUID
        - name: archived | type: boolean | description: Whether the automation is archived.  To archive an automation, set this to `true`. To restore an archived automation, set this to `false`.  
        - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy  
           - name: archiveDate | type: string | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence  | validation: format date-time
     - name: createdDate | type: string | description: Date and time the function production was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the function production was last updated.  | read-only: true | validation: format date-time


```

### Examples

### Create Function Production from template
```curl
curl --request POST \
  https://www.wixapis.com/functions/v1/productions \
  --header "Authorization: <AUTH>" \
  --header "Content-Type: application/json" \
  --data '{
    "functionProduction": {
      "type": "TEMPLATE",
      "appId": "d49080e4-7b60-4dd4-b18a-f7ba7856bf27",
      "templateOptions": {
        "functionTemplateExtensionId": "545d1812-601f-4867-9f62-32a077e7d3f0"
      }
    }
  }'
```

### Create blank Function Production
```curl
curl --request POST \
  https://www.wixapis.com/functions/v1/productions \
  --header "Authorization: <AUTH>" \
  --header "Content-Type: application/json" \
  --data '{
    "functionProduction": {
      "type": "BLANK",
      "appId": "d49080e4-7b60-4dd4-b18a-f7ba7856bf27",
      "blankOptions": {
        "functionExtensionId": "4e6a2f9b-f8c4-490f-b7f7-1ea9febf2e94"
      }
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.functions.functionProductions.createFunctionProduction(functionProduction)
 Description: Creates a function production.  This method creates a function, an automation, and a service plugin configuration. It also creates a function method that links the function to the automation. Learn more about [function creation](https://dev.wix.com/docs/api-reference/business-management/functions/about-function-creation-and-activation.md#quick-creation-and-configuration).  You can create a function production from a function type or a function template. If you create a function production from a function type, the automation created will not contain any logic. If you create a function production from a function template, the automation created will contain the template's automation logic.  > **Note:** Some function types have a default template applied, in which case the automation created will contain the default template's automation logic.  Once created, all parts of the function production can be updated using the [Update Function Production](https://dev.wix.com/docs/api-reference/business-management/functions/function-productions/update-function-production.md) method or other APIs. They work together so if you update the function, or anything related to it, the function production object will be updated to reflect the changes.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  functionProduction, functionProduction.type, functionProduction.appId
 Method parameters: 
   param name: functionProduction | type: FunctionProduction | description: A function production defines a function and its related entities. | required: true 
    - ONE-OF: - required: true
     - name: blankOptions | type: BlankOptions | description: Options for creating a function from a function type.  
        - name: functionExtensionId | type: string | description: GUID of the function type that the function was created from.  | validation: format GUID
     - name: templateOptions | type: TemplateOptions | description: Options for creating a function from a function template.  
        - name: functionTemplateExtensionId | type: string | description: GUID of the function template that the function was created from.  | validation: format GUID
        - name: appId | type: string | description: App GUID of the business solution that created the function type the function production is based on. | required: true | validation: format GUID
        - name: type | type: Type | description: Type that the function is created from. | required: true 
             - enum:
             -     BLANK: Function created from a function type.
             -     TEMPLATE: Function created from a function template.
        - name: functionSpiConfiguration | type: FunctionSpiConfiguration | description: Service plugin configuration for the function.  
           - name: configuration | type: object | description: Function SPI configuration dev center component payload.  
        - name: function | type: Function | description: Function created from the function production.  
           - name: functionName | type: string | description: Function name.  | validation: maxLength 100
 Return type: PROMISE<FunctionProduction>
  - ONE-OF: 
     - name: blankOptions | type: BlankOptions | description: Options for creating a function from a function type.  
        - name: functionExtensionId | type: string | description: GUID of the function type that the function was created from.  | validation: format GUID
     - name: templateOptions | type: TemplateOptions | description: Options for creating a function from a function template.  
        - name: functionTemplateExtensionId | type: string | description: GUID of the function template that the function was created from.  | validation: format GUID
  - name: _id | type: string | description: Function production GUID. This is the same as the created function's GUID.  | read-only: true | validation: format GUID
  - name: appId | type: string | description: App GUID of the business solution that created the function type the function production is based on.  | validation: format GUID
  - name: type | type: Type | description: Type that the function is created from.  
     - enum:
     -     BLANK: Function created from a function type.
     -     TEMPLATE: Function created from a function template.
  - name: functionSpiConfiguration | type: FunctionSpiConfiguration | description: Service plugin configuration for the function.  
     - name: _id | type: string | description: SpiConfiguration GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: SpiConfiguration revision.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the SpiConfiguration was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the SpiConfiguration was last updated.  | read-only: true 
     - name: functionId | type: string | description: Function GUID  | read-only: true | validation: format GUID
     - name: configuration | type: object | description: Function SPI configuration dev center component payload.  
  - name: function | type: Function | description: Function created from the function production.  
     - name: _id | type: string | description: Function GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the function is updated. To prevent conflicting changes, the current revision must be passed when updating the function.  Ignored when creating a function.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the function was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the function was last updated.  | read-only: true 
     - name: functionExtensionId | type: string | description: The function's app extension GUID.  | read-only: true | validation: format GUID
     - name: functionName | type: string | description: Function name.  | validation: maxLength 100
     - name: activationStatus | type: ActivationStatus | description: Activation status  | read-only: true 
         - enum:
         -     ACTIVE: Function is activated.
         -     INACTIVE: Function is deactivated.
         -     DRAFT: Function is saved but has never been activated.
     - name: appId | type: string | description: GUID of the app that defines the function.  | read-only: true | validation: format GUID
     - name: functionExtensionName | type: string | description: The function's app extension name.  | read-only: true | validation: minLength 1, maxLength 100
     - name: functionTemplateExtensionId | type: string | description: Function template extension id  | read-only: true | validation: format GUID
  - name: functionMethods | type: array<FunctionMethod> | description: Function methods created from the function production.  | read-only: true | validation: maxItems 100
     - name: _id | type: string | description: Function method GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Function method revision.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the function method was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the function method was last updated.  | read-only: true 
     - name: automationId | type: string | description: GUID of the automation to link to the function.  | validation: format GUID
     - name: functionId | type: string | description: GUID of the function that this method links to an automation.  | validation: format GUID
     - name: methodName | type: string | description: Display name for the function method.  | validation: maxLength 160
  - name: automations | type: array<Automation> | description: Automations created from the function production.  | read-only: true | validation: maxItems 100
     - ONE-OF: 
        - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it.  
           - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id).  You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard.  | validation: format GUID
        - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation.  
           - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md).  | validation: format GUID
           - name: override | type: boolean | description: Whether the automation is an override.  When a user modifies the preinstalled automation installed on their site, a site-specific version of the automation is created that overrides the automation that was originally installed. This override automation is assigned a **new** automation GUID — it does not reuse the GUID of the original preinstalled automation.  > **Note**: Once an override exists, [Get Automation](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/get-automation.md) on the *original* preinstalled automation's GUID returns `404 Not Found`. Use [Query Automations](https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/query-automations.md) (for example, by `configuration.trigger.triggerKey`) to find the current automation, or retrieve `automationId` from the activation log. > > An override automation can no longer be updated by the app that originally installed it. > > To revert to the original preinstalled version, the user must delete the override by calling the Delete Automation method. Calling Delete Automation on an override automation removes the override and restores the preinstalled automation that was previously installed, once again accessible via its original GUID.  Default: `false`.  | read-only: true | validation: immutable
        - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation.  
           - name: appId | type: string | description: GUID of the app that added the template automation.  | validation: format GUID
     - name: _id | type: string | description: Automation GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number. This increments by 1 whenever the automation is updated. Specify the current revision number whenever updating an existing automation.  | read-only: true | validation: format int64
     - name: createdBy | type: AuditInfo | description: Who created the automation.  | read-only: true | validation: immutable
        - ONE-OF: 
           - name: userId | type: string | description: [User GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#user-id).  | validation: format GUID
           - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id).  You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard.  | validation: format GUID
     - name: _createdDate | type: Date | description: When the automation was created.  | read-only: true 
     - name: updatedBy | type: AuditInfo | description: Who last updated the automation.  | read-only: true 
     - name: _updatedDate | type: Date | description: When the automation was last updated.  | read-only: true 
     - name: name | type: string | description: Automation name as displayed on the user's site.  | validation: minLength 1, maxLength 500
     - name: description | type: string | description: Automation description.  | validation: maxLength 2000
     - name: configuration | type: AutomationConfiguration | description: Automation configuration.  
        - name: status | type: Status | description: Status of the automation on the site.  
             - enum:
             -     ACTIVE: Active. Active automations can be triggered.
             -     INACTIVE: Inactive. Inactive automations cannot be triggered.
        - name: trigger | type: Trigger | description: Trigger configuration.  
           - name: appId | type: string | description: GUID of the app that defines the trigger.  | validation: format GUID
           - name: triggerKey | type: string | description: Trigger key.  Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger).  | validation: minLength 1, maxLength 100
           - name: filters | type: array<Filter> | description: Schema field filters. All filter conditions must be met for the automation to run.  Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters).  | validation: maxItems 5
              - name: _id | type: string | description: Filter GUID.  | validation: format GUID
              - name: fieldKey | type: string | description: Field key.  You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md).  | validation: minLength 1, maxLength 110
              - name: filterExpression | type: string | description: Filter expression in bracket notation.  For the automation to run, the expression must evaluate to `true`.  | validation: maxLength 5000
           - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs.  Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events).  
              - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation.  > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action).  | validation: maxLength 1000
              - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset.  
                     - enum:
                     -     MINUTES: Minutes.
                     -     HOURS: Hours.
                     -     DAYS: Days.
                     -     WEEKS: Weeks.
                     -     MONTHS: Months.
           - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema.  
        - name: rootActionIds | type: array<string> | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel.  > **Note**: You can currently only specify 1 root action.  | validation: maxItems 20, format GUID
        - name: actions | type: Map<string,Action> | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below.  | validation: format map
           - ONE-OF: 
              - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`.  
                 - name: appId | type: string | description: GUID of the app that defines the action.  | validation: format GUID
                 - name: actionKey | type: string | description: Action key.  | validation: minLength 1, maxLength 100
                 - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md).  The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema.  
                 - name: postActionIds | type: array<string> | description: IDs of actions that run in parallel after the action completes.  | validation: maxItems 1, format GUID
                 - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema.  
              - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`.  
                 - name: orExpressionGroups | type: array<ConditionExpressionGroup> | description: Condition is `true` if one or more of the expression groups evaluates to `true`.  | validation: minItems 1, maxItems 10
                    - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions.  
                             - enum:
                             -     OR: `OR` operator.
                             -     AND: `AND` operator.
                    - name: booleanExpressions | type: array<string> | description: Expressions evaluated using the selected operator.  | validation: minItems 1, maxItems 20, maxLength 5000
                 - name: truePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `true`.  | validation: maxItems 1, format GUID
                 - name: falsePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `false`.  | validation: maxItems 1, format GUID
                 - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior).  | validation: format GUID
              - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`.  
                 - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean.  
                    - name: language | type: Language | description: Logical operator used to evaluate the condition expressions.  
                             - enum:
                             -     JAVASCRIPT: JavaScript.
                    - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format  | validation: maxLength 3000
                 - name: dynamicVariableExpressions | type: array<string> | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose.  | validation: maxItems 50, maxLength 100
                 - name: truePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `true`.  | validation: maxItems 1, format GUID
                 - name: falsePostActionIds | type: array<string> | description: IDs of actions to run when the condition evaluates to `false`.  | validation: maxItems 1, format GUID
                 - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior).  | validation: format GUID
              - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`.  
                 - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes.  > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`.  | validation: maxLength 1000
                 - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs.  
                 - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation.  > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset.  | validation: maxLength 1000
                 - name: postActionIds | type: array<string> | description: IDs of actions to run in parallel after the time delay.  | validation: maxItems 1, format GUID
              - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`.  
                 - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run.  | validation: maxLength 1000
                 - name: rateLimitDurationExpression | type: string | description: Rate limit duration.  When empty, the rate limit does not expire.  | validation: maxLength 1000
                 - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit.  
                 - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations.  | validation: minLength 1, maxLength 400
                 - name: postActionIds | type: array<string> | description: IDs of actions to run in parallel after the action completes.  | validation: maxItems 1, format GUID
           - name: _id | type: string | description: Action GUID.  Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow.  If not specified, automatically generated by Wix.  | validation: format GUID
           - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type).  
                 - enum:
                 -     APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard.
                 -     CONDITION: Condition action. Evaluates a condition to determine which action runs next.  Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations.  > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped.
                 -     CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next.  Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations.  > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped.
                 -     DELAY: Delay. The automation must wait before executing the next step.
                 -     RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions.
           - name: displayName | type: string | description: Editable display name for the action.  | validation: minLength 1, maxLength 60
           - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type.  If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten.  | validation: minLength 1, maxLength 100
           - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs.  When empty, the action runs.  | validation: maxLength 1000
     - name: origin | type: Origin | description: How the automation was added to the user's site.  | validation: immutable
         - enum:
         -     USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user).
         -     APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site.
         -     PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md).
     - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations  
        - name: hidden | type: boolean | description: Whether the automation is hidden from users.  Default: `false`  
        - name: readonly | type: boolean | description: Whether the automation is read-only.  When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`.  Default: `false`.  > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`.  
        - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site.  Default: `false`.  
        - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`.  Default: `false`.  
        - name: actionSettings | type: ActionSettings | description: Automation action settings.  
           - name: permanentActionIds | type: array<string> | description: IDs of actions whose `skipActionExpression` can't be modified.  An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed.  When empty, the `skipActionExpression` of all actions can be edited.  | validation: maxItems 30, format GUID
           - name: readonlyActionIds | type: array<string> | description: IDs of read-only actions. Read-only actions cannot be modified.  When empty and the automation's `settings.readonly` is `false`, all actions are modifiable.  | validation: maxItems 30, format GUID
     - name: draftInfo | type: DraftInfo | description: Draft details. Returned only when the automation is a draft.  | read-only: true 
        - name: originalAutomationId | type: string | description: GUID of the automation that the draft is based on.  Empty when the draft isn't based on an existing automation.  | read-only: true | validation: format GUID
     - name: archived | type: boolean | description: Whether the automation is archived.  To archive an automation, set this to `true`. To restore an archived automation, set this to `false`.  
     - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy  
        - name: archiveDate | type: Date | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence  
  - name: _createdDate | type: Date | description: Date and time the function production was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the function production was last updated.  | read-only: true 


```

### Examples

### createFunctionProduction
```javascript
import { functionProductions } from '@wix/functions';

async function createFunctionProduction(functionProduction) {
  const response = await functionProductions.createFunctionProduction(functionProduction);
};
```

### createFunctionProduction (with elevated permissions)
```javascript
import { functionProductions } from '@wix/functions';
import { auth } from '@wix/essentials';

async function myCreateFunctionProductionMethod(functionProduction) {
  const elevatedCreateFunctionProduction = auth.elevate(functionProductions.createFunctionProduction);
  const response = await elevatedCreateFunctionProduction(functionProduction);
}
```

### createFunctionProduction (self-managed)
Self-managed 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 { functionProductions } from '@wix/functions';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function createFunctionProduction(functionProduction) {
  const response = await myWixClient.functionProductions.createFunctionProduction(functionProduction);
};
```

---