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

# Refresh an access token

> Exchanges the refresh token in the `Authorization` header for a new access token. Every refresh also returns a new refresh token and the one you sent stops being the current token, so store the new refresh token and use it for the next refresh. A retry of the same request shortly after a refresh returns the same new token.



## OpenAPI

````yaml /api-reference/cloud-platform-openapi.json post /v1/users/me/access-tokens
openapi: 3.1.0
info:
  description: Account, organization, workspace and billing routes of NEAR AI Cloud.
  title: NEAR AI Cloud Platform API
  version: '5'
servers:
  - url: https://cloud-platform.near.ai
    description: NEAR AI Cloud Platform
security: []
paths:
  /v1/users/me/access-tokens:
    post:
      tags:
        - Authentication
      summary: Refresh an access token
      description: >-
        Exchanges the refresh token in the `Authorization` header for a new
        access token. Every refresh also returns a new refresh token and the one
        you sent stops being the current token, so store the new refresh token
        and use it for the next refresh. A retry of the same request shortly
        after a refresh returns the same new token.
      operationId: create_access_token
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessTokenResponse'
          description: A new access token and a new refresh token.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            The refresh token is missing, invalid, expired or already replaced.
            A token that was already replaced gets an error body; a missing or
            invalid one gets an empty body.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal error.
      security:
        - refresh_token: []
components:
  schemas:
    AccessTokenResponse:
      description: A new access token and the refresh token that replaces the one sent.
      properties:
        access_token:
          description: 'Access token, sent as `Authorization: Bearer <token>`.'
          type: string
        refresh_token:
          description: >-
            The new refresh token, beginning with `rt_`. Store it: the refresh
            token you sent is replaced and the next refresh must use this one.
          type: string
        refresh_token_expiration:
          description: When the new refresh token expires.
          format: date-time
          type: string
      required:
        - access_token
        - refresh_token
        - refresh_token_expiration
      type: object
    ErrorResponse:
      description: The body of every error answer on the user routes.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      type: object
    ErrorDetail:
      properties:
        code:
          type:
            - string
            - 'null'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        type:
          type: string
      required:
        - message
        - type
      type: object
  securitySchemes:
    refresh_token:
      bearerFormat: rt_
      description: >-
        Refresh token beginning with `rt_`, sent as `Authorization: Bearer
        <token>`.
      scheme: bearer
      type: http

````

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