OAuth 2.0
Contrato 0732e1f701a5
Use estas operações para obter um token de acesso e consultar os dados da credencial autenticada.
- Produção:
https://auth.avillus.com.br - Sandbox:
https://auth-sandbox.avillus.com.br
Criar um token de acesso
Seção intitulada “Criar um token de acesso”POST/oauth2/token
Troca um ID de cliente e um segredo ativos por um token Bearer usando o fluxo de credenciais do cliente do OAuth 2.0. Envie as credenciais com autenticação HTTP Basic. Os tokens expiram após 15 minutos e contêm somente os escopos já concedidos à credencial.
Request body
Seção intitulada “Request body”Content-Type: application/x-www-form-urlencoded
{ "grant_type": "client_credentials", "scope": "ri:rental-insurances:read ri:rental-insurances:write"}Responses
Seção intitulada “Responses”| Status | Description | Response headers |
|---|---|---|
| 200 | Token de acesso emitido | Cache-Control |
| 400 | Escopo, requisição ou tipo de concessão inválido | — |
| 401 | Credencial de cliente inválida, expirada ou revogada | — |
Response body (200)
Seção intitulada “Response body (200)”Content-Type: application/json
{ "access_token": "eyJraWQiOiJtb3J1cy0xIiwiYWxnIjoiUlMyNTYifQ...", "token_type": "Bearer", "expires_in": 899, "scope": "ri:rental-insurances:read ri:rental-insurances:write"}Exemplo interativoMonte e teste esta requisição
Credenciais
cURL
Response
Response headers
Response body
Consultar a credencial autenticada
Seção intitulada “Consultar a credencial autenticada”GET/v1/me
Retorna a identidade, a imobiliária, os papéis, os escopos e a expiração da credencial representada pelo token Bearer.
- Produção:
https://api.avillus.com.br/identity - Sandbox:
https://api-sandbox.avillus.com.br/identity
Responses
Seção intitulada “Responses”| Status | Description | Response headers |
|---|---|---|
| 200 | Credencial autenticada | — |
| 401 | Token Bearer ausente, inválido, expirado ou revogado | — |
Response body (200)
Seção intitulada “Response body (200)”Content-Type: application/json
{ "clientId": "client_boa_vista_01", "name": "Integração ERP", "realEstateCompany": { "id": 42, "name": "Imobiliária Boa Vista Ltda.", "tradeName": "Imobiliária Boa Vista", "cnpj": "12345678000190" }, "roles": [ "ROLE_ADMINISTRATIVE" ], "scopes": [ "ri:rental-insurances:read", "ri:rental-insurances:write" ], "expiresAt": "2026-09-15T21:15:00Z"}Exemplo interativoMonte e teste esta requisição
Credenciais
cURL
Response
Response headers
Response body
Data models
Seção intitulada “Data models”TokenRequest
Seção intitulada “TokenRequest”| Field | Type | Required | Description |
|---|---|---|---|
grant_type |
string |
yes | — |
scope |
string |
no | Subconjunto dos escopos concedidos à credencial, separado por espaços. |
TokenResponse
Seção intitulada “TokenResponse”| Field | Type | Required | Description |
|---|---|---|---|
access_token |
string |
yes | — |
token_type |
string |
yes | — |
expires_in |
integer |
yes | — |
scope |
string |
no | Escopos presentes no token, separados por espaços. |
OAuthError
Seção intitulada “OAuthError”| Field | Type | Required | Description |
|---|---|---|---|
error |
string |
yes | — |
error_description |
string |
no | — |
error_uri |
string (uri) |
no | — |
ApiCaller
Seção intitulada “ApiCaller”| Field | Type | Required | Description |
|---|---|---|---|
clientId |
string |
yes | — |
name |
string |
yes | — |
realEstateCompany |
ApiCallerCompany |
yes | — |
roles |
array<string> |
yes | — |
scopes |
array<string> |
yes | — |
expiresAt |
string (date-time) |
yes | — |
ApiCallerCompany
Seção intitulada “ApiCallerCompany”| Field | Type | Required | Description |
|---|---|---|---|
id |
integer (int64) |
yes | — |
name |
string |
yes | — |
tradeName |
string | null |
yes | — |
cnpj |
string |
yes | — |