> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tyver.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Autenticação

> Obtenha o token de acesso utilizando a chave de API e o endpoint de login.

Obtenha o token de acesso do Tyver Hub utilizando sua chave de API.

> [!NOTE]
>
> O login não exige Bearer Token. Envie sua chave de API no corpo JSON.

## Corpo da requisição

**api\_key** `string` *required*

Chave de API fornecida ao cliente.

## Resposta HTTP 200

**access\_token** `string`

Token de acesso utilizado nas consultas.

**token\_type** `string`

Tipo de autenticação: Bearer.

**expires\_in** `integer`

Validade do token em segundos: 900 (15 minutos).

Obtenha um novo token após 15 minutos. Não compartilhe o token.

```bash cURL theme={"system"}
curl -X POST "https://api.tyver.com.br/login" \
  -H 'Content-Type: application/json' \
  -d '{"api_key":"SUA_API_KEY"}'
```

```javascript JavaScript theme={"system"}
const host = "https://api.tyver.com.br";
const response = await fetch(host + "/login", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ api_key: "SUA_API_KEY" })
});
console.log(await response.text());
```

```python Python theme={"system"}
import os
import requests

url = "https://api.tyver.com.br" + "/login"
response = requests.post(url, json={"api_key": "SUA_API_KEY"})
print(response.text)
```

```php PHP theme={"system"}
<?php
$url = 'https://api.tyver.com.br' . '/login';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['api_key' => 'SUA_API_KEY']));
echo curl_exec($ch);
curl_close($ch);
```

```json HTTP 200 theme={"system"}
{
  "access_token": "SEU_TOKEN",
  "token_type": "Bearer",
  "expires_in": 900
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.