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

# Atualizar token de acesso

Os tokens de acesso são válidos por 60 minutos. Use este endpoint com um token de atualização válido para obter um novo token de acesso sem enviar suas credenciais novamente.

> **Expiração do token de atualização**
>
> Os tokens de atualização expiram após 120 minutos. Após esse período, solicite um novo token com [Obter token de acesso](https://docs.localpayment.com/pt-br/reference/get-token.md) usando seu nome de usuário e senha.

> **Rotação de tokens**
>
> Cada atualização bem-sucedida retorna um novo par de `access` e `refresh`, e o token de atualização que você enviou deixa de funcionar. Armazene os dois novos tokens e use o novo token de atualização na próxima vez.
>
> Uma nova requisição a [Obter token de acesso](https://docs.localpayment.com/pt-br/reference/get-token.md) também invalida os tokens de atualização emitidos antes dela para o mesmo usuário e integração (mesmo `User-Agent`).

> **401 Invalid or expired token**
>
> Esta resposta significa que o token de atualização expirou ou já foi invalidado. Não repita o mesmo token de atualização. Solicite um novo token com [Obter token de acesso](https://docs.localpayment.com/pt-br/reference/get-token.md).


## OpenAPI

````yaml openapi/pt-br/localpayment.json POST /api/token/refresh/
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/token/refresh/:
    post:
      summary: Atualizar token de acesso
      operationId: refresh-token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                refresh:
                  type: string
                  description: >-
                    Token de atualização obtido da propriedade `refresh` na
                    resposta dos endpoints [Obter Token de
                    Acesso](/pt-br/reference/get-token) ou [Atualizar Token de
                    Acesso](/pt-br/reference/refresh-token).
              required:
                - refresh
              x-examples:
                Example 1:
                  refresh: '{{refresh}}'
            examples:
              200 - Refresh token:
                value:
                  refresh: >-
                    eyJ0eXAiOiJKV1QiLCJhbGccM5kYO7o4iOiJIU18jaiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTczNTMxOTkyOSwianRpIjoiZWUxMDE3MTUwY2JhNGM1NTg0MjYyZmRkZTdiOThiNGQiLCJ1c2VyX2lkIjoxMDAwLCJzdXBlcnVzZXIiOnRydWUsImlzX3N0YWZmIjp0cnVlLCJybaCIsImV4cCI62xlcyI6WyJBTEwiXSwiY291bnRyaWVzIjpbIkFMTCJdLCJjb21wYW55IjoiQUxMIiwiY2xpZW50X2NvZGUiOiJBNzaW9uTEwiLCJwZXJtaXcyI6W119.6siymomkQ72yMvHGU9sMCO4h-cxpNgQXor
              '':
                value:
                  refresh: string
              500 - Server error.:
                value: {}
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  refresh:
                    type: string
                    description: >-
                      Token de atualização usado para obter um novo token de
                      acesso.
                  access:
                    type: string
                    description: >-
                      Token de acesso usado para autenticar solicitações aos
                      serviços Localpayment. 
                required:
                  - refresh
                  - access
                x-examples:
                  Example 1:
                    refresh: >-
                      eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTczNTMyMTI5NSwianRpIjoiOGZhNmE4MTQyYmQ0NGNjNDhkNTFkOTJjY2I3NTVhZDgiLCJ1c2VyX2lkIjoxMDAwLCJzdXBlcnVzZXIiOnRydWUsImlzX3N0YWZmIjp0cnVlLCJvdHAiOjExMTExMSwicm9sZXMiOlsiQUxMIl0sImNvdW50cmllcyI6WyJBTEwiXSwiY29tcGFueSI6IkFMTCIsImNsaWVudF9jb2RlIjoiQUxMIiwicGVybWlzc2lvbnMiOltdfQ.hMDLZYfR7aMYrFOz3y3LyHnoNldTd38VY-jsqqvsv70
                    access: >-
                      eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzM1MjM1MTk1LCJqdGkiOiI3MzBiYTdiMzMyMGU0NWU2ODk4ZGRjNWVlODY1YzEyNSIsInVzZXJfaWQiOjEwMDAsInN1cGVydXNlciI6dHJ1ZSwiaXNfc3RhZmYiOnRydWUsIm90cCI6MTExMTExLCJyb2xlcyI6WyJBTEwiXSwiY291bnRyaWVzIjpbIkFMTCJdLCJjb21wYW55IjoiQUxMIiwiY2xpZW50X2NvZGUiOiJBTEwiLCJwZXJtaXNzaW9ucyI6W119.peiX9q9Vw7Qm4Gq962gsST2UKs8LCE3C3VSq2vm4Bn0
              examples:
                200 - Refresh token:
                  value:
                    refresh: >-
                      eyJ0eXAiOiJKV1QiLCJhbGccM5kYO7o4iOiJIU18jaiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTczNTMxOTkyOSwianRpIjoiZWUxMDE3MTUwY2JhNGM1NTg0MjYyZmRkZTdiOThiNGQiLCJ1c2VyX2lkIjoxMDAwLCJzdXBlcnVzZXIiOnRydWUsImlzX3N0YWZmIjp0cnVlLCJybaCIsImV4cCI62xlcyI6WyJBTEwiXSwiY291bnRyaWVzIjpbIkFMTCJdLCJjb21wYW55IjoiQUxMIiwiY2xpZW50X2NvZGUiOiJBNzaW9uTEwiLCJwZXJtaXcyI6W119.6siymomkQ72yMvHGU9sMCO4h-cxpNgQXor
                    access: >-
                      eyJ0eXAiOiJKV1QiLCJhbeyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiGciOiJIUzI1NiJ9.ZXhwIjoxNzM1MjM1MTk1LCJqdGkiOiI3MzBiYTdiMzMyMGU0NWU2ODk4ZGRjNWVlODY1YzEyNSIsInVzZXJfaWQiOjEwMDAsdXNlciI6dHJ1ZSwiaXNfc3RInN1cGVyhZmYiOnRydWUsIm90cCI6MTExMTExLCJyb2xlcyI6WyJBTEwiXSwiY291bnRyaWVzIjpbIkGUiOiJBTEwiLCJwZXJtaXNzaW9ucMTCJdLCJjb21wYW55IjoiQUxMIiwiY2xpZW50X2NvZyI6W119.peiX9q9Vw72UKs8LCE3C3VSq2vaQm4Gq962gsSTm4Bn0
        '401':
          description: Não autorizado
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Detalhes adicionais da resposta.
                required:
                  - detail
                x-examples:
                  Example 1:
                    detail: Invalid or expired token
              examples:
                401 - Invalid or expired token:
                  value:
                    detail: Invalid or expired token
        '429':
          description: Muitos pedidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Detalhes adicionais da resposta.
                required:
                  - detail
                x-examples:
                  Example 1:
                    detail: Request was throttled. Expected available in 30 seconds.
              examples:
                429 - Too many requests.:
                  value:
                    detail: Request was throttled. Expected available in 30 seconds.
                429 - Request was throttled.:
                  value:
                    detail: Request was throttled.
        '500':
          description: Erro do Servidor Interno
          content:
            text/html:
              schema:
                type: object
              examples:
                500 - Server error.:
                  value: |-
                    <!doctype html>
                    <html lang="en">

                    <head>
                    <title>Server Error (500)</title>
                    </head>

                    <body>
                    <h1>Server Error (500)</h1>
                    <p></p>
                    </body>

                    </html>
      security: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

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