> 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

# GetActionDynamicOutputSchema

# Package: actions

# Namespace: ActionCatalogService

# Method link: https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/get-action-dynamic-output-schema.md

## Permission Scopes:
Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS

## Introduction

Retrieves an [action's dynamic output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema), based on the action's input mapping.

---

## REST API

### Schema

```
 Method: getActionDynamicOutputSchema
 Description: Retrieves an [action's dynamic output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema), based on the action's input mapping.
 URL: https://www.wixapis.com/v1/actions/dynamic-output-schema
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  appId, actionKey, inputMapping
 Method parameters: 
   param name: actionKey | type: actionKey | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 50
   param name: appId | type: appId | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: format GUID
   param name: inputMapping | type: inputMapping | description: Action input mapping as defined in the [action's input schema](https://dev.wix.com/docs/api-reference/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. | required: true 
 Return type: GetActionDynamicOutputSchemaResponse
  - name: outputSchema | type: object | description: A [JSON schema](https://json-schema.org/) containing the action's output schema.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ACTION_SPI_OUTPUT_SCHEMA_NOT_VALID_JSON_SCHEMA | Description: The action provider returned an output schema that is not valid JSON schema.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_OUTPUT_SCHEMA_NOT_DEFINED | Description: The action provider did not define an output schema for the requested action.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_NOT_FOUND | Description: The requested action does not have a matching service plugin implementer.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GET_DYNAMIC_OUTPUT_SCHEMA_NOT_IMPLEMENTED | Description: The action provider does not implement dynamic output schema retrieval.


```

### Examples

### Get action dynamic output schema
```curl
curl -X POST 'https://www.wixapis.com/v1/actions/dynamic-output-schema' \
    -H 'Authorization: <AUTH>' \
    -H 'Content-Type: application/json' \
    -d '{
      "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
      "actionKey": "send-gift-card",
      "inputMapping": {
        "contactId": "{{var(\"contact.id\")}}",
        "amount": 50
      }
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automations.actionCatalog.getActionDynamicOutputSchema(appId, options)
 Description: Retrieves an [action's dynamic output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema), based on the action's input mapping.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  appId, options.actionKey, options.inputMapping, options
 Method parameters: 
   param name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: format GUID
   param name: options | type: GetActionDynamicOutputSchemaOptions  none | required: true 
        - name: actionKey | type: string | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 50
        - name: inputMapping | type: object | description: Action input mapping as defined in the [action's input schema](https://dev.wix.com/docs/api-reference/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. | required: true 
 Return type: PROMISE<GetActionDynamicOutputSchemaResponse>
  - name: outputSchema | type: object | description: A [JSON schema](https://json-schema.org/) containing the action's output schema.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ACTION_SPI_OUTPUT_SCHEMA_NOT_VALID_JSON_SCHEMA | Description: The action provider returned an output schema that is not valid JSON schema.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_OUTPUT_SCHEMA_NOT_DEFINED | Description: The action provider did not define an output schema for the requested action.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_NOT_FOUND | Description: The requested action does not have a matching service plugin implementer.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GET_DYNAMIC_OUTPUT_SCHEMA_NOT_IMPLEMENTED | Description: The action provider does not implement dynamic output schema retrieval.


```

### Examples

### Get action dynamic output schema
Retrieves the dynamic output schema for an action based on its input mapping.

```javascript
import { actionCatalog } from "@wix/automations";

async function getActionDynamicOutputSchema() {
  const response = await actionCatalog.getActionDynamicOutputSchema({
    appId: "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
    actionKey: "send-gift-card",
    inputMapping: {
      contactId: "{{var(\"contact.id\")}}",
      amount: 50,
    },
  });
  return response;
}

/* Promise resolves to:
 * {
 *   "outputSchema": {
 *     "$schema": "http://json-schema.org/draft-07/schema",
 *     "type": "object",
 *     "properties": {
 *       "giftCardId": { "type": "string", "format": "uuid", "title": "Gift Card ID" },
 *       "sentAt": { "type": "string", "format": "date-time", "title": "Sent at" }
 *     }
 *   }
 * }
 */

```

### getActionDynamicOutputSchema (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 { actionCatalog } from '@wix/automations';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function getActionDynamicOutputSchema(appId,options) {
  const response = await myWixClient.actionCatalog.getActionDynamicOutputSchema(appId,options);
};
```

---