# How to use Internal API with and without a VPN

On the Digibee Integration Platform, you can publish your pipelines for internal or external use:

* **Internal use:** The API is available only within your cluster’s internal gateway, allowing access by other pipelines in your realm or through a VPN.
* **External use:** The API is accessible over the internet, enabling interaction with external applications and services.

You can use the following triggers to configure your API: [**HTTP**](/documentation/connectors-and-triggers/triggers/web-protocols/http.md), [**HTTP File**](/documentation/connectors-and-triggers/triggers/web-protocols/http-file.md), and [**REST**](/documentation/connectors-and-triggers/triggers/web-protocols/rest.md)**.**

Follow the steps below to enable and use an **Internal API**.

{% stepper %}
{% step %}

## **Request Internal API access**

To enable the Internal API in your realm, contact [Digibee Customer Support](/documentation/troubleshooting/help-and-faq/support.md).

The team will configure:

* **Hostname:** `{{realmname}}.digibee.internal`
* **Ports:**
  * `7070` (Production)
  * `9090` (Test)

{% hint style="info" %}
On the **Dedicated SaaS** model, the ports may have **different values**.
{% endhint %}
{% endstep %}

{% step %}

## **Set up a pipeline for Internal API access**

To configure the pipeline to use the Internal API:

1. Choose a supported trigger: [**HTTP**](/documentation/connectors-and-triggers/triggers/web-protocols/http.md), [**HTTP File**](/documentation/connectors-and-triggers/triggers/web-protocols/http-file.md), and [**REST**](/documentation/connectors-and-triggers/triggers/web-protocols/rest.md)**.**
2. Enable **Internal API** and **API Key** in the trigger configuration form.
3. Assign the pipeline to an [API Key](/documentation/developer-guide/platform-administration/settings/api-keys-consumers.md).
4. [Deploy the pipeline](/documentation/developer-guide/development-cycle/overview/deployment/deployments.md) on the **Run** page.
5. Open the Deployment details card for the pipeline and expand the trigger configuration section to find the endpoint in the following format:

{% code overflow="wrap" %}

```
https://{replace-with-Digibee-internal-host}/pipeline/realm/v1/{{pipeline-name}}
```

{% endcode %}
{% endstep %}

{% step %}

## **Consume the endpoint**

Once the pipeline is deployed and the endpoint is available, you can consume it in two ways:

1. **Using a** [**VPN**](/documentation/developer-guide/connectivity-management/vpn.md)
2. **Locally from other pipelines (without a VPN)**

{% hint style="warning" %}
By default, it’s **not** possible to consume the endpoint locally from other pipelines (without a VPN) on the **Dedicated SaaS** model.
{% endhint %}

### **Consuming the endpoint using a VPN**

To successfully consume an endpoint via a VPN, ensure that **Phase 2 of Digibee** is properly configured in your network. The service making the request must be within the IP range mapped to Digibee’s Phase 2.

<figure><img src="/files/QHnjaJnkqmMTwknURaoc" alt=""><figcaption></figcaption></figure>

#### **Configuration requirements**

Before making a request, confirm that:

* **Phase 2 of Digibee** is declared in your network.
* The API consumer’s IP range is mapped in Digibee’s Phase 2.

#### **Calling the endpoint**

Once Phase 2 mappings are configured, use the following format to call the endpoint:

```
http://10.255.0.2:9090/pipeline/dgb-support-lab/v1/test-api-internal
```

{% hint style="danger" %}
Use **HTTP** instead of HTTPS.
{% endhint %}

#### **Troubleshooting checklist**

If you find issues while making the request, verify the following:

* The **Internal API** is available in your realm.
* Your **Phase 2 mapping** is correctly configured in Digibee.
* **Phase 2 of Digibee** is declared in your network.
* You are using **HTTP** instead of HTTPS.

### **Consuming the endpoint locally (without VPN)**

{% hint style="warning" %}
By default, it’s **not** possible to consume the endpoint locally from other pipelines (without a VPN) on the **Dedicated SaaS** model.
{% endhint %}

To consume this endpoint locally, replace this part: `{replace with Digibee internal host}`\
with the appropriate internal host and port. See this example:

* **Host:** `dgb-support-lab.digibee.internal`
* **Port (Test):** `9090`

The following URL will be used to access the endpoint:

{% code overflow="wrap" %}

```
http://dgb-support-lab.digibee.internal:9090/pipeline/dgb-support-lab/v1/test-api-internal
```

{% endcode %}

{% hint style="danger" %}
Use **HTTP** instead of HTTPS.
{% endhint %}

#### **Using an Internal API in a pipeline**

You can trigger this endpoint within a pipeline using one of the following connectors:

* [**REST**](/documentation/connectors-and-triggers/connectors/web-protocols/rest-v2.md)
* [**Pipeline Executor**](/documentation/connectors-and-triggers/connectors/tools/pipeline-executor.md)

Additionally, an external application can access it if a VPN connection is established with your realm.

**Example: Using the REST connector**

Here's an example of how to configure the **REST** connector to call this internal API:

**Connector’s configuration:**

<figure><img src="/files/yHTR96mMDSBAA53FI0rS" alt=""><figcaption></figcaption></figure>

**Output:**

```json
{
  "status": 200,
  "statusMessage": "OK",
  "body": {
    "success": true
  },
  "headers": {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Expose-Headers": "Authorization",
    "Connection": "keep-alive",
    "Content-Type": "application/json",
    "X-Digibee-Trace-Id": "d8e14b0b-fade-425d-b1f0-ed1cef66c8df"
  }
}
```

{% endstep %}
{% endstepper %}


---

# 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.digibee.com/documentation/troubleshooting/connectivity-guides/use-internal-api-with-and-without-a-vpn.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.
