# Management API

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](https://docs.decisionrules.io/doc/other-deployment-options/regional-cloud/region-specific-api-urls#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&#x26;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 infromation 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.22.0"},"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 infromation 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.

```json
{"openapi":"3.1.1","info":{"title":"DecisionRules.io Management API","version":"1.22.0"},"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":{"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.","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":"Optional. The path to 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","required":["name","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":{"type":"object","description":"Definition of the decision table","properties":{"columns":{"type":"array","items":{"type":"object","properties":{"condition":{"type":"object","properties":{"type":{"type":"string"},"inputVariable":{"type":"string"},"name":{"type":"string"}}},"columnOutput":{"type":"object","properties":{"type":{"type":"string"},"outputVariable":{"type":"string"},"name":{"type":"string"}}},"columnId":{"type":"string"},"type":{"type":"string"}}}},"rows":{"type":"array","items":{"type":"object","properties":{"cells":{"type":"array","items":{"type":"object","properties":{"column":{"type":"string"},"scalarCondition":{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}}},"outputScalarValue":{"type":"object","properties":{"value":{"type":"string"}}},"type":{"type":"string"}}}}}}}}},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree"],"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"}}}}}},"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.22.0"},"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}?":{"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","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"],"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":{"type":"object","description":"Definition of the decision table","properties":{"columns":{"type":"array","items":{"type":"object","properties":{"condition":{"type":"object","properties":{"type":{"type":"string"},"inputVariable":{"type":"string"},"name":{"type":"string"}}},"columnOutput":{"type":"object","properties":{"type":{"type":"string"},"outputVariable":{"type":"string"},"name":{"type":"string"}}},"columnId":{"type":"string"},"type":{"type":"string"}}}},"rows":{"type":"array","items":{"type":"object","properties":{"cells":{"type":"array","items":{"type":"object","properties":{"column":{"type":"string"},"scalarCondition":{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}}},"outputScalarValue":{"type":"object","properties":{"value":{"type":"string"}}},"type":{"type":"string"}}}}}}}}},"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"}}}}}},"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.22.0"},"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.22.0"},"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.22.0"},"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}/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","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":{"type":"object","description":"Definition of the decision table","properties":{"columns":{"type":"array","items":{"type":"object","properties":{"condition":{"type":"object","properties":{"type":{"type":"string"},"inputVariable":{"type":"string"},"name":{"type":"string"}}},"columnOutput":{"type":"object","properties":{"type":{"type":"string"},"outputVariable":{"type":"string"},"name":{"type":"string"}}},"columnId":{"type":"string"},"type":{"type":"string"}}}},"rows":{"type":"array","items":{"type":"object","properties":{"cells":{"type":"array","items":{"type":"object","properties":{"column":{"type":"string"},"scalarCondition":{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}}},"outputScalarValue":{"type":"object","properties":{"value":{"type":"string"}}},"type":{"type":"string"}}}}}}}}},"type":{"type":"string","enum":["decision-table","complex-rule","composition","decision-tree"],"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"}}}}}},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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":{}},"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.22.0"},"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":{}},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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.22.0"},"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"}}}}}}}}}
```

## 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.22.0"},"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.22.0"},"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.22.0"},"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"}}}}}}}}}
```
