# API Gateway

* [Definitions](#definitions)

* [Create an API Gateway](#criar-um-api-gateway)
  * [How to edit an API Gateway](#como-editar-um-api-gateway)

    * [Name and Description](#name-and-description)
    * [Image](#image)
    * [Copying an API Gateway](#copiar-um-api-gateway)
    * [Deleting an API Gateway](#excluir-um-api-gateway)

* [Version](#version)
  * [Creating a Version](#criacao-de-uma-versao)
  * [Editing a Version](#editing-a-version)
  * [Deleting a Version](#deleting-a-version)

* [Routes](#routes)
  * [HTTP Route](#http-route)
    * [Create an HTTP route](#create-an-http-route)
  * [Trigger route](#trigger-route)
    * [Create a trigger route](#create-a-trigger-route)
  * [Edit Routes](#edit-routes)
  * [Execution limit](#limite-de-execucoes)
  * [Delete routes](#delete-routes)

* [Users](#users)
  * [Create Users](#criar-usuarios)
  * [Edit Users](#edit-users)
  * [Deleting Users](#excluir-usuarios)

### Definitions <a href="#definitions" id="definitions"></a>

An **API Gateway** is a tool for managing APIs that allows you to create or use third-party APIs in a single location, offering a fast and practical solution for API management. It acts as a reverse proxy that accepts all API calls, aggregates the various services required to execute them, and returns the appropriate result.

With this in mind, the **Skyone Studio API Gateway** was designed to simplify the creation of flows across different integrations. It serves as your central hub for API management, supporting **Basic authentication** (with username and password) for one or more users, as well as **routing (route creation)**.

In addition to managing external APIs, you can also create an API from scratch and use it within a flow in Skyone Studio.

### **C**reate an **API Gateway** <a href="#criar-um-api-gateway" id="criar-um-api-gateway"></a>

You can create one or more API Gateways to manage different APIs, whether they are external or created within Skyone Studio. To do this, follow the steps below:

1. In the API Gateway tab, click on "**Create API Gateway**".
2. &#x20;In the modal, enter the **API Gateway Name**, **Description** (Optional), choose a **Group** (default is "default"), and **Image** (Optional).

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

{% hint style="info" %}
The image must be 80x80 in size and in PNG, JPG, or JPEG format. If no image is selected, the API Gateway will be represented by a default Skyone Studio thumbnail, which can be changed later.
{% endhint %}

3. To finish, click on "**Create"**.

### **How to edit an API Gateway** <a href="#como-editar-um-api-gateway" id="como-editar-um-api-gateway"></a>

To edit the API Gateway, simply click on the desired item. You will then be directed to the editing screen. We have separated the editing steps below:

#### **Name and Description:**

1. To edit the "**Name**" and "**Description**", just one click will make the area editable.
2. After making your changes, click outside the editing area or press the Enter key to save your changes.

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

#### **Image**

1. To change the image, move the mouse closer and click on "**Edit"**.
2. Once the change has been made, click "**Save"**.

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

#### Copying an API Gateway <a href="#copiar-um-api-gateway" id="copiar-um-api-gateway"></a>

To copy an API Gateway, simply click on "**Copy URL".**

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

#### **Deleting an API Gateway** <a href="#excluir-um-api-gateway" id="excluir-um-api-gateway"></a>

1. To delete an API Gateway, simply click on "**Delete"**, located in the three dots in the API Gateway editing area.
2. Enter the name to confirm the deletion and click "**Delete"** to finish the action.

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

{% hint style="info" %}
You can't undo the deletion.
{% endhint %}

### **Version** <a href="#version" id="version"></a>

With this feature, you can create different versions for the same API, which can contain different routes and access permissions.

#### **Creating a Version** <a href="#criacao-de-uma-versao" id="criacao-de-uma-versao"></a>

To create a version:

1. In "**API Gateway"**, click on the desired item.
2. Click on "**New version"**.

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

3. Enter the **Name of the API Gateway** version and click "**Next Step"**.

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

4. Create a new route (more information below) and click "**Save changes"**.

### **Editing a Version** <a href="#editing-a-version" id="editing-a-version"></a>

To edit a version:

1. Under "**API Gateway"**, click on the desired item.
2. Under "**Versions"**, choose the version you want to modify and click "**Edit"**.
3. To finish, click on "**Save changes".**

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

#### **Deleting a Version**

To delete a version:

1. In "**API Gateway"**, click on the desired item.
2. Under "**Versions**, choose the version you want to delete and click "**Delete"**.
3. In the modal, enter the name to confirm the deletion and click "**Delete"** to finalize the action.

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

### **Routes** <a href="#routes" id="routes"></a>

Now that you’ve created at least one version, you can set up one or more routes for your API.

A route is an address (URL) that directs to a flow, acting as an endpoint for accessing your API in **Skyone Data**. For example, you can create a route named "/products" to handle all flows related to products (saving, listing, deleting products) using one or more versions. By using routes with different HTTP methods, **Skyone Studio**'s API Gateway simplifies the use of APIs or the creation of APIs to perform various tasks in different flows.

For greater flexibility, our API Gateway allows the creation of two types of routes: Trigger and HTTP, which we’ll explore in detail below.

#### **HTTP Route** <a href="#http-route" id="http-route"></a>

When you create an HTTP route, which always uses an external API, you can point to a route in a given language, even if the endpoint is in a different language, making it easy for any **Skyone Studio** user to use external APIs. So if, for example, you want to make a request to the "/orders/approve" endpoint of an API, you can create a route called "/orders/approve".

In other words, instead of using the external API, without customization, you use it with a unique URL and custom data: route, version and user access (Basic authentication).

#### **Create an HTTP route:**

1. With the version already created, when you click on "**Next steps"**, you will be directed to create the route.
2. Click on "**Create new route".**

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

1. Enter the route data:

* Enter the **Route URL** you want to use in the route, which may be different from the original.
* Choose one or more **API Gateway route** methods (GET, POST, PUT, PATCH OR DELETE);
* Under **Route Type**, choose **HTTP**;
* Enter the **Protocol** (HTTP or HTTPS), the **Host** (API address) and the **Port** used;
* Enter the API's original **Path** (endpoint)
* Choose the **Execution limit** (number of executions and period);
* Optionally, if you have already created a user, click on the "**Protected route"** option and choose the user who needs access to this route;

4\. To finish the action, click on "**Save route"**.

#### **Trigger route** <a href="#trigger-route" id="trigger-route"></a>

When you create a Trigger route, which doesn't use an external API, you can carry out different operations without having to repeat the configuration in each flow, as well as controlling access according to the user registered in the API Gateway, if you want access to be restricted.

In other words, instead of repeating the data in different flows, you use it with a single URL and personalized data: route, version and access per user (Basic authentication).

#### **Create a trigger route:**

1. With the version already created, by clicking on "**Next steps**", you will be directed to create the route.&#x20;
2. Click on "**Create new route**".
3. Enter the route data:

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

* Enter the **Route URL** you want to use in the route, which may be different from the original.
* Choose one or more **API Gateway route** methods (GET, POST, PUT, PATCH OR DELETE);
* Under **Route Type**, choose **Trigger**;
* Choose the **Execution limit** (number of executions and period);
* Optionally, if you have already created a user, click on the **Protected route** option and choose the user who needs access to this route;

4. To finish the action, click on "**Save route".**

#### **Edit Routes** <a href="#edit-routes" id="edit-routes"></a>

To edit a created route at any time:

1. Within the version of your API Gateway, choose the item you want to change and click "**Edit".**
2. Once you've made your changes, click "**Save changes"**.

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

#### Execution limit <a href="#limite-de-execucoes" id="limite-de-execucoes"></a>

You can manage the number of executions of your API Gateway through the **Execution Limit**, i.e. determining the maximum number of times the API will be requested over a period of time.

To do this, when editing a route, choose the desired number and time measure (second, minute or hour).

Finally, click on "**Save changes"**.

{% hint style="info" %}
The default run limit is 10 runs per minute.
{% endhint %}

{% hint style="warning" %}
Time is measured in seconds, minutes and full standard time. For example: Imagine you have a route and the limit on executions is set to 2 per minute. Even if the call starts at 08:45:55, the limit is until 08:45:59, because 08:46:00 will be counted as a new series of executions.
{% endhint %}

#### **Delete routes** <a href="#delete-routes" id="delete-routes"></a>

To delete a created route at any time:

1. Within the version of your API Gateway, choose the item you want to change and click "**Delete".**
2. In the modal, enter the name to confirm the deletion and click "**Delete"** to finalize the action.

### **Users**

If you want to restrict access to one or more users, you can do so using an authentication (Basic ou oAuth2)

#### **Create Users**  <a href="#criar-usuarios" id="criar-usuarios"></a>

1. To create a user, in API Gateway, click on the **Users** tab.
2. Click on "**Add user";**
3. Customize the rest of the **User** name;
4. Choose the authentication type: **Basic** or **oAuth2**, and follow the setup according to the selected type.

{% tabs %}
{% tab title="Basic" %}
To complete the setup for a **Basic** user, enter the **Password**, then click "**Save user**".

<figure><img src="/files/Jlj7H5kJtNZONGTqNN0n" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="oAuth2" %}
To complete the setup for an **oAuth2** user, click "**Save user**".

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

After creating the user, the screen will display the **Client ID** and **Client Secret**. Copy this information and enter it in the endpoint to generate the access\_token.

<figure><img src="/files/ZUwdqIvfRiveahiFx9p1" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

The created users are listed under the "**Users**" tab in the API Gateway.

#### **Edit Users**

To edit a user:&#x20;

1. In API Gateway, in the Users tab, click on "**Edit**" for the desired user.&#x20;

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

2. Make the necessary changes and click on "**Save changes**".

#### **Deleting Users** <a href="#excluir-usuarios" id="excluir-usuarios"></a>

To delete a user:

1. In API Gateway, in the **Users** tab, click on "**Delete**" for the desired user.&#x20;
2. In the modal, enter the name to confirm the deletion and click on "**Delete**" to finalize the action.

{% hint style="warning" %}
You can delete any user, as long as t**hey are not currently associated with a route**. If this is the case, you need to edit the routes that include the user and remove them from the "Is this route protected?".
{% endhint %}

Read also:

* [URL Parameters in API Gateway](/english/skyone-studio/how-to/url-parameters-in-api-gateway.md)


---

# 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.skyone.cloud/english/skyone-studio/api-gateway.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.
