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

# Rest API

Durante la ejecución del flujo de conversación tiene la opción de llamar a cualquier API. Sólo tiene que establecer el **Método** Para ser utilizado, el **Url** API, y, si lo prefiere, **Parámetros** y **Tipo** **de** **Parámetros** que se enviarán.

![](/files/-MjnthpoijT5kTvwgDCd)

Si deseas tratar la respuesta de devolución de la API, puedes utilizar el código **Javascript**. La respuesta estará disponible a través de la variable: **response\_\_x.**

Si la devolución es un objeto JavaScript (formato JSON), cuando lo trate en el código, recuerde verificar que el mismo no es null para evitar errores. Y si la devolución es una String y desea usarla en código como JSON, recuerde convertirlo a JSON mediante el método **JSON.parse(response\_\_x)**

Si deseas guardar la devolución en algún campo de objeto personalizado, recuerda que el formato JSON no está permitido como el tipo de campo. Por lo tanto, tendrá que convertirlo a String, utilizando el método J**SON.stringify(exemplo\_retorno)**, Y sólo entonces guardarlo. A continuación, si deseas utilizar este campo en el futuro, recuerda convertirlo de nuevo a JSON utilizando el método **JSON.parse(exemplo\_retorno)**

{% hint style="warning" %}
Hay un tiempo de espera de ejecución de 15 segundos. Por lo tanto, si se pasa este límite, se interrumpirá la llamada a la API y se devolverá un error que se puede consultar en el historial de conversaciones.
{% endhint %}


---

# 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-es.cosmobots.io/bot-builder/flujo-de-conversacion/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.
