# Connectors

Connectors allow you to securely store credentials and authenticate with external services directly from DecisionRules — databases, REST APIs, and AI model providers. Once configured, a connector can be selected in any rule or Flow node that requires an external connection, without exposing credentials in the rule itself.

### Supported Connectors

Several different database connectors are supported as well as an HTTP connector where you can securely store your Authorization Credentials (e.g., API keys)

* **Database Connectors**
  * Oracle
  * Microsoft SQL Server
  * Postgres
  * MySQL
  * Snowflake
* **REST API**
  * REST API Credentials
* **AI Models**
  * Google Gemini
  * Google Vertex AI
  * Anthropic
  * OpenAI
  * Microsoft Foundry

### Setting up a connector

Connectors can be setup either via the Space → Connectors → Add Connector menu or when using a specific database/HTTP block in Flow rules then above the connector selection you have the option to create a new connector without having to leave the flow.

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FaB6kSwx21ZQ71UG1fqKi%2Fconnectors_page.png?alt=media&#x26;token=85c39111-62c1-40e6-b0ae-ffb6efefc41c" alt=""><figcaption></figcaption></figure>

#### Database Connectors

Each connector might have slightly different setup but generally you will need to input

* Connector Name
  * This the visible name for the connector
* Connector Alias
  * Descriptive shortform name
* Host
  * Typically the IP address of the database
* Port
  * Which port is the database using
* User and Password
  * Credentials for login
* Database
  * specific name for the database to connect to

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FUYZvOuRsyKy7e0UnG9u3%2Fcreate_connector_modal.png?alt=media&#x26;token=01efd78d-92f7-4027-8d7a-0cc3d64e2277" alt=""><figcaption></figcaption></figure>

#### REST API Credentials Connector

* Connector Name
  * This the visible name for the connector
* Connector Alias
  * Descriptive shortform name
* Authentication Type
  * Choice of supported Authentication Types
* Authentication Types:
  * Bearer Token expects only the token itself, DecisionRules prepends the 'Bearer ' part automatically. Header name is 'authorization'.
  * Basic Authentication expects a username and a password. This is then encoded to base64 and appended to the word 'Basic' (e.g. 'Basic dGVzdFVzZXI6dGVzdFBhc3N3b3Jk').  Header name is 'authorization'
  * Custom Header expects Header Name and Header Value.&#x20;
* Encrypted fields
  * Each authentication type has an encrypted part which cannot be retrieved after creation but can be updated to a new value. For Bearer it's the token, for Basic it's the password and for Custom it's the header value.

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FQ2DA761tdgJv2cXXDhPM%2Fimage.png?alt=media&#x26;token=6ece3c5a-511e-407d-9988-e0529687799b" alt=""><figcaption></figcaption></figure>

### AI Model Connectors

AI Model Connectors allow you to authenticate with external LLM providers and use them inside [AI Agents](https://docs.decisionrules.io/doc/rules/ai-agent).

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FKzHmAcR7klDGjUloYshX%2FFrame%2016.png?alt=media&#x26;token=c91a8d9c-ef52-4591-86cd-bfa658dd63f0" alt="" width="563"><figcaption></figcaption></figure>

<table><thead><tr><th width="184.0885009765625">Field</th><th width="104.9879150390625">Google Gemini</th><th width="112.7491455078125">Anthropic</th><th width="97.361083984375">OpenAI</th><th width="127.7193603515625">Google Vertex AI</th><th width="111.506103515625">Microsoft Foundry</th></tr></thead><tbody><tr><td>Connector Name</td><td>required</td><td>required</td><td>required</td><td>required</td><td>required</td></tr><tr><td>Alias</td><td>required</td><td>required</td><td>required</td><td>required</td><td>required</td></tr><tr><td>API Key</td><td>required</td><td>required</td><td>required</td><td>required</td><td>required</td></tr><tr><td>Location</td><td></td><td></td><td></td><td>required, e.g. <br><code>us-central1</code></td><td></td></tr><tr><td>Project Id</td><td></td><td></td><td></td><td>required, e.g. <br><code>my-project</code></td><td></td></tr><tr><td>API Endpoint</td><td></td><td></td><td></td><td>optional</td><td></td></tr><tr><td>Deployment Name</td><td></td><td></td><td></td><td></td><td>required</td></tr><tr><td>Endpoint</td><td></td><td></td><td></td><td></td><td>required</td></tr><tr><td>Override Model Alias</td><td></td><td></td><td></td><td></td><td>optional</td></tr></tbody></table>

{% hint style="info" %}
The credential field is encrypted and cannot be retrieved after creation, but can be updated at any time.
{% endhint %}

### Using connectors in Decision Flow and Integration Flow

To connect to a database in the flow rule, choose a block for your specific database type from the Palette. Each database provides 2 blocks

* General block
  * Use this block for Select statements that return multiple rows that you need to iterate through one by one
* Single Row
  * Use this block either for queries that do not return rows (UPDATE,INSERT, CREATE …)
  * Use for SELECT statements that return only one row, the response is then stored in a result object and easily accessible

{% hint style="info" %}
More information about Database Flow nodes can be found [here](https://docs.decisionrules.io/doc/rules/flow/flow-nodes-overview#relational-database-query-nodes).
{% endhint %}

For HTTP Client Nodes the connector selection is optional.

#### Setting up the block

1. Select your connector at the top of the block definition
   1. Potentially you can create a new connector from this menu if needed

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FkGaWY8ZbKvpB4BuOZMnH%2Fuse_db_connector.png?alt=media&#x26;token=0235bc2e-b66a-49d2-9306-65980099b6cc" alt=""><figcaption></figcaption></figure>

2. Input your query into the query window
3. **Variables** are referenced via **{var\_name}** notation
   1. For example

      `select * from drInput LIMIT {input.input}`
4. You can test your query
   1. First fill in the input variables with relevant data
   2. Click the test button

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FoeFm0ScvsW7K2RwQlpNW%2Ftest_the_query.png?alt=media&#x26;token=ecc065f6-9e6b-4df2-a5bb-ce075d0534d6" alt=""><figcaption></figcaption></figure>

2. The query is executed and sample of the response data is shown **(the rows shown are limited to 25)**

<figure><img src="https://437457296-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MN4F4-qybg8XDATvios%2Fuploads%2FMhSz5xcIU9y53mbr2blF%2Ftest_query_results.png?alt=media&#x26;token=73e3b8b1-39fd-4f65-8c23-0aa741c1f2a0" alt=""><figcaption></figcaption></figure>

### Exporting rules using connectors

If you export a rule using connector, the connector is not exported with the rule, this is mainly to make sure that your credential do not get leaked.

The connector used in the evaluation of the database blocks is identified by the **Alias**, so it is recommended when migrating between two different space, to have a connector already prepared with the same alias, so that when the rule is imported an executed it can already take advantage of the connector and not throw an error

#### IP Allowlisting <a href="#ip-whitelist" id="ip-whitelist"></a>

One of the differences between the Decision Flow and Integration Flow is the availability of the IP whitelist (this is used to identify DecisionRules while making connections to databases). The Decision Flow does not offer a specific list of addresses since, the rule execution can be distributed around a large number of dynamically created servers used for scaling purposes, therefore in the case of Decision Flow, we are not able to provide you with a list of addresses from which the connections might originate.

For integration Flow the Jobs are being evaluated by a specific infrastructure with a specific IP address, therefore IP Allowlist is available and should be easy to setup specific allowlisting on your side of the database. For IP list see dedicated page [here](https://docs.decisionrules.io/doc/integrations/flow-integrations/ip-allowlisting).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decisionrules.io/doc/space/connectors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
