# Rule Import

You can import rules individually, entire folders, or import the entire space. You can also update existing rules or create new versions of them.

## How to Import

### **Method 1:  Import as New Rule**

**Import from Rule List:**

1. Navigate to the **Rule Lists** section.
2. Select empty space or folder where you want to import the rule.
3. Click the **Import** button.
4. Select your file: **JSON** or **XLSX**.
5. Click the **Import** button.

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FJLrO6yig7z8pNysvGytQ%2FScreenshot%202026-02-10%20at%2011.49.06.png?alt=media&#x26;token=d6f352ce-e420-4f24-ac5c-b7dc6e28cb33" alt=""><figcaption></figcaption></figure>

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2F8AHI0PB0B7QaIpthTk89%2FScreenshot%202026-02-10%20at%2011.51.34.png?alt=media&#x26;token=8fd09647-c2d8-4343-8c74-9c595e5a1f13" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %}
The imported rule may have the same name as an existing rule, but it cannot have the same alias. If an alias conflict is detected, you will receive a warning.
{% endhint %}

### **Method 2:  Override Current Version**

1. Open the rule you want to overwrite.
2. Click the **three dots** in the top right corner to open **Rule Actions**.
3. Select **Import Version**.
4. Choose your import **Overwrite latest version** - Replaces the current version.
5. Select your file: **JSON** or **XLSX**.
6. Click the **Import** button.

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FnUo0O11FKcsYoseqpsdn%2FScreenshot%202026-02-10%20at%2012.04.53.png?alt=media&#x26;token=362f98c2-2a8f-44f2-8e42-ab95ced56f23" alt=""><figcaption></figcaption></figure>

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FT0UJ162fy72CkUqrg3mN%2FScreenshot%202026-02-10%20at%2012.05.36.png?alt=media&#x26;token=36b41d47-63b2-4d93-8626-26bbaa031046" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
You can find all previous changes in the [history tab](https://docs.decisionrules.io/doc/rules/common-rule-features/rule-history).
{% endhint %}

### **Method 3:  Import as New Version**

1. Open the rule you want to overwrite.
2. Click the **three dots** in the top right corner to open **Rule Actions**.
3. Select **Import Version**.
4. Choose your import **Import as new version** - Creates new version of rule you are importing with name and alias of current one.
5. Select your file: **JSON** or **XLSX**.
6. Click the **Import** button.

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FnUo0O11FKcsYoseqpsdn%2FScreenshot%202026-02-10%20at%2012.04.53.png?alt=media&#x26;token=362f98c2-2a8f-44f2-8e42-ab95ced56f23" alt=""><figcaption></figcaption></figure>

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FdHx2WvD00I0MAxCHYshV%2FScreenshot%202026-02-10%20at%2012.09.38.png?alt=media&#x26;token=378de52a-9963-4fa1-80d8-05ec3ba30cdc" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FbEEgNSPoQ0l9LR4IqiLv%2FScreenshot%202026-02-10%20at%2012.11.03.png?alt=media&#x26;token=709c6794-3062-4f8e-858c-cb685cfb3ad8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The imported rule's status depends on the `status` field in the exported file. More details about rule statuses, see [Rule Status](https://docs.decisionrules.io/doc/rules/common-rule-features/rule-settings/rule-state).
{% endhint %}

## File Format Requirements

### JSON Format

#### Base Schema

Every rule import must include these mandatory fields:

```json
{
    "type": "rule-type",      // See rule-specific types below
    "name": "Rule Name",      // Any string
    "status": "published",    // "published" or "pending"
    "inputSchema": {},        // JSON object defining input structure
    "outputSchema": {}        // JSON object defining output structure
}
```

{% hint style="warning" %}
If no `ruleAlias` is specified in the import file, one will be generated automatically.
{% endhint %}

#### Rule Type-Specific Requirements

In addition to the base schema, each rule type requires specific additional fields:

***

**Decision Table**

```json
{
  "type": "decision-table",
  "decisionTable": {
    "columns": [],      // Array with at least one input column and one output column
    "rows": []          // Array of row data (can be empty)
  }
}
```

**Scripting Rule**

```json
{
    "type": "complex-rule",
    "script": {}         // String containing JavaScript code
}
```

**Lookup Table**

```json
{
    "type": "lookup-table",
    "primaryKeyColumn": {},   // Object defining the primary key column
    "columns": [],            // Array defining all table columns
    "data": {}                // List of objects containing table data rows (can be empty)
}
```

**Decision Flow**

```json
{
    "type": "workflow",
    "workflowData": {}    // Object containing flow structure and nodes
}
```

**Integration Flow**

```json
{
    "type": "integration-flow",
    "workflowData": {}    // Object containing integration flow structure and nodes
}
```

### **XLSX Format**

For detailed XLSX import specifications, see [Managing Decision Table in Excel/Google Sheets](https://docs.decisionrules.io/doc/rules/common-rule-features/rule-export-and-import/managing-decision-table-in-excel-google-sheets)

### CSV Format

For detailed CSV import specifications, see [Lookup Table CSV Import](https://docs.decisionrules.io/doc/rules/lookup-table/data-import-and-export)
