> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/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:

![General Settings](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)

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.

   ![Request Definition](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)

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`.

   ![URL Connector](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)

#### Define and Test an API Request

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

   ![Define Request](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)

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

   ![Method](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)

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

   ![cURL](https://mintcdn.com/koreai/WQeI2XsPNoZFdu0g/ai-for-service/flows/node-types/images/curl.png?fit=max\&auto=format\&n=WQeI2XsPNoZFdu0g\&q=85\&s=2aa27efccfc640df9ae7f6bbb95e34ed)

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

   ![Headers](https://mintcdn.com/koreai/obfXwZeC6EncVIoC/ai-for-service/flows/node-types/images/headers.png?fit=max\&auto=format\&n=obfXwZeC6EncVIoC\&q=85\&s=ed5cef75698f8c8a3af6aa921ac974b2)

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

   ![Test Request](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)

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.

![Connection Rules](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)

### Error Handling

Use this section to handle system errors during customer interactions.

![Error Handling](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)

* **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).

    ![Text to Speech](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)

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

    ![Audio File](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)

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

    ![Link](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)

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.