> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to API Node

Use this node to query an external system using synchronous or asynchronous SOAP or REST API calls. You can configure the request type, parameters, and connection rules for success and failure outcomes.

## Configure the Node

### General Settings

In **General Settings**, configure the following:

<img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/general-settings-api.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=5ada1050c9d0bceaa7e6f43ffe7d019e" alt="General Settings" width="416" height="720" data-path="ai-for-service/flows/node-types/images/general-settings-api.png" />

1. **Custom Name**: Enter a name to identify the node.

2. **Type**: Select the API type:
   * **REST**: Interacts with RESTful web services following REST architecture standards.
   * **SOAP**: Uses the Simple Object Access Protocol for exchanging data in distributed environments.

3. **Integration Type**: Select the execution model:
   * **Synchronous**: The API returns data immediately.
   * **Asynchronous**: The API returns data after a defined delay (default: 20s; range: 8s-20s).

     Enable **Handle API Failure Responses (4xx/5xx)** to treat all 4xx and 5xx responses as failures and trigger the configured `onFailure` path.

4. **Request Definition**: Define the API request (`GET`, `PUT`, `POST`, or `DELETE`), the API URL, and the parameters to pass. Click **+ Define Request** to create a new request.

   <img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/request-definition.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=b504ad57e110af5e804e88cf6e166ef2" alt="Request Definition" width="357" height="284" data-path="ai-for-service/flows/node-types/images/request-definition.png" />

5. **Access Using URL Connector**: If the API is behind a firewall with a configured URL connector, select `URLs are behind a firewall and a connector has been set up`.

   <img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/access-using-url-connector.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=92677022000a6c0ac48e16761af7fcd3" alt="URL Connector" width="413" height="780" data-path="ai-for-service/flows/node-types/images/access-using-url-connector.png" />

#### Define and Test an API Request

1. In **Request Definition**, click **+ Define Request**. The **Define Request** window opens.

   <img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/define-request-window.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=488e6570ab90745b21cd521da2d6b679" alt="Define Request" width="1918" height="582" data-path="ai-for-service/flows/node-types/images/define-request-window.png" />

2. Select the HTTP method: `GET`, `PUT`, `POST`, `PATCH`, or `DELETE`.

   <img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/api-method.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=e747eee56e2eea45279e614d1aa9d610" alt="Method" width="500" height="143" data-path="ai-for-service/flows/node-types/images/api-method.png" />

3. Paste the API URL in the text field and click **Test**.

   <img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/curl.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=2aa27efccfc640df9ae7f6bbb95e34ed" alt="cURL" width="500" height="61" data-path="ai-for-service/flows/node-types/images/curl.png" />

4. Provide **Header Key** and **Value** pairs. Click the **Delete** icon to remove a pair.

   <img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/headers.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=ed5cef75698f8c8a3af6aa921ac974b2" alt="Headers" width="500" height="162" data-path="ai-for-service/flows/node-types/images/headers.png" />

5. Click **Test Request** and paste the request body. The editor supports these options:

   * Format JSON with indentation
   * Compact JSON by removing whitespace
   * Sort contents
   * Filter, sort, or transform contents
   * Repair JSON
   * Undo / Redo

   <img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/test-request.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=4c694597392f36bd9b83f6e29c35527a" alt="Test Request" width="500" height="168" data-path="ai-for-service/flows/node-types/images/test-request.png" />

6. Click **Save** after a successful test.

### Connection Rules

Click the **Connection Rules** icon and select the target node for each API outcome:

* **On Success**: Routes the flow when the API call succeeds.
* **On Failure**: Routes the flow when the API call fails.

<img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/connection-rules-api.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=fd8dddc2a0797648aefdf8bc8b4ce102" alt="Connection Rules" width="412" height="558" data-path="ai-for-service/flows/node-types/images/connection-rules-api.png" />

### Error Handling

Use this section to handle system errors during customer interactions.

<img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/error-handling-api.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=3198de6b970cadcc54939f7c0d5cf061" alt="Error Handling" width="407" height="448" data-path="ai-for-service/flows/node-types/images/error-handling-api.png" />

* **Your Message to User**: Select a message type under **Choose your message type**:

  * **Text to Speech**: Type or select a message to convert to speech. Click **+ Create New** to add a new prompt, or **+ Add Another** to define multiple messages (one is randomly selected at runtime).

    <img src="https://mintcdn.com/koreai/Ns2xqLlABkt12FiY/ai-for-service/flows/node-types/images/text-to-speech-api.png?fit=max&auto=format&n=Ns2xqLlABkt12FiY&q=85&s=34ead69af9af382f85fda2adc41dd5a8" alt="Text to Speech" width="348" height="306" data-path="ai-for-service/flows/node-types/images/text-to-speech-api.png" />

  * **Audio File**: Type a message or click **+ Upload New** to upload an .mp3 or .wav file.

    <img src="https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/audio-file-api.png?fit=max&auto=format&n=WQeI2XsPNoZFdu0g&q=85&s=4e0c961e7de2445e5d8c506b68b4bc4b" alt="Audio File" width="345" height="308" data-path="ai-for-service/flows/node-types/images/audio-file-api.png" />

  * **Link**: Click **+ Create New** to add message text and an audio file URL (.mp3 or .wav). Click **+ Add Another** for additional URLs.

    <img src="https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/link-api.png?fit=max&auto=format&n=obfXwZeC6EncVIoC&q=85&s=a3ec7fc1bf27cf6dcf24b260a7b42d87" alt="Link" width="341" height="344" data-path="ai-for-service/flows/node-types/images/link-api.png" />

* **Go to node**: Select the node to direct the error handling flow. You can create a new node or select an existing one.
