# Consulta sesiones abiertas vía API

### Solicitud <a href="#solicitud" id="solicitud"></a>

Para consultar sesiones abiertas a través de nuestra API, debe realizar una solicitud GET a la siguiente dirección:

`GET http://api-messaging.wavy.global/v1/session?customerId={customerId}&subAccountId={subAccountId}`

Pasar el parámetro ***customerId*** es obligatorio, mientras que ***subAccountId*** es opcional.

Atención: Tenga cuidado de reemplazar ‘{’ y ‘}’ también. Por ejemplo, “={customerId}” se convierte en “=42”.

También necesitará utilizar los siguientes headers:

| Header                  | Valor                           |
| ----------------------- | ------------------------------- |
| **Content-Type**        | application/json                |
| **authenticationToken** | Token de Messaging1             |
| **userName**            | Nombre de usuario de Messaging1 |

#### Respuesta <a href="#respuesta" id="respuesta"></a>

En el exito, si hay sesiones abiertas para el cliente especificado y subAccountId, la solicitud devuelve un JSON con el atributo:

| Atributo      | Valor                                                                                                                                  |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **file\_url** | Link para descargar un archivo de tipo csv que contiene los campos “source” y “session\_created\_at” de todos los destinos encontrados |

Si no hay datos asociados con ***customerId*** y ***subAccountId***, el archivo devuelto estará vacío, sólo con el encabezado.

> Ejemplo de respuesta:

{% tabs %}
{% tab title="cURL" %}

> Ejemplo de respuesta:

```
{
    "file_url": "https://chatclub-cdn.wavy.global/2019/02/13/633e33fc-3a3f-4ca5-a8b0-4b747fb67137/5bd46e2b-5990-4681-9b29-98ab6598960e"
}
```

{% endtab %}

{% tab title="Ruby" %}

```
{
    "file_url": "https://chatclub-cdn.wavy.global/2019/02/13/633e33fc-3a3f-4ca5-a8b0-4b747fb67137/5bd46e2b-5990-4681-9b29-98ab6598960e"
}
```

{% endtab %}

{% tab title="Python" %}

```
{
    "file_url": "https://chatclub-cdn.wavy.global/2019/02/13/633e33fc-3a3f-4ca5-a8b0-4b747fb67137/5bd46e2b-5990-4681-9b29-98ab6598960e"
}
```

{% endtab %}

{% tab title="PHP" %}

```
{
    "file_url": "https://chatclub-cdn.wavy.global/2019/02/13/633e33fc-3a3f-4ca5-a8b0-4b747fb67137/5bd46e2b-5990-4681-9b29-98ab6598960e"
}
```

{% endtab %}

{% tab title="Java" %}

```
{
    "file_url": "https://chatclub-cdn.wavy.global/2019/02/13/633e33fc-3a3f-4ca5-a8b0-4b747fb67137/5bd46e2b-5990-4681-9b29-98ab6598960e"
}
```

{% endtab %}
{% endtabs %}


---

# 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-es.sinch.com/documentaciontecnicawhatsapp/sinch-messaging-whatsapp-api/consulta-sesiones-abiertas-via-api.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.
