# Autenticación

## login

<mark style="color:green;">`POST`</mark> `https://ventiapi.azurewebsites.net/login`

Generación de bearer token para poder utilizar el resto de las funciones de la API de Ventiapp.\
\
Una vez haga esta autenticación usted podrá utilizar el resto de las funciones. Para ver como realizar llamadas utilizando el token, por favor ingrese al siguiente post\
\
En la respuesta obtendrá los siguientes valores:\
\
**access\_token:** Token que utilizará para llamar a las funciones públicas. Es muy importante que almacene este valor.\
**token\_type**: Tipo de token utilizado por la plataforma\
**expires\_in**: Tiempo en segundos que tardará en caducar el token (1 semana actualmente)\
\
Estos parámetros deben ir como **x-www-form-urlencoded**

<br>

#### Request Body

| Name        | Type   | Description                                                                      |
| ----------- | ------ | -------------------------------------------------------------------------------- |
| username    | string | Email de acceso de cuenta con permisos de administrador                          |
| password    | string | Password de acceso de cuenta con permisos de administrador                       |
| grant\_type | string | Parámetro requerido con el valor "password" para poder realizar la autenticación |

{% tabs %}
{% tab title="200 Respuesta de solicitud de token" %}

```javascript
{
    "access_token": "V9e78myG5kPq_Kp8TAUhnJOnVvZEQ6rWS7IxbCD9dkxReYUSe_m4Sn5xjq2KF-XJhTIlQWvF9GIndhtDjx7WQr4CzYye1KLTNkJevRPNk2HR9cEULifFArxez8kA4evkRDke-4a3Gekdb_sDcQZXr6X1D4C7MeqyNAT0LjvqgLR-dFXdbNQrBkvIX_I6hsPzEAR0mjcxWRawVMfcq97vpPUAW42cZJD-AJbZdE9KVwUYgIhgO2M2IBZLrctLvl2xjx3OrQy9-Y_d---wUUDoWw",
    "token_type": "bearer",
    "expires_in": 604799
}

```

{% endtab %}
{% endtabs %}

Ejemplo de parámetros en **x-www-form-urlencoded**

```
username=hola@kubodigital.com&password=kubodigital&grant_type=password
```

### Ejemplo Curl

```
curl --location --request POST 'http://ventiapi.azurewebsites.net/login' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=usuariodeventi' \
--data-urlencode 'password=passventiapp' \
--data-urlencode 'grant_type=password'

```


---

# 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.ventiapp.mx/ventiapp/desarrolladores/api/autenticacion.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.
