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

# Actualizar token de acceso

Los tokens de acceso son válidos durante 60 minutos. Usa este endpoint con un token de actualización válido para obtener un nuevo token de acceso sin volver a enviar tus credenciales.

> **Caducidad del token de actualización**
>
> Los tokens de actualización caducan a los 120 minutos. Transcurrido este tiempo, solicita un nuevo token con [Obtener token de acceso](https://docs.localpayment.com/es/reference/get-token.md) usando tu nombre de usuario y contraseña.

> **Rotación de tokens**
>
> Cada actualización correcta devuelve un nuevo par de `access` y `refresh`, y el token de actualización que enviaste deja de funcionar. Guarda ambos tokens nuevos y usa el nuevo token de actualización la próxima vez.
>
> Una nueva solicitud a [Obtener token de acceso](https://docs.localpayment.com/es/reference/get-token.md) también invalida los tokens de actualización emitidos antes para el mismo usuario e integración (mismo `User-Agent`).

> **401 Invalid or expired token**
>
> Esta respuesta significa que el token de actualización caducó o ya se invalidó. No reintentes con el mismo token de actualización. Solicita un nuevo token con [Obtener token de acceso](https://docs.localpayment.com/es/reference/get-token.md).


## OpenAPI

````yaml openapi/es/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: Actualizar token de acceso
      operationId: refresh-token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                refresh:
                  type: string
                  description: >-
                    Token de actualización obtenido de la propiedad `refresh` en
                    la respuesta de los endpoints [Obtener token de
                    acceso](/es/reference/get-token) o [Actualizar token de
                    acceso](/es/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 actualización utilizado para obtener un nuevo
                      token de acceso.
                  access:
                    type: string
                    description: >-
                      Token de acceso utilizado para autenticar las solicitudes
                      a los servicios de 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: No autorizado
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Detalles adicionales de la respuesta.
                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: Demasiadas peticiones
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Detalles adicionales de la respuesta.
                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: Error Interno del Servidor
          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.