> For the complete documentation index, see [llms.txt](https://help.cosmobots.io/help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.cosmobots.io/help/bot-builder/fluxo-da-conversa/rest-api.md).

# Rest API

A etapa de Rest Api possibilita que durante a execução do fluxo da conversa você tenha a opção de fazer chamada de qualquer API, basta definir o Método a ser usado, a Url da API e, se preferir, os Parâmetros e Tipo de Parâmetros a serem enviados.

Vou te mostrar o passo a passo de como utilizá-la.

Vamos lá!!

1- Para criar uma etapa de Rest API, dentro do fluxo em que você quer inseri-la, clique no botão de Rest API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872582/original/7VDulZ_mRm786ptXAjwgYC6eCdpTBEyNFA.gif?1599717881)

2- Dê um nome à sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872607/original/oAHGIlrwr4FUt6JjNu2s7OU7FnICnegwxA.gif?1599717919)

3- Caso você vá utilizar a mesma API, com o mesmo método mais de uma vez, é possível cadastrar modelos em Configurações:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872622/original/gDrSzOYtP3hHI3LwgFeoMuF5ONlqW9ESDA.gif?1599717942)

4- Escolha o método da sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872630/original/qnuhb9Fyu93J_dMC--pM4JwU9MvPIJhp8w.gif?1599717957)

{% hint style="info" %}
OBS#: Cada um dos métodos tem uma finalidade, sendo elas:

GET: Aqui, você consegue consultar dados da sua API

POST: Aqui, você consegue enviar dados para sua API

PUT: Aqui, você consegue editar dados na sua API

DELETE: E aqui, você consegue deletar dados na sua API.
{% endhint %}

5- Em URL, insira a URL/endereço da sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872758/original/md6tcu1WhXlDbg7P4A0nIVPDRpYOqHpetw.gif?1599718255)

6- Selecione o tipo de parâmetro que você vai utilizar na sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872645/original/iD_vgGjDxrqgC1iTsC1dvJbsaUrfAa-gGA.gif?1599718013)

{% hint style="info" %}
OBS#: Caso você esteja utilizando uma API com método de envio e precise enviar dados do Body, utilize a opção avançado. Será aberto um campo para você inserir os dados do seu Body e Headers:
{% endhint %}

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872716/original/lB_va523-pNbxcpHfCBbrc_65ezqX_18MA.gif?1599718206)

{% hint style="info" %}
OBS#: Para que funcione corretamente, é necessário que você atribua os parâmetros em JSON a variável: request\_\_x, os headers em JSON para a variável: headers\_\_x e o body em JSON a variável: body\_\_x, conforme exemplo:
{% endhint %}

```
request__x={
"key":"xyz"
};

body__x={
 
  "requests":[
    {
      "image":{
        "source":{
          "imageUri": "https://s3.amazonaws.com/asdasd.jpg"
            
        }
      },
      "features":[
        {
          "type":"TEXT_DETECTION",
          "maxResults":1
        }
      ]
    }
  ]
}
```

7- Caso não esteja utilizando API's que precisam de envio do Body, em Headers, você consegue inserir os dados do Header da sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872946/original/_JLnlcupYu3ZlojUayHWXT9tW3qM9amEGA.gif?1599718780)

8- Em parâmetros você envia os parâmetros da sua API:

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/61004872964/original/WLPCtgE57aAdVKwUk2aFx7Qbw2xZ3OtgAg.gif?1599718799)

9- E para pegar os retornos, em Retornos, utilize response\_\_x


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.cosmobots.io/help/bot-builder/fluxo-da-conversa/rest-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
