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

# Rinnovare il token di accesso

I token di accesso sono validi per 60 minuti. Usa questo endpoint con un refresh token valido per ottenere un nuovo token di accesso senza inviare di nuovo le tue credenziali.

> **Scadenza del refresh token**
>
> I refresh token scadono dopo 120 minuti. Trascorso questo periodo, richiedi un nuovo token con [Ottenere il token di accesso](https://docs.localpayment.com/it/reference/get-token.md) usando il tuo nome utente e la tua password.

> **Rotazione dei token**
>
> Ogni rinnovo riuscito restituisce una nuova coppia `access` e `refresh`, e il refresh token che hai inviato smette di funzionare. Salva entrambi i nuovi token e usa il nuovo refresh token la volta successiva.
>
> Anche una nuova richiesta a [Ottenere il token di accesso](https://docs.localpayment.com/it/reference/get-token.md) invalida i refresh token emessi in precedenza per lo stesso utente e la stessa integrazione (stesso `User-Agent`).

> **401 Invalid or expired token**
>
> Questa risposta indica che il refresh token è scaduto o è già stato invalidato. Non riprovare con lo stesso refresh token. Richiedi un nuovo token con [Ottenere il token di accesso](https://docs.localpayment.com/it/reference/get-token.md).


## OpenAPI

````yaml openapi/it/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: Rinnovare il token di accesso
      operationId: refresh-token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                refresh:
                  type: string
                  description: >-
                    Refresh token ottenuto dalla proprietà `refresh` nella
                    risposta degli endpoint [Ottenere il token di
                    accesso](/it/reference/get-token) o [Rinnovare il token di
                    accesso](/it/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: >-
                      Refresh token usato per ottenere un nuovo token di
                      accesso.
                  access:
                    type: string
                    description: >-
                      Token di accesso usato per autenticare le richieste ai
                      servizi di 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: Non autorizzato
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Dettagli aggiuntivi della risposta.
                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: Troppe richieste
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Dettagli aggiuntivi della risposta.
                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: Errore interno del server
          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.