> For the complete documentation index, see [llms.txt](https://docs.decisionrules.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decisionrules.io/doc/api/management-api.md).

# Management API

The Management API is a secure REST API that provides read/write access to your rules and spaces.

API Request methods cheat sheet:&#x20;

{% hint style="info" %} <mark style="color:$success;">GET</mark> - Used to **retrieve resource representation/information** and not modify it in any way, e.g., get a JSON representaition of a rule with the GET RULES endpoint.

<mark style="color:orange;">POST</mark> - Used to **create new subordinate resources**, e.g., creating a new rule in a Space or Importing a rule into a Space.

<mark style="color:blue;">PUT</mark> - Used primarily to **update an existing resource (if the resource does not exist, then API may decide to create a new resource or not),** e.g., updating a Rule Flow

<mark style="color:purple;">PATCH</mark> - Used to **make a partial update** on a resource, e.g., add Tags to an existing rule.

<mark style="color:red;">DELETE</mark> - Used to **delete resources,** e.g., deleting rules.
{% endhint %}

{% hint style="success" %} <mark style="background-color:green;">**NEW in v1.16.0!**</mark> The Management API now fully support use of Rule Aliases when making requests.
{% endhint %}

{% hint style="info" %}
If you're using the **Regional Cloud** version of DecisionRules, read more about API calls [here](/doc/other-deployment-options/regional-cloud/region-specific-api-urls.md#making-api-calls-on-region-cloud-accounts).
{% endhint %}

## Swagger

You can check out these endpoints and call them right away using swagger.

**Swagger UI:** <https://api.decisionrules.io/api/docs/>

**Swagger JSON File:** <https://api.decisionrules.io/api/docs/json>

## Folder Paths

{% hint style="success" %} <mark style="background-color:green;">**NEW in v1.18.1**</mark> Some Management API Endpoints now support targetting by **Folder Path.**&#x20;
{% endhint %}

All Folder and select Rule endpoints now support targetting items by their folder path. Instead of having to provide the requests with Rule Aliases/IDs or Folder IDs users can now define the request target by leveraging the new **Folder Path functionality**.

#### Example:

To access **Calculation&#x20;**<mark style="color:orange;">**v2**</mark> (see image below), instead of appending it's rule ID to the request as a parameter you can now specify the ?path= query parameter.&#x20;

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FruUQ54oc7IoTzMEWyu8X%2Fimage.png?alt=media&amp;token=f7f8c1a4-3074-4364-8a94-14ed02bacc61" alt="" width="216"><figcaption></figcaption></figure>

In this case to GET the rule the request would look like this:

```
https://api.decisionrules.io/api/rule?path=/Client/Important/Calculation&version=2
```

To access the entire "Important" Folder the request could now look like this:

```
https://api.decisionrules.io/api/folder?path=/Client/Important
```

{% hint style="warning" %}

* Request targets can be defined either by the ID **or** path, not both at the same time
* Folder Paths have to always begin with a slash "/"
* To target specific rule versions by path use the ?version= query parameter&#x20;
  {% endhint %}

## Rules

## Get rule

> Gets all of the information stored about the rule, including its content, version or input and output schemas. \
> \
> \- If the version is specified, gets the version irrespective of the rule status. \
> \- If the version is not specified, gets the latest published version.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/rule/{identifier}/{version}?":{"get":{"tags":["Rule"],"summary":"Get rule","description":"Gets all of the information stored about the rule, including its content, version or input and output schemas. \n\n- If the version is specified, gets the version irrespective of the rule status. \n- If the version is not specified, gets the latest published version.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":false,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"path","in":"query","description":"The unique folder path leading to the rule. Use this OR the 'identifier' parameter.","required":false},{"schema":{"type":"integer"},"name":"version","in":"query","description":"Optional. The specific version of the business rule.","required":false},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can target the rule using [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths) instead of the :ruleId and :version parameters.
{% endhint %}

{% hint style="info" %}
Get rule might be useful when you wish to create a new version of a rule. To do so you may GET the rule, manually change the `"version"`attribute of the returned JSON object and then use said object with the POST Create rule method. This will result in a new version of the rule being created.
{% endhint %}

## Create rule

> Creates rule based on the body of the request. The body must be formatted according to the example below. For decision tables, input cells use scalarCondition, while output and calc cells use outputScalarValue. For stable editor compatibility, send outputScalarValue.type as "common" or "function" and include stringValue for function cells.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"DecisionTable":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/Row"}}},"title":"DecisionTable","description":"Decision-table data. rows[].cells must have the same count as columns. For every cell, column must reference an existing columnId and type must match the referenced column type.","required":["columns","rows"]},"Column":{"type":"object","required":["columnId","alias","type"],"properties":{"columnId":{"type":"string"},"type":{"type":"string","description":"If input, condition is required. If output, columnOutput is required. If calc, calculation is required.","enum":["input","output","calc"]},"condition":{"$ref":"#/components/schemas/Condition"},"columnOutput":{"$ref":"#/components/schemas/ColumnOutput"},"validValues":{"type":"array","items":{"$ref":"#/components/schemas/ValidValue"}},"alias":{"type":"string","description":"Stable column alias used by validations and lookup references."},"calculation":{"$ref":"#/components/schemas/Calculation"}},"title":"Column"},"Condition":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"inputVariable":{"type":"string"},"definition":{"$ref":"#/components/schemas/ColumnConditionDefinition"}},"title":"Condition"},"ColumnConditionDefinition":{"type":"object","required":["type","content"],"properties":{"type":{"type":"string","enum":["INPUT_VARIABLE","CALC_VARIABLE","RULE_VARIABLE","CONSTANT","EMPTY"]},"content":{"description":"Path, variable name, or constant value used by the condition definition."}},"title":"ColumnConditionDefinition"},"ColumnOutput":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"outputVariable":{"type":"string"}},"title":"ColumnOutput"},"ValidValue":{"type":"object","properties":{"type":{"type":"string","enum":["GENERAL","DATE"]},"value":{"type":"object","properties":{"display":{"type":"string"},"value":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"timezone":{"type":"string"}}}},"title":"ValidValue"},"Calculation":{"type":"object","required":["variable","name"],"properties":{"variable":{"type":"string"},"name":{"type":"string"}},"title":"Calculation"},"Row":{"type":"object","properties":{"cells":{"type":"array","items":{"$ref":"#/components/schemas/Cell"}},"active":{"type":"boolean"}},"title":"Row","required":["cells","active"]},"Cell":{"type":"object","properties":{"column":{"type":"string","description":"Id of the column this cell belongs to. Must match a columnId from decisionTable.columns."},"type":{"type":"string","description":"Must match the referenced column type. If input, scalarCondition is required. If output or calc, outputScalarValue is required.","enum":["input","output","calc"]},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"}},"title":"Cell","description":"Decision-table cell. Input cells require scalarCondition. Output and calc cells require outputScalarValue. For Fn output/calc cells, keep both value and stringValue so solving and editor rendering both work.","required":["column","type"]},"ScalarCondition":{"type":"object","properties":{"operator":{"type":"string"},"type":{"type":"string","enum":["general","date","function"]},"value":{"description":"Condition value. Range and list operators such as between, IN, and NOT IN use an array of strings; scalar operators use a scalar value. Function conditions use a function tree value when it is not generated from stringValue."},"stringValue":{"type":"string","description":"String representation used for function conditions. Required for function conditions so the editor can display the Fn expression."}},"title":"ScalarCondition","description":"Value definition for an input cell. General/date conditions use operator, type, and value. Function conditions use type \"function\", operator \"function\", stringValue, and a function-tree value when it is not generated by validation."},"OutputScalarValue":{"type":"object","properties":{"value":{"description":"Output value. Common outputs use the scalar/object/array value to return. Function outputs use the function tree consumed by the solver."},"type":{"type":"string","description":"Use \"common\" for ordinary output values and \"function\" for Fn output or calc expressions.","enum":["common","function"]},"stringValue":{"type":"string","description":"String representation used for function outputs and calc cells. Include it for Fn cells so older editors can display the expression."}},"title":"OutputScalarValue","description":"Value definition for output and calc cells. For editor compatibility, include type. Use type \"common\" with value for normal scalar outputs. Use type \"function\" with stringValue and the function-tree value for Fn output or calc cells; stringValue is used by older editors and value is used by the solver."},"UserVariable":{"type":"object","properties":{"name":{"type":"string"},"value":{},"saved":{"type":"boolean"},"editMode":{"type":"boolean"}},"title":"UserVariable"},"TreeNode":{"type":"object","required":["id","type","nodes"],"properties":{"id":{"type":"string"},"type":{"type":"string","description":"Type of the node.","enum":["if","then","result","else","logic_group","logic_or","condition","root"]},"operandText":{"type":"string","description":"Node text."},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"},"modelVariablePath":{"type":"string"},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"}},"title":"TreeNode"},"LookupTableColumn":{"type":"object","required":["name","order","alias"],"properties":{"name":{"type":"string"},"order":{"type":"number"},"alias":{"type":"string","description":"Stable column alias used in lookup-table data rows."},"isPrimaryKey":{"type":"boolean"}},"title":"LookupTableColumn"},"LookupTableMetadata":{"type":"object","properties":{"rowCount":{"type":"number"},"sizeBytes":{"type":"number"}},"title":"LookupTableMetadata"}}},"paths":{"/rule":{"post":{"tags":["Rule"],"summary":"Create rule","description":"Creates rule based on the body of the request. The body must be formatted according to the example below. For decision tables, input cells use scalarCondition, while output and calc cells use outputScalarValue. For stable editor compatibility, send outputScalarValue.type as \"common\" or \"function\" and include stringValue for function cells.","parameters":[{"schema":{"type":"integer"},"name":"version","in":"query","description":"Optional. The specific version of the business rule.","required":false},{"schema":{"type":"string"},"name":"path","in":"query","description":"Target folder path for the new rule. Must start with \"/\" and use folder names, not folder IDs. Example: /Client/Important. When createFolder is true, missing folder segments in this path are created before the rule is placed there. Invalid folder paths or folder names fail without creating folders.","required":false},{"schema":{"type":"boolean","default":false},"name":"createFolder","in":"query","description":"Set to true to create missing folder segments from the path query parameter before creating the rule. Defaults to false.","required":false},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","description","inputSchema","outputSchema","type","status"],"properties":{"name":{"type":"string","description":"Name of the rule"},"description":{"type":"string","description":"Description of the rule"},"inputSchema":{"type":"object","description":"Schema for input attributes","additionalProperties":{}},"outputSchema":{"type":"object","description":"Schema for output attributes","additionalProperties":{}},"decisionTable":{"$ref":"#/components/schemas/DecisionTable","description":"Decision-table structure required when type is decision-table."},"script":{"type":"string"},"userVariables":{"type":"array","items":{"$ref":"#/components/schemas/UserVariable"}},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"],"description":"Type of rule"},"status":{"type":"string","enum":["published","pending"],"description":"Current state of the rule"},"ruleId":{"type":"string","description":"Unique identifier of the rule"},"auditLog":{"type":"object","description":"Audit log settings","properties":{"active":{"type":"boolean"},"debug":{"type":"object","properties":{"active":{"type":"boolean"}}},"ttl":{"type":"integer","description":"Time-to-live in days"}}},"version":{"type":"number","description":"Version number of the rule"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional list of tags"},"baseId":{"type":"string"},"ruleAlias":{"type":"string"},"locked":{"type":"boolean"},"previousBaseId":{"type":"string","description":"Previous base ID used during imports, especially rule-flow imports."},"workflowData":{"type":"object","description":"Workflow or integration-flow data model."},"visualData":{"type":"object","description":"Visual editor data for workflow or integration-flow rules."},"columns":{"type":"array","description":"Lookup-table columns when type is lookup-table.","items":{"$ref":"#/components/schemas/LookupTableColumn"}},"primaryKeyColumn":{"type":"string","description":"Lookup-table primary key column alias when type is lookup-table."},"data":{"description":"Lookup-table row data when type is lookup-table, or AI rule configuration when type is ai-rule."},"metadata":{"$ref":"#/components/schemas/LookupTableMetadata"}},"description":"DecisionRules rule payload. For type \"decision-table\", include decisionTable.columns and decisionTable.rows. Each row must have one cell per column and each cell.column must match a column.columnId. For editor compatibility, output/calc cells should include outputScalarValue.type so common values and Fn values render consistently."}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can create the rule in a specific folder by utilizing [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths).
{% endhint %}

## Update rule

> Changes the rule according to the body of the request.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"DecisionTable":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/Row"}}},"title":"DecisionTable","description":"Decision-table data. rows[].cells must have the same count as columns. For every cell, column must reference an existing columnId and type must match the referenced column type.","required":["columns","rows"]},"Column":{"type":"object","required":["columnId","alias","type"],"properties":{"columnId":{"type":"string"},"type":{"type":"string","description":"If input, condition is required. If output, columnOutput is required. If calc, calculation is required.","enum":["input","output","calc"]},"condition":{"$ref":"#/components/schemas/Condition"},"columnOutput":{"$ref":"#/components/schemas/ColumnOutput"},"validValues":{"type":"array","items":{"$ref":"#/components/schemas/ValidValue"}},"alias":{"type":"string","description":"Stable column alias used by validations and lookup references."},"calculation":{"$ref":"#/components/schemas/Calculation"}},"title":"Column"},"Condition":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"inputVariable":{"type":"string"},"definition":{"$ref":"#/components/schemas/ColumnConditionDefinition"}},"title":"Condition"},"ColumnConditionDefinition":{"type":"object","required":["type","content"],"properties":{"type":{"type":"string","enum":["INPUT_VARIABLE","CALC_VARIABLE","RULE_VARIABLE","CONSTANT","EMPTY"]},"content":{"description":"Path, variable name, or constant value used by the condition definition."}},"title":"ColumnConditionDefinition"},"ColumnOutput":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"outputVariable":{"type":"string"}},"title":"ColumnOutput"},"ValidValue":{"type":"object","properties":{"type":{"type":"string","enum":["GENERAL","DATE"]},"value":{"type":"object","properties":{"display":{"type":"string"},"value":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"timezone":{"type":"string"}}}},"title":"ValidValue"},"Calculation":{"type":"object","required":["variable","name"],"properties":{"variable":{"type":"string"},"name":{"type":"string"}},"title":"Calculation"},"Row":{"type":"object","properties":{"cells":{"type":"array","items":{"$ref":"#/components/schemas/Cell"}},"active":{"type":"boolean"}},"title":"Row","required":["cells","active"]},"Cell":{"type":"object","properties":{"column":{"type":"string","description":"Id of the column this cell belongs to. Must match a columnId from decisionTable.columns."},"type":{"type":"string","description":"Must match the referenced column type. If input, scalarCondition is required. If output or calc, outputScalarValue is required.","enum":["input","output","calc"]},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"}},"title":"Cell","description":"Decision-table cell. Input cells require scalarCondition. Output and calc cells require outputScalarValue. For Fn output/calc cells, keep both value and stringValue so solving and editor rendering both work.","required":["column","type"]},"ScalarCondition":{"type":"object","properties":{"operator":{"type":"string"},"type":{"type":"string","enum":["general","date","function"]},"value":{"description":"Condition value. Range and list operators such as between, IN, and NOT IN use an array of strings; scalar operators use a scalar value. Function conditions use a function tree value when it is not generated from stringValue."},"stringValue":{"type":"string","description":"String representation used for function conditions. Required for function conditions so the editor can display the Fn expression."}},"title":"ScalarCondition","description":"Value definition for an input cell. General/date conditions use operator, type, and value. Function conditions use type \"function\", operator \"function\", stringValue, and a function-tree value when it is not generated by validation."},"OutputScalarValue":{"type":"object","properties":{"value":{"description":"Output value. Common outputs use the scalar/object/array value to return. Function outputs use the function tree consumed by the solver."},"type":{"type":"string","description":"Use \"common\" for ordinary output values and \"function\" for Fn output or calc expressions.","enum":["common","function"]},"stringValue":{"type":"string","description":"String representation used for function outputs and calc cells. Include it for Fn cells so older editors can display the expression."}},"title":"OutputScalarValue","description":"Value definition for output and calc cells. For editor compatibility, include type. Use type \"common\" with value for normal scalar outputs. Use type \"function\" with stringValue and the function-tree value for Fn output or calc cells; stringValue is used by older editors and value is used by the solver."},"UserVariable":{"type":"object","properties":{"name":{"type":"string"},"value":{},"saved":{"type":"boolean"},"editMode":{"type":"boolean"}},"title":"UserVariable"},"TreeNode":{"type":"object","required":["id","type","nodes"],"properties":{"id":{"type":"string"},"type":{"type":"string","description":"Type of the node.","enum":["if","then","result","else","logic_group","logic_or","condition","root"]},"operandText":{"type":"string","description":"Node text."},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"},"modelVariablePath":{"type":"string"},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"}},"title":"TreeNode"},"LookupTableColumn":{"type":"object","required":["name","order","alias"],"properties":{"name":{"type":"string"},"order":{"type":"number"},"alias":{"type":"string","description":"Stable column alias used in lookup-table data rows."},"isPrimaryKey":{"type":"boolean"}},"title":"LookupTableColumn"},"LookupTableMetadata":{"type":"object","properties":{"rowCount":{"type":"number"},"sizeBytes":{"type":"number"}},"title":"LookupTableMetadata"}}},"paths":{"/rule/{identifier}/{version}?":{"put":{"tags":["Rule"],"summary":"Update rule","description":"Changes the rule according to the body of the request.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":false,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"path","in":"query","description":"The unique folder path leading to the rule. Use this OR the 'identifier' parameter.","required":false},{"schema":{"type":"integer"},"name":"version","in":"query","description":"Optional. The specific version of the business rule.","required":false},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","description","inputSchema","outputSchema","type","status"],"properties":{"name":{"type":"string","description":"Optional name of the rule"},"id":{"type":"string","description":"Optional identifier"},"baseId":{"type":"string","description":"Optional base identifier"},"ruleAlias":{"type":"string","description":"Optional alias for the rule"},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"],"description":"Type of rule"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional list of tags"},"status":{"type":"string","enum":["published","pending"],"description":"Current state of the rule"},"version":{"type":"number","description":"Version number of the rule"},"description":{"type":"string","description":"Description of the rule"},"inputSchema":{"type":"object","description":"Schema for input attributes","additionalProperties":{}},"outputSchema":{"type":"object","description":"Schema for output attributes","additionalProperties":{}},"decisionTable":{"$ref":"#/components/schemas/DecisionTable","description":"Decision-table structure required when type is decision-table."},"script":{"type":"string"},"userVariables":{"type":"array","items":{"$ref":"#/components/schemas/UserVariable"}},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"auditLog":{"type":"object","description":"Audit log settings","properties":{"active":{"type":"boolean"},"debug":{"type":"object","properties":{"active":{"type":"boolean"}}},"ttl":{"type":"integer","description":"Time-to-live in days"}}},"ruleId":{"type":"string","description":"Unique identifier of the rule"},"createdIn":{"type":"string","format":"date-time","description":"Creation timestamp"},"lastUpdate":{"type":"string","format":"date-time","description":"Last update timestamp"},"locked":{"type":"boolean"},"previousBaseId":{"type":"string","description":"Previous base ID used during imports, especially rule-flow imports."},"workflowData":{"type":"object","description":"Workflow or integration-flow data model."},"visualData":{"type":"object","description":"Visual editor data for workflow or integration-flow rules."},"columns":{"type":"array","description":"Lookup-table columns when type is lookup-table.","items":{"$ref":"#/components/schemas/LookupTableColumn"}},"primaryKeyColumn":{"type":"string","description":"Lookup-table primary key column alias when type is lookup-table."},"data":{"description":"Lookup-table row data when type is lookup-table, or AI rule configuration when type is ai-rule."},"metadata":{"$ref":"#/components/schemas/LookupTableMetadata"}},"description":"DecisionRules rule payload. For type \"decision-table\", include decisionTable.columns and decisionTable.rows. Each row must have one cell per column and each cell.column must match a column.columnId. For editor compatibility, output/calc cells should include outputScalarValue.type so common values and Fn values render consistently."}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can target the rule using [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths) instead of the :ruleId and :version parameters.
{% endhint %}

{% hint style="info" %}
Update rule might be useful when renaming a rule. First GET the rule you wish to rename, change the`name`attribute of the returned JSON object and then use PUT Update rule with the changed JSON object.
{% endhint %}

{% hint style="info" %}
Note that there are a few attributes of the rule that cannot be updated by the `PUT` endpoint. Namely, you cannot use `PUT` to change the rule ID, version and rule alias. Also, you cannot change the date of last update, since it gets updated automatically.
{% endhint %}

## Update rule status

> Changes rule status from pending to published and vice versa. If the version is not specified, the latest version will be used.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/rule/status/{identifier}/{status}/{version}":{"put":{"tags":["Rule"],"summary":"Update rule status","description":"Changes rule status from pending to published and vice versa. If the version is not specified, the latest version will be used.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"status","in":"path","required":true,"description":"pending XOR published."},{"schema":{"type":"string"},"name":"version","in":"path","required":true,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Delete rule

> Deletes the rule.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/rule/{identifier}/{version}?":{"delete":{"tags":["Rule"],"summary":"Delete rule","description":"Deletes the rule.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":false,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"path","in":"query","description":"The unique folder path leading to the rule. Use this OR the 'identifier' parameter.","required":false},{"schema":{"type":"integer"},"name":"version","in":"query","description":"Optional. The specific version of the business rule.","required":false},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can target the rule using [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths) instead of the :ruleId and :version parameters.
{% endhint %}

{% hint style="warning" %}
If you do not specify version of the rule to be deleted, the endpoint will delete **all versions of the rule**. Please, use it with caution! Once deleted, rules cannot be recovered.
{% endhint %}

## Create new rule version

> Creates a new version of the rule identified by :ruleId and based on the body of the request. The body must be formatted according to the example below. \
> &#x20;The new version is added to the same folder as the latest version.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"DecisionTable":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/Row"}}},"title":"DecisionTable","description":"Decision-table data. rows[].cells must have the same count as columns. For every cell, column must reference an existing columnId and type must match the referenced column type.","required":["columns","rows"]},"Column":{"type":"object","required":["columnId","alias","type"],"properties":{"columnId":{"type":"string"},"type":{"type":"string","description":"If input, condition is required. If output, columnOutput is required. If calc, calculation is required.","enum":["input","output","calc"]},"condition":{"$ref":"#/components/schemas/Condition"},"columnOutput":{"$ref":"#/components/schemas/ColumnOutput"},"validValues":{"type":"array","items":{"$ref":"#/components/schemas/ValidValue"}},"alias":{"type":"string","description":"Stable column alias used by validations and lookup references."},"calculation":{"$ref":"#/components/schemas/Calculation"}},"title":"Column"},"Condition":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"inputVariable":{"type":"string"},"definition":{"$ref":"#/components/schemas/ColumnConditionDefinition"}},"title":"Condition"},"ColumnConditionDefinition":{"type":"object","required":["type","content"],"properties":{"type":{"type":"string","enum":["INPUT_VARIABLE","CALC_VARIABLE","RULE_VARIABLE","CONSTANT","EMPTY"]},"content":{"description":"Path, variable name, or constant value used by the condition definition."}},"title":"ColumnConditionDefinition"},"ColumnOutput":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"outputVariable":{"type":"string"}},"title":"ColumnOutput"},"ValidValue":{"type":"object","properties":{"type":{"type":"string","enum":["GENERAL","DATE"]},"value":{"type":"object","properties":{"display":{"type":"string"},"value":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"timezone":{"type":"string"}}}},"title":"ValidValue"},"Calculation":{"type":"object","required":["variable","name"],"properties":{"variable":{"type":"string"},"name":{"type":"string"}},"title":"Calculation"},"Row":{"type":"object","properties":{"cells":{"type":"array","items":{"$ref":"#/components/schemas/Cell"}},"active":{"type":"boolean"}},"title":"Row","required":["cells","active"]},"Cell":{"type":"object","properties":{"column":{"type":"string","description":"Id of the column this cell belongs to. Must match a columnId from decisionTable.columns."},"type":{"type":"string","description":"Must match the referenced column type. If input, scalarCondition is required. If output or calc, outputScalarValue is required.","enum":["input","output","calc"]},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"}},"title":"Cell","description":"Decision-table cell. Input cells require scalarCondition. Output and calc cells require outputScalarValue. For Fn output/calc cells, keep both value and stringValue so solving and editor rendering both work.","required":["column","type"]},"ScalarCondition":{"type":"object","properties":{"operator":{"type":"string"},"type":{"type":"string","enum":["general","date","function"]},"value":{"description":"Condition value. Range and list operators such as between, IN, and NOT IN use an array of strings; scalar operators use a scalar value. Function conditions use a function tree value when it is not generated from stringValue."},"stringValue":{"type":"string","description":"String representation used for function conditions. Required for function conditions so the editor can display the Fn expression."}},"title":"ScalarCondition","description":"Value definition for an input cell. General/date conditions use operator, type, and value. Function conditions use type \"function\", operator \"function\", stringValue, and a function-tree value when it is not generated by validation."},"OutputScalarValue":{"type":"object","properties":{"value":{"description":"Output value. Common outputs use the scalar/object/array value to return. Function outputs use the function tree consumed by the solver."},"type":{"type":"string","description":"Use \"common\" for ordinary output values and \"function\" for Fn output or calc expressions.","enum":["common","function"]},"stringValue":{"type":"string","description":"String representation used for function outputs and calc cells. Include it for Fn cells so older editors can display the expression."}},"title":"OutputScalarValue","description":"Value definition for output and calc cells. For editor compatibility, include type. Use type \"common\" with value for normal scalar outputs. Use type \"function\" with stringValue and the function-tree value for Fn output or calc cells; stringValue is used by older editors and value is used by the solver."},"UserVariable":{"type":"object","properties":{"name":{"type":"string"},"value":{},"saved":{"type":"boolean"},"editMode":{"type":"boolean"}},"title":"UserVariable"},"TreeNode":{"type":"object","required":["id","type","nodes"],"properties":{"id":{"type":"string"},"type":{"type":"string","description":"Type of the node.","enum":["if","then","result","else","logic_group","logic_or","condition","root"]},"operandText":{"type":"string","description":"Node text."},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"outputScalarValue":{"$ref":"#/components/schemas/OutputScalarValue"},"modelVariablePath":{"type":"string"},"scalarCondition":{"$ref":"#/components/schemas/ScalarCondition"}},"title":"TreeNode"},"LookupTableColumn":{"type":"object","required":["name","order","alias"],"properties":{"name":{"type":"string"},"order":{"type":"number"},"alias":{"type":"string","description":"Stable column alias used in lookup-table data rows."},"isPrimaryKey":{"type":"boolean"}},"title":"LookupTableColumn"},"LookupTableMetadata":{"type":"object","properties":{"rowCount":{"type":"number"},"sizeBytes":{"type":"number"}},"title":"LookupTableMetadata"}}},"paths":{"/rule/{identifier}/new-version":{"post":{"tags":["Rule"],"summary":"Create new rule version","description":"Creates a new version of the rule identified by :ruleId and based on the body of the request. The body must be formatted according to the example below. \n The new version is added to the same folder as the latest version.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"Unique rule ID or alias which is common to all rule versions."},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","description","inputSchema","outputSchema","type","status"],"properties":{"name":{"type":"string","description":"Name of the rule"},"description":{"type":"string","description":"Description of the rule"},"inputSchema":{"type":"object","description":"Schema for input attributes","additionalProperties":{}},"outputSchema":{"type":"object","description":"Schema for output attributes","additionalProperties":{}},"decisionTable":{"$ref":"#/components/schemas/DecisionTable","description":"Decision-table structure required when type is decision-table."},"script":{"type":"string"},"userVariables":{"type":"array","items":{"$ref":"#/components/schemas/UserVariable"}},"nodes":{"type":"array","items":{"$ref":"#/components/schemas/TreeNode"}},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree","workflow","integration-flow","lookup-table","ai-rule"],"description":"Type of rule"},"status":{"type":"string","enum":["published","pending"],"description":"Current state of the rule"},"ruleId":{"type":"string","description":"Unique identifier of the rule"},"auditLog":{"type":"object","description":"Audit log settings","properties":{"active":{"type":"boolean"},"debug":{"type":"object","properties":{"active":{"type":"boolean"}}},"ttl":{"type":"integer","description":"Time-to-live in days"}}},"version":{"type":"number","description":"Version number of the rule"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional list of tags"},"baseId":{"type":"string"},"ruleAlias":{"type":"string"},"locked":{"type":"boolean"},"previousBaseId":{"type":"string","description":"Previous base ID used during imports, especially rule-flow imports."},"workflowData":{"type":"object","description":"Workflow or integration-flow data model."},"visualData":{"type":"object","description":"Visual editor data for workflow or integration-flow rules."},"columns":{"type":"array","description":"Lookup-table columns when type is lookup-table.","items":{"$ref":"#/components/schemas/LookupTableColumn"}},"primaryKeyColumn":{"type":"string","description":"Lookup-table primary key column alias when type is lookup-table."},"data":{"description":"Lookup-table row data when type is lookup-table, or AI rule configuration when type is ai-rule."},"metadata":{"$ref":"#/components/schemas/LookupTableMetadata"}},"description":"DecisionRules rule payload. For type \"decision-table\", include decisionTable.columns and decisionTable.rows. Each row must have one cell per column and each cell.column must match a column.columnId. For editor compatibility, output/calc cells should include outputScalarValue.type so common values and Fn values render consistently."}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
This endpoint does not create a new rule. If no existing version of the rule is found, an error will be returned. Use the [Create rule](https://docs.decisionrules.io/doc/api/management-api#create-rule) endpoint instead.
{% endhint %}

{% hint style="info" %}
The rule’s name, alias, and ID will remain unchanged, regardless of the values provided in the request body.
{% endhint %}

## Lock / Unlock rule.

> Sets a lock on a rule version to prevent edits.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Rule"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/rule/lock/{identifier}/{version}":{"patch":{"tags":["Rule"],"summary":"Lock / Unlock rule.","description":"Sets a lock on a rule version to prevent edits.","requestBody":{"required":true,"description":"Object that defines if rule should be locked.","content":{"application/json":{"schema":{"type":"object","required":["locked"],"properties":{"locked":{"type":"boolean","description":"Indicates if the rule should be locked."}}}}}},"parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":true,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can target the rule using [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths) instead of the :ruleId and :version parameters.
{% endhint %}

## Spaces

## Gets all types of rules in space

> The desired space is determined by Management API Key. This endpoint also gets set of rules used in every ruleflow.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Space"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/space/items":{"get":{"tags":["Space"],"parameters":[{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"summary":"Gets all types of rules in space","description":"The desired space is determined by Management API Key. This endpoint also gets set of rules used in every ruleflow.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Tags

## Get rules by tags

> This endpoint allows you to get all ruless with certain tags. Desired space is derived from Management API Key.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Tag"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/tags/items":{"get":{"tags":["Tag"],"summary":"Get rules by tags","description":"This endpoint allows you to get all ruless with certain tags. Desired space is derived from Management API Key.","parameters":[{"schema":{"":""},"in":"query","name":"NewParameter","description":"New parameter","required":"true"},{"schema":{"type":"string"},"name":"tags","in":"query","required":true,"description":"Comma separated list of tags. The query at the end of the url address should look like this: ?tags=tag1,tag2. Such query would select all the rules where tag array contains both tag1 and tag"},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Add tags to a specific item version

> If you specify the version, the tag/tags will be added to the specified version. If the version is not specified, the tag/tags will be added to all the versions with given ID.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Tag"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/tags/{identifier}/{version}":{"patch":{"tags":["Tag"],"summary":"Add tags to a specific item version","description":"If you specify the version, the tag/tags will be added to the specified version. If the version is not specified, the tag/tags will be added to all the versions with given ID.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"tagName":{"type":"string"},"color":{"type":"string"}},"required":["tagName","color"]}}}},"description":"Array of tags to add in JSON format"},"parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":false,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Remove tags from Rule

> If you specify the version, the tag/tags will be deleted from the specified version. If the version is not specified, the tag/tags will be deleted from all the versions with given ID.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Tag"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/tags/{identifier}/{version}":{"delete":{"tags":["Tag"],"summary":"Remove tags from Rule","description":"If you specify the version, the tag/tags will be deleted from the specified version. If the version is not specified, the tag/tags will be deleted from all the versions with given ID.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true,"description":"The ID or alias of the rule."},{"schema":{"type":"string"},"name":"version","in":"path","required":true,"description":"The version of the rule."},{"schema":{"type":"string"},"name":"Tags","in":"query","required":true,"description":"Comma separated list of tags. The query at the end of the url address should look like this: ?tags=tag1,tag2"},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Folders

## Get folder structure of a node

> Retrieve folder structure either by node ID or by navigating through path. Returns a JSON with a tree like structure containing the descendant folders and rules of the target node.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/{nodeId}":{"get":{"tags":["Folder"],"summary":"Get folder structure of a node","description":"Retrieve folder structure either by node ID or by navigating through path. Returns a JSON with a tree like structure containing the descendant folders and rules of the target node.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true},{"schema":{"type":"string"},"name":"path","in":"query"},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Create folders

> Creates folders under a specified target, moves rules into the new structure by baseId or ruleAlias. Define which folder's structure to update by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Appends the Folder Structure specified in the request body as a child of the target node.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"Child":{"type":"object","properties":{"type":{"type":"string","enum":["FOLDER","RULE","ROOT"]},"name":{"type":"string"},"id":{"type":"string"},"baseId":{"type":"string"},"ruleAlias":{"type":"string"},"version":{"type":"number"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Child"}}},"title":"Child"}}},"paths":{"/folder/{nodeId}":{"post":{"tags":["Folder"],"summary":"Create folders","description":"Creates folders under a specified target, moves rules into the new structure by baseId or ruleAlias. Define which folder's structure to update by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Appends the Folder Structure specified in the request body as a child of the target node.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true},{"schema":{"type":"string"},"name":"path","in":"query"}],"requestBody":{"description":"Example JSON body","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["ROOTFOLDERRULE"]},"name":{"type":"string"},"id":{"type":"string"},"baseId":{"type":"string"},"version":{"type":"number"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Child"}}}}}}},"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
If the request body contains rules **(defined by baseId or ruleAlias)**, the are moved to fit with the request. In the request example below, if the space contains a rule with id "xxx-yyy-zzz", it will be moved into the newly created "Example Sub-Folder" Folder.

When moving Rules - If a version is not defined all of the rule versions will be moved.
{% endhint %}

## Create or overwrite folder structure of a node

> Define which folder's structure to overwrite by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Moves rules into the new structure by baseId or ruleAlias. Overwrites the Folder Structure specified in the request body as a child of the target node.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"Child":{"type":"object","properties":{"type":{"type":"string","enum":["FOLDER","RULE","ROOT"]},"name":{"type":"string"},"id":{"type":"string"},"baseId":{"type":"string"},"ruleAlias":{"type":"string"},"version":{"type":"number"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Child"}}},"title":"Child"}}},"paths":{"/folder/{nodeId}":{"put":{"tags":["Folder"],"summary":"Create or overwrite folder structure of a node","description":"Define which folder's structure to overwrite by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Moves rules into the new structure by baseId or ruleAlias. Overwrites the Folder Structure specified in the request body as a child of the target node.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true},{"schema":{"type":"string"},"name":"path","in":"query","required":true,"description":"Path of folder names"}],"requestBody":{"description":"Example JSON body","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["ROOTFOLDERRULE"]},"name":{"type":"string"},"id":{"type":"string"},"baseId":{"type":"string"},"version":{"type":"number"},"children":{"type":"array","items":{"$ref":"#/components/schemas/Child"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="warning" %}
Any existing Folder children of the target node will be deleted. (Rules, which aren't part of the request body will be moved to the root)
{% endhint %}

{% hint style="info" %}
If the request body contains rules **(defined by baseId or ruleAlias)**, the are moved to fit with the request. In the request example below, if the space contains a rule with id "xxx-yyy-zzz", it will be moved into the newly created "Example Sub-Folder" Folder.

When moving Rules - If a version is not defined all of the rule versions will be moved.
{% endhint %}

## Delete a folder and all of its descendants (Including it's rules!)

> Delete a folder (Including it's rules) either by node ID or by navigating through path. If you want to delete the contents of the entire space target the 'root' by Id and include the optional query parameter ?deleteAll=true

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/{nodeId}":{"delete":{"tags":["Folder"],"summary":"Delete a folder and all of its descendants (Including it's rules!)","description":"Delete a folder (Including it's rules) either by node ID or by navigating through path. If you want to delete the contents of the entire space target the 'root' by Id and include the optional query parameter ?deleteAll=true","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true},{"schema":{"type":"string"},"name":"path","in":"query","description":"Path of folder names"},{"schema":{"type":"boolean"},"name":"deleteAll","in":"query","description":"Confirmation to delete everything in Space"}],"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="danger" %}
Data removal is permanent and cannot be undone.
{% endhint %}

## Export folder with all rules

> Export folder with all rules. If no nodeId is set, then will be exported root directory.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/export/{nodeId}":{"get":{"tags":["Folder"],"summary":"Export folder with all rules","description":"Export folder with all rules. If no nodeId is set, then will be exported root directory.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":false,"description":"If you know your folder id, you can export it. Otherwise you export root directory"},{"schema":{"type":"string"},"name":"path","in":"query","required":false,"description":"If you know your folder id, you can export it. Otherwise you export root directory"},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Import folder and all rules

> Import folder with all rules into specific folder. If no targetNodeId is set, then will be imported into root directory.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/import/{nodeId}":{"post":{"tags":["Folder"],"summary":"Import folder and all rules","description":"Import folder with all rules into specific folder. If no targetNodeId is set, then will be imported into root directory.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true,"description":"If you know you targetNodeId, you can import it. Otherwise you import folder into root directory."},{"schema":{"type":"string"},"name":"path","in":"query","description":"The unique folder path leading to the rule. Use this OR the 'identifier' parameter.","required":false},{"schema":{"type":"integer"},"name":"version","in":"query","description":"Optional. The specific version of the business rule.","required":false},{"schema":{"type":"string"},"name":"Authorization","in":"header","description":"Bearer","required":true},{"schema":{"type":"string"},"name":"Content-Type","in":"header","description":"application/json","required":false}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"export":{"type":"object","properties":{"exportType":{"type":"string","enum":["FOLDER","RULE","ROOT"],"description":"Type of the export"},"version":{"type":"number","description":"Version number of the export"},"data":{"type":"object","properties":{"structure":{"type":"object","properties":{"type":{"type":"string","enum":["FOLDER","RULE","ROOT"],"description":"Type of object"},"name":{"type":"string","description":"Name of the rule or folder"},"id":{"type":"string","description":"Identifier of the rule"},"baseId":{"type":"string","description":"Base identifier"},"ruleAlias":{"type":"string","description":"Optional alias for the rule"},"version":{"type":"number","description":"Version number of the object"},"children":{"type":"array","items":{"type":"object"},"description":"Children rules or folders"}}},"rules":{"type":"array","items":{"type":"object"},"description":"List of rules"}}}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

{% hint style="info" %}
You can target the rule using [Folder Path](https://docs.decisionrules.io/doc/api/management-api#folder-paths) instead of the :ruleId and :version parameters.
{% endhint %}

## Move Folders from their current position under a new parent

> Moves folders (including descendants) and/or rules under the parent specified by targetId or targetPath attribute in the request body.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/move":{"put":{"tags":["Folder"],"summary":"Move Folders from their current position under a new parent","description":"Moves folders (including descendants) and/or rules under the parent specified by targetId or targetPath attribute in the request body.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"targetId":{"type":"string","description":"Optional target ID"},"targetPath":{"type":"string","description":"Optional target path"},"nodes":{"type":"array","description":"List of nodes","items":{"type":"object","properties":{"type":{"type":"string","enum":["FOLDER","RULE"],"description":"Type of node"},"id":{"type":"string","description":"Optional node ID"},"baseId":{"type":"string","description":"Optional base ID"},"ruleAlias":{"type":"string","description":"Optional rule alias"}},"required":["type"]}}}}}}},"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Rename a folder

> Define which folder to rename by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Set a new name for a Folder in the request body with the 'name' attribute.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/rename/{nodeId}":{"patch":{"tags":["Folder"],"summary":"Rename a folder","description":"Define which folder to rename by either inputting it's id as a parameter or by navigating to it using the ?path=/ query parameter. Set a new name for a Folder in the request body with the 'name' attribute.","parameters":[{"schema":{"type":"string"},"name":"nodeId","in":"path","required":true},{"schema":{"type":"string"},"name":"path","in":"query","required":false,"description":"Path of folder names"}],"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}},"required":true,"type":"string","description":"New name of folder"}}}}}
```

## Find a folder or rule by attribute

> Finds Folders and Rules which satisfy all of the criteria from the request body. Use any of the attributes listed below or their combination to find folders and rules.\
> \
> Searchable attributes:\
> \- name - Name of the Folder or Rule\
> &#x20; \* Note: this attribute searches for a RegExp match by default. If you wish to find nodes which match the input exactly, prepend the input with '^' and append with '$'. Example: '^ClientA$'\
> \- id - ID of the Folder\
> \- ruleAlias - Rule-Alias\
> &#x20; \* Note: this attribute searches for a RegExp match by default. To match exactly: '^ClientA$'\
> \- baseId - RuleId of the Rule or Rule Flow\
> &#x20; \* 'decision-table' - Decision Table\
> &#x20; \* 'decision-tree' - Decision Tree\
> &#x20; \* 'complex-rule' - Scripting Rule\
> &#x20; \* 'composition' - Rule Flow\
> \- tags - Tags on a Rule\
> \- type - Type of Node in Folder Structure\
> &#x20; \* FOLDER\
> &#x20; \* RULE\
> &#x20; \* ROOT\
> \- version - Version of the rule\
> \- ruleStatus\
> &#x20; \* published\
> &#x20; \* pending

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Folder"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/folder/find":{"post":{"tags":["Folder"],"summary":"Find a folder or rule by attribute","description":"Finds Folders and Rules which satisfy all of the criteria from the request body. Use any of the attributes listed below or their combination to find folders and rules.\n\nSearchable attributes:\n- name - Name of the Folder or Rule\n  * Note: this attribute searches for a RegExp match by default. If you wish to find nodes which match the input exactly, prepend the input with '^' and append with '$'. Example: '^ClientA$'\n- id - ID of the Folder\n- ruleAlias - Rule-Alias\n  * Note: this attribute searches for a RegExp match by default. To match exactly: '^ClientA$'\n- baseId - RuleId of the Rule or Rule Flow\n  * 'decision-table' - Decision Table\n  * 'decision-tree' - Decision Tree\n  * 'complex-rule' - Scripting Rule\n  * 'composition' - Rule Flow\n- tags - Tags on a Rule\n- type - Type of Node in Folder Structure\n  * FOLDER\n  * RULE\n  * ROOT\n- version - Version of the rule\n- ruleStatus\n  * published\n  * pending","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Optional name of the rule"},"id":{"type":"string","description":"Optional identifier"},"baseId":{"type":"string","description":"Optional base identifier"},"ruleAlias":{"type":"string","description":"Optional alias for the rule"},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree"],"description":"Type of rule"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional list of tags"},"status":{"type":"string","enum":["published","pending"],"description":"Current state of the rule"},"version":{"type":"number","description":"Version number of the rule"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Tools

## Find duplicates in a decision table

> Look for decision table by id and optionally version. If the decision table is found, it is returned together with an array of duplicates.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Tools"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/tools/duplicates/{identifier}/{version}?":{"get":{"tags":["Tools"],"summary":"Find duplicates in a decision table","description":"Look for decision table by id and optionally version. If the decision table is found, it is returned together with an array of duplicates.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true},{"schema":{"type":"string"},"name":"version","in":"path","required":false}],"responses":{"200":{"description":"OK","type":"object","content":{"application/json":{"schema":{}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Find all dependencies of a rule

> Look for dependencies by id or alias and optionally version. If the rule is found, it is returned together with an array of dependencies.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Tools"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/tools/dependencies/{identifier}/{version}?":{"get":{"tags":["Tools"],"summary":"Find all dependencies of a rule","description":"Look for dependencies by id or alias and optionally version. If the rule is found, it is returned together with an array of dependencies.","parameters":[{"schema":{"type":"string"},"name":"identifier","in":"path","required":true},{"schema":{"type":"string"},"name":"version","in":"path","required":false}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"content":{"application/json":{"schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Test

## Create Test

> Creates and saves one test in an existing test suite. The suite determines the rule alias and version. This operation does not execute the test. To retrieve saved tests, use the test-suite GET endpoints.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"CreateTest":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"}},"additionalProperties":false}}},"paths":{"/test/{testSuiteId}":{"post":{"tags":["Test"],"summary":"Create Test","description":"Creates and saves one test in an existing test suite. The suite determines the rule alias and version. This operation does not execute the test. To retrieve saved tests, use the test-suite GET endpoints.","operationId":"create_test","parameters":[{"name":"testSuiteId","in":"path","required":true,"description":"The ID of the Test Suite","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Test"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Test case to create. name, strategy, input, expectedOutput and ignoredOutputs are required. Use an empty array for ignoredOutputs when no output properties should be ignored.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTest"}}}}}}}}
```

## Update Test

> Replaces an existing test in the specified test suite. Supply its id and complete test data, including name, strategy, input, expectedOutput and ignoredOutputs. The saved last-run state is cleared. This operation does not execute the test.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"UpdateTest":{"type":"object","required":["id","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"},"id":{"type":"string"},"sortedInputHash":{"type":["string","null"]},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"additionalProperties":false}}},"paths":{"/test/{testSuiteId}":{"put":{"tags":["Test"],"summary":"Update Test","description":"Replaces an existing test in the specified test suite. Supply its id and complete test data, including name, strategy, input, expectedOutput and ignoredOutputs. The saved last-run state is cleared. This operation does not execute the test.","operationId":"update_test","parameters":[{"name":"testSuiteId","in":"path","required":true,"description":"The ID of the Test Suite","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Test"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Complete replacement test. id, name, strategy, input, expectedOutput and ignoredOutputs are required.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTest"}}}}}}}}
```

## Move Tests

> Moves the selected tests into a newly created test suite bound to the target ruleAlias and ruleVersion. The name property specifies the new suite name. The request does not select an existing destination suite.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"MoveTestsRequest":{"type":"object","required":["ids","ruleAlias","ruleVersion","name"],"properties":{"ids":{"type":"array","items":{"type":"string"},"description":"Array of test IDs to move."},"ruleAlias":{"type":"string","description":"Target rule alias."},"ruleVersion":{"type":"number","description":"Target rule version."},"name":{"type":"string","description":"Name for the newly created destination test suite."}}}}},"paths":{"/test/move":{"put":{"tags":["Test"],"summary":"Move Tests","description":"Moves the selected tests into a newly created test suite bound to the target ruleAlias and ruleVersion. The name property specifies the new suite name. The request does not select an existing destination suite.","operationId":"move_tests","parameters":[],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Move request for tests. Include ids of tests to move, target ruleAlias, target ruleVersion, and name for the newly created destination test suite.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveTestsRequest"}}}}}}}}
```

## Delete Tests

> Deletes the tests identified by the comma-separated ids query parameter. Their test suites remain in place. Returns HTTP 200 with an empty response body.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/test":{"delete":{"tags":["Test"],"summary":"Delete Tests","description":"Deletes the tests identified by the comma-separated ids query parameter. Their test suites remain in place. Returns HTTP 200 with an empty response body.","operationId":"delete_tests","parameters":[{"name":"ids","in":"query","required":true,"description":"Comma-separated list of test IDs to delete","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Test Suite

## List Test Suites For Rule

> Gets all test suites, including their tests, for one exact rule alias and version in the space associated with the Management API key. The alias must be the rule alias, not the rule ID or display name.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestSuite":{"type":"object","required":["id","spaceId","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/Test"}}}},"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}},"paths":{"/testSuite/rule/{alias}/{version}":{"get":{"tags":["Test Suite"],"summary":"List Test Suites For Rule","description":"Gets all test suites, including their tests, for one exact rule alias and version in the space associated with the Management API key. The alias must be the rule alias, not the rule ID or display name.","operationId":"list_test_suites_for_rule","parameters":[{"name":"alias","in":"path","required":true,"description":"The alias of the rule","schema":{"type":"string"}},{"name":"version","in":"path","required":true,"description":"The version of the rule","schema":{"type":"number"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestSuite"}}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## List Test Suites

> Gets test suites in the space associated with the Management API key. Returns an array grouped by rule, with suites and their saved tests. Use the optional JSON-encoded filter to select a rule alias, rule version or suite ID.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"RuleTestSuite":{"type":"object","properties":{"baseId":{"type":"string"},"baseType":{"type":"string","description":"Platform-dependent type of the associated rule. Known values include decision-table, complex-rule, composition, decision-tree, workflow, integration-flow, lookup-table, and ai-rule."},"status":{"type":"string","enum":["published","pending"]},"ruleName":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"suites":{"type":"array","items":{"$ref":"#/components/schemas/TestSuite"}}},"required":["suites"]},"TestSuite":{"type":"object","required":["id","spaceId","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/Test"}}}},"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}}}},"paths":{"/testSuite":{"get":{"tags":["Test Suite"],"summary":"List Test Suites","description":"Gets test suites in the space associated with the Management API key. Returns an array grouped by rule, with suites and their saved tests. Use the optional JSON-encoded filter to select a rule alias, rule version or suite ID.","operationId":"list_test_suites","parameters":[{"name":"filter","in":"query","required":false,"description":"Optional JSON string representation of a TestSuiteFilter object. \n\nAllowed properties:\n* `ruleAlias` (string): The alias of the rule.\n* `ruleVersion` (number): The version of the rule.\n* `id` (string): The specific test suite ID.\n\nExample: `{\"ruleAlias\": \"my-rule\", \"ruleVersion\": 1}`.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RuleTestSuite"}}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Create or import test suites

> Creates one or more test suites for the supplied rule aliases and versions. Send an array, even when creating only one suite. Expected outputs must be supplied; this operation saves the suites without executing the rules. New suite IDs are generated. Test IDs supplied during import are retained; otherwise new test IDs are generated. The Management API key determines the space.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestSuite":{"type":"object","required":["id","spaceId","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/Test"}}}},"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"CreateTestSuitesRequest":{"type":"array","items":{"$ref":"#/components/schemas/CreateTestSuite"}},"CreateTestSuite":{"type":"object","required":["ruleAlias","ruleVersion","name","tests"],"properties":{"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"tests":{"type":"array","items":{"$ref":"#/components/schemas/ImportedTest"}},"spaceId":{"type":"string","description":"Optional. The server uses the space associated with the Management API key."}},"additionalProperties":false},"ImportedTest":{"description":"A new test without saved metadata, or an existing/imported test with an id and optional saved metadata. Both variants require strategy and ignoredOutputs.","oneOf":[{"$ref":"#/components/schemas/CreateTest"},{"$ref":"#/components/schemas/UpdateTest"}]},"CreateTest":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"}},"additionalProperties":false},"UpdateTest":{"type":"object","required":["id","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"},"id":{"type":"string"},"sortedInputHash":{"type":["string","null"]},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"additionalProperties":false}}},"paths":{"/testSuite":{"post":{"tags":["Test Suite"],"summary":"Create or import test suites","description":"Creates one or more test suites for the supplied rule aliases and versions. Send an array, even when creating only one suite. Expected outputs must be supplied; this operation saves the suites without executing the rules. New suite IDs are generated. Test IDs supplied during import are retained; otherwise new test IDs are generated. The Management API key determines the space.","operationId":"import_test_suites","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestSuite"}}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Array of test suites. Each suite contains ruleAlias, ruleVersion, name and tests. Every test requires name, strategy, input, expectedOutput and ignoredOutputs. Imported tests with an id may also include saved timestamp and hash fields.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTestSuitesRequest"}}}}}}}}
```

## Update Test Suite

> Replaces one existing test suite. Supply its id, name, ruleAlias, ruleVersion and the complete tests array. Tests omitted from the array are removed. Include a test id to retain its identity; tests without an id receive a new one. The saved last-run state is cleared. This operation does not execute tests.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestSuite":{"type":"object","required":["id","spaceId","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/Test"}}}},"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"UpdateTestSuite":{"type":"object","required":["id","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time","description":"Optional creation timestamp."},"tests":{"type":"array","items":{"$ref":"#/components/schemas/ImportedTest"},"description":"Complete test list. Include id to retain an existing test identity; new tests omit id and saved timestamp/hash fields. Every test requires name, strategy, input, expectedOutput and ignoredOutputs."}},"additionalProperties":false},"ImportedTest":{"description":"A new test without saved metadata, or an existing/imported test with an id and optional saved metadata. Both variants require strategy and ignoredOutputs.","oneOf":[{"$ref":"#/components/schemas/CreateTest"},{"$ref":"#/components/schemas/UpdateTest"}]},"CreateTest":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"}},"additionalProperties":false},"UpdateTest":{"type":"object","required":["id","name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"description":"Required solver strategy."},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Expected JSON output from the rule, including objects or arrays."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"description":"Required array of output property paths to ignore during comparison. Use [] to compare all output properties."},"ignoreArrayOrder":{"type":"boolean"},"id":{"type":"string"},"sortedInputHash":{"type":["string","null"]},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"additionalProperties":false}}},"paths":{"/testSuite":{"put":{"tags":["Test Suite"],"summary":"Update Test Suite","description":"Replaces one existing test suite. Supply its id, name, ruleAlias, ruleVersion and the complete tests array. Tests omitted from the array are removed. Include a test id to retain its identity; tests without an id receive a new one. The saved last-run state is cleared. This operation does not execute tests.","operationId":"update_test_suite","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestSuite"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Complete replacement suite: id, name, ruleAlias, ruleVersion and tests are required. Tests omitted from the complete array are removed. Every test requires name, strategy, input, expectedOutput and ignoredOutputs.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTestSuite"}}}}}}}}
```

## Delete Test Suites

> Deletes the test suites identified by the comma-separated ids query parameter, including all tests contained in those suites. Returns HTTP 200 with an empty response body.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/testSuite":{"delete":{"tags":["Test Suite"],"summary":"Delete Test Suites","description":"Deletes the test suites identified by the comma-separated ids query parameter, including all tests contained in those suites. Returns HTTP 200 with an empty response body.","operationId":"delete_test_suites","parameters":[{"name":"ids","in":"query","required":true,"description":"Comma-separated list of test suite IDs to delete","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

## Move Test Suites

> Moves complete existing test suites, including their tests, to the supplied ruleAlias and ruleVersion. The ids array contains test suite IDs. Returns HTTP 200 with an empty response body.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"MoveTestSuitesRequest":{"type":"object","required":["ids","ruleAlias","ruleVersion"],"properties":{"ids":{"type":"array","items":{"type":"string"},"description":"Array of test suite IDs to move."},"ruleAlias":{"type":"string","description":"Target rule alias."},"ruleVersion":{"type":"number","description":"Target rule version."}}}}},"paths":{"/testSuite/move":{"put":{"tags":["Test Suite"],"summary":"Move Test Suites","description":"Moves complete existing test suites, including their tests, to the supplied ruleAlias and ruleVersion. The ids array contains test suite IDs. Returns HTTP 200 with an empty response body.","operationId":"move_test_suites","parameters":[],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}}},"requestBody":{"description":"Move request for test suites. Include ids of suites to move, target ruleAlias, and target ruleVersion.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveTestSuitesRequest"}}}}}}}}
```

## Solve And Import Test Suites

> Executes each exact saved rule version to calculate expected outputs, then saves the supplied test suites. Each suite must include ruleAlias, ruleBaseId, ruleVersion, name and at least one test with a name and input. Any supplied expectedOutput is replaced by the solver result. Authenticate this request with a Management API key. The server internally selects a Solver API key from the authenticated space to calculate expected outputs; a Solver API key cannot be used to authenticate this endpoint. Rule execution can call external services and cause their configured side effects.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Suite"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestSuite":{"type":"object","required":["id","spaceId","ruleAlias","ruleVersion","name","tests"],"properties":{"id":{"type":"string"},"userId":{"type":"string"},"spaceId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"createdAt":{"type":["string","null"],"format":"date-time"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/Test"}}}},"Test":{"type":"object","required":["name","strategy","input","expectedOutput","ignoredOutputs"],"properties":{"id":{"type":"string","description":"Unique test ID generated by the server, or retained from an imported test."},"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}}},"GeneratedCreateTestSuitesRequest":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/GeneratedCreateTestSuite"}},"GeneratedCreateTestSuite":{"type":"object","required":["ruleAlias","ruleBaseId","ruleVersion","name","tests"],"properties":{"ruleAlias":{"type":"string"},"ruleBaseId":{"type":"string","description":"Base ID of the saved rule to execute when calculating expected outputs."},"ruleVersion":{"type":"number"},"name":{"type":"string","maxLength":80},"tests":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/GeneratedCreateTest"}},"spaceId":{"type":"string","description":"Optional. The server uses the space associated with the Management API key."}},"additionalProperties":false},"GeneratedCreateTest":{"type":"object","required":["name","input"],"properties":{"name":{"type":"string","maxLength":80},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"],"default":"STANDARD"},"input":{"description":"Input JSON data for the rule."},"expectedOutput":{"description":"Ignored during generated-suite import; the solver resolves the expected output."},"ignoredOutputs":{"type":"array","items":{"type":"string"},"default":[]},"ignoreArrayOrder":{"type":"boolean","default":false}},"additionalProperties":false}}},"paths":{"/testSuite/import-generated":{"post":{"tags":["Test Suite"],"summary":"Solve And Import Test Suites","description":"Executes each exact saved rule version to calculate expected outputs, then saves the supplied test suites. Each suite must include ruleAlias, ruleBaseId, ruleVersion, name and at least one test with a name and input. Any supplied expectedOutput is replaced by the solver result. Authenticate this request with a Management API key. The server internally selects a Solver API key from the authenticated space to calculate expected outputs; a Solver API key cannot be used to authenticate this endpoint. Rule execution can call external services and cause their configured side effects.","operationId":"solve_and_import_test_suites","parameters":[],"responses":{"200":{"description":"Test suites imported with solver-resolved expected outputs.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestSuite"}}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"}},"requestBody":{"description":"Array of test suites whose expected outputs will be calculated by executing the identified saved rules.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneratedCreateTestSuitesRequest"}}}}}}}}
```

