> For the complete documentation index, see [llms.txt](https://developershub2b.gitbook.io/hub2b-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developershub2b.gitbook.io/hub2b-api/api-para-seller-erp-ecommerce/autenticacao.md).

# Autenticação

Você pode obter um token de acesso realizando a request abaixo:

{% code title="Autenticação" fullWidth="false" %}

```
curl --location --request POST 'https://rest.hub2b.com.br/oauth2/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": "{cliente_id}",
"client_secret": "{client_secret}",
"grant_type": "password",
"scope": "inventory orders catalog",
"username": "{username}",
"password": "{password}"
}'
```

{% endcode %}

Essa requisição retorna um **access\_token**, que deve ser utilizado em todas as requisições da API V2, passando via **parâmetro** na URL.

```
{
    "refresh_token": "string",
    "token_type": "bearer",
    "access_token": "string",
    "expires_in": 7200
}
```

A API tem uma **limitação de 30 logins diários**, sendo que para gerar um novo token é mais eficiente utilizar o **refresh\_token** para ganhar mais 2 horas de acesso no novo **access\_token**.\
\
Para isto, basta renovar o token em[ ​/oauth2​/token](https://rest.hub2b.com.br/oauth2/token) que é uma rota disponível em todos nossos recursos. E sempre enviando os seguintes dados:

```
{
  "client_id": "string",
  "grant_type": "refresh_token",
  "client_secret": "string",
  "refresh_token": "string"
}
```


---

# 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:

```
GET https://developershub2b.gitbook.io/hub2b-api/api-para-seller-erp-ecommerce/autenticacao.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.
