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

# Refresh

> This endpoint takes the sub and a refresh token and returns an access token and refresh token.

The access token is to be used for all endpoints except for /token and /refresh.



## OpenAPI

````yaml openapi_2024-03-27 post /refresh
openapi: 3.1.0
info:
  title: FastAPI
  version: '2024-03-27'
servers:
  - url: https://api.pathstack.io
    description: PathStack production environment
security: []
paths:
  /refresh:
    post:
      tags:
        - Auth
      summary: Refresh
      description: >-
        This endpoint takes the sub and a refresh token and returns an access
        token and refresh token.


        The access token is to be used for all endpoints except for /token and
        /refresh.
      operationId: refresh_refresh_post
      parameters:
        - name: x-api-version
          in: header
          required: false
          schema:
            type: string
            format: date
            default: '2024-03-27'
            title: X-Api-Version
          examples:
            default:
              value: '2024-03-27'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefreshToken'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Success_RefreshResult_'
        '401':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 401
                        title: Error code
                      message:
                        type: string
                        example: Invalid Refresh Token
                        title: Error message
          description: Unauthorized
        '422':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 422
                        title: Error code
                      message:
                        type: string
                        example: Field required
                        title: Error message
                      loc:
                        items:
                          anyOf:
                            - type: string
                            - type: integer
                        type: array
                        title: Location
                      msg:
                        type: string
                        title: Message
                      type:
                        type: string
                        title: Error Type
          description: Unprocessable Entity
components:
  schemas:
    RefreshToken:
      properties:
        sub:
          type: string
          format: uuid4
          title: Sub
          description: The sub (subject) field returned in the login response.
        refresh_token:
          type: string
          title: Refresh Token
      type: object
      required:
        - sub
        - refresh_token
      title: RefreshToken
    Success_RefreshResult_:
      properties:
        data:
          $ref: '#/components/schemas/RefreshResult'
          description: Successful response payload
      type: object
      required:
        - data
      title: Success[RefreshResult]
    RefreshResult:
      properties:
        token_type:
          type: string
          title: Token Type
        expires_in:
          type: integer
          title: Expires In
        access_token:
          type: string
          title: Access Token
      type: object
      required:
        - token_type
        - expires_in
        - access_token
      title: RefreshResult

````