## Test Run

## List Test Runs

> Lists saved Test Run jobs in the space associated with the Management API key, newest first. The response contains totalCount and a paginated jobs array. Only Test Runs are returned. Use each jobId as testRunId when requesting execution detail.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Run"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestRunListResponse":{"type":"object","required":["totalCount","jobs"],"properties":{"totalCount":{"type":"number","description":"Total number of Test Runs matching the filter."},"jobs":{"type":"array","items":{"$ref":"#/components/schemas/TestRunJob"}}}},"TestRunJob":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"type":{"type":"string","enum":["TestRun"]},"status":{"$ref":"#/components/schemas/TestRunJobStatus"},"solverVersion":{"type":"string","enum":["v1","v2"]},"testSuiteIds":{"type":"array","items":{"type":"string"}},"testIds":{"type":"array","items":{"type":"string"}},"ruleReferences":{"type":"array","items":{"$ref":"#/components/schemas/TestRunRuleReference"}},"output":{"$ref":"#/components/schemas/TestRunJobOutput"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"context":{"type":"object","description":"Execution context stored with the Test Run job.","additionalProperties":true},"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}},"TestRunJobStatus":{"type":"object","properties":{"state":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"code":{"type":"string"},"message":{"type":"string"}}},"TestRunRuleReference":{"type":"object","properties":{"baseId":{"type":"string"},"version":{"type":"number"},"type":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["published","pending"]},"alias":{"type":"string"}}},"TestRunJobOutput":{"type":"object","properties":{"totalTestCount":{"type":"number"},"passed":{"type":"number"},"failed":{"type":"number"},"error":{"type":"number"}}}}},"paths":{"/testRun":{"get":{"tags":["Test Run"],"summary":"List Test Runs","description":"Lists saved Test Run jobs in the space associated with the Management API key, newest first. The response contains totalCount and a paginated jobs array. Only Test Runs are returned. Use each jobId as testRunId when requesting execution detail.","operationId":"list_test_runs","parameters":[{"name":"filter","in":"query","required":false,"description":"Optional JSON-encoded filter. Top-level page defaults to 1 and page_size defaults to 25. Supported filters: state (array of job states; PASSED and FAILED also filter completed runs by their results), ruleIds (array of rule base IDs), identifier (ruleId or ruleAlias, together with version), ruleSearchTerm (rule-name search) and startedById (executor user ID). The endpoint always selects Test Run jobs. If identifier contains both ruleId and ruleAlias, either can match.","schema":{"type":"string"}}],"responses":{"200":{"description":"Test Runs listed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestRunListResponse"}}}},"400":{"description":"Invalid filter"},"401":{"description":"Authentication token missing or invalid"}}}}}}
```

## Get Test Run Detail

> Gets historical execution results for one Test Run in the space associated with the Management API key. The response is an array grouped by the rule snapshot used during execution; each item contains testSuiteRuns and their individual test results, including input, expectedOutput, result and resultStatus. Metadata is taken from saved execution snapshots.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[{"name":"Test Run"}],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}},"schemas":{"TestRunRule":{"type":"object","properties":{"baseId":{"type":"string"},"baseType":{"type":"string"},"status":{"type":"string","enum":["published","pending"]},"ruleName":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"testSuiteRuns":{"type":"array","items":{"$ref":"#/components/schemas/TestSuiteRun"}}}},"TestSuiteRun":{"type":"object","properties":{"id":{"type":"string"},"testSuiteId":{"type":"string"},"spaceId":{"type":"string"},"ruleBaseId":{"type":"string"},"ruleAlias":{"type":"string"},"ruleVersion":{"type":"number"},"name":{"type":"string"},"status":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELED","ERROR"]},"tests":{"type":"array","items":{"$ref":"#/components/schemas/TestExecution"}},"jobId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"userId":{"type":"string","description":"User associated with the saved test suite."}}},"TestExecution":{"type":"object","properties":{"id":{"type":"string"},"testId":{"type":"string"},"name":{"type":"string"},"strategy":{"type":"string","enum":["STANDARD","ARRAY","FIRST_MATCH","EVALUATE_ALL"]},"input":{"description":"Input data for the rule"},"expectedOutput":{"description":"Expected output from the rule. Can be an object or an array."},"ignoredOutputs":{"type":"array","items":{"type":"string"}},"ignoreArrayOrder":{"type":"boolean","description":"Ignore array element indexes recursively during output comparison"},"sortedInputHash":{"type":"string"},"lastRunAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"},"resultStatus":{"type":"string","enum":["PASSED","FAILED","ERROR","CANCELED"]},"result":{"description":"Actual solver result. Can be an object or an array."},"error":{"description":"Execution error details when the test could not be evaluated."}}}}},"paths":{"/testRun/{testRunId}":{"get":{"tags":["Test Run"],"summary":"Get Test Run Detail","description":"Gets historical execution results for one Test Run in the space associated with the Management API key. The response is an array grouped by the rule snapshot used during execution; each item contains testSuiteRuns and their individual test results, including input, expectedOutput, result and resultStatus. Metadata is taken from saved execution snapshots.","operationId":"get_test_run_detail","parameters":[{"name":"testRunId","in":"path","required":true,"description":"Test Run ID. Use jobId from GET /testRun in this Management API.","schema":{"type":"string"}}],"responses":{"200":{"description":"Test Run detail returned","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TestRunRule"}}}}},"400":{"description":"Test Run not found or does not belong to the authenticated space"},"401":{"description":"Authentication token missing or invalid"}}}}}}
```

## RuleFlow Export/Import

Following endpoints can be used only to export and import Rule Flows. For managing Workflows, please store your Workflows with dependent rules in folders, then use folder API endpoints.

## Export Rule Flow with all rules

> Export Rule Flow with all rules. If the version is not specified, exports the latest version.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/api/rule-flow/export/{ruleFlowId}/{version}":{"get":{"summary":"Export Rule Flow with all rules","description":"Export Rule Flow with all rules. If the version is not specified, exports the latest version.","parameters":[{"schema":{"type":"string"},"name":"ruleFlowId","in":"path","required":true,"description":"Unique rule flow ID or alias which is common to all versions."},{"schema":{"type":"number"},"name":"version","in":"path","required":false,"description":"Version of the Rule Flow."},{"schema":{"type":"string"},"name":"Authorization","in":"header","required":true,"description":"Bearer token"},{"schema":{"type":"string","enum":["application/json"]},"name":"Content-Type","in":"header","required":true,"description":"Content type"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request: Invalid API key or ruleFlowId","content":{"application/json":{}}},"426":{"description":"Upgrade Required: Operation not allowed"}}}}}}
```

## Import Rule Flow with all rules

> Importing a rule flow with rules included can overwrite previously created or imported rules having the same ruleId. If no query parameters are set, a new Rule Flow is created. If new-version and version are set, a new version of the targeted Rule Flow is created. If overwrite and version are set, a specific version of the target rule flow is overwritten.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/api/rule-flow/import":{"post":{"summary":"Import Rule Flow with all rules","description":"Importing a rule flow with rules included can overwrite previously created or imported rules having the same ruleId. If no query parameters are set, a new Rule Flow is created. If new-version and version are set, a new version of the targeted Rule Flow is created. If overwrite and version are set, a specific version of the target rule flow is overwritten.","parameters":[{"schema":{"type":"string"},"name":"new-version","in":"query","required":false,"description":"ID or alias of the target Rule Flow for creating a new version"},{"schema":{"type":"string"},"name":"overwrite","in":"query","required":false,"description":"ID or alias of the target Rule Flow for overwriting"},{"schema":{"type":"number"},"name":"version","in":"query","required":false,"description":"Version of target Rule Flow"},{"schema":{"type":"string"},"name":"Authorization","in":"header","required":true,"description":"Bearer token"},{"schema":{"type":"string","enum":["application/json"]},"name":"Content-Type","in":"header","required":true,"description":"Content type"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100,"description":"Name of the rule"},"ruleAlias":{"type":"string","maxLength":100,"description":"Optional alias"},"auditLog":{"type":"number","description":"Audit log TTL, must be positive"},"type":{"type":"string","description":"Rule type","enum":["decision-table","decision-tree","complex-rule","composition"]},"status":{"type":"string","description":"Rule state","enum":["published","pending"]},"inputSchema":{"type":"object","description":"Input schema"},"outputSchema":{"type":"object","description":"Output schema"}},"required":["name","type","status","inputSchema","outputSchema"]}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request: Invalid API key","content":{"application/json":{}}},"406":{"description":"Not Acceptable: Wrong Rule Flow format"},"426":{"description":"Upgrade Required: Operation not allowed"}}}}}}
```

{% hint style="danger" %}
Importing rule flow with rules included can overwrite previously created or imported rules having the same ruleId.
{% endhint %}

## Statistics

## Get space owner statistics

> Get space owner statistics.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.26.1"},"tags":[],"servers":[{"url":"https://api.decisionrules.io/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Please insert: \"Bearer <MANAGEMENT_API_KEY>\" into Authorization header."}}},"paths":{"/statistics/owner":{"get":{"tags":["Statistics"],"summary":"Get space owner statistics","description":"Get space owner statistics.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decisionrules.io/doc/api/management-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
