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

# Refresh EcoMail Hub token

> Rotate the EcoMail Hub access and refresh tokens. The old refresh token is revoked on success, and the response returns the replacement token pair.



## OpenAPI

````yaml /api/ecomailhub.openapi.yaml post /auth/refresh
openapi: 3.1.0
info:
  title: YouNegotiate EcoMail Hub API
  version: '2.0'
  description: Stateless API endpoints for EcoMail Hub / EcoPortal users.
servers:
  - url: https://api.ecomailhub.younegotiate.com
    description: Production
security: []
tags:
  - name: System
    description: Public EcoMail Hub domain system and health endpoints.
  - name: Authentication
    description: EcoMail Hub login, logout, password reset, and password change endpoints.
  - name: Profile
    description: Authenticated EcoMail Hub user profile endpoints.
  - name: Dashboard
    description: EcoMail Hub dashboard summary and notice-response bucket endpoints.
  - name: Manage Consumers
    description: >-
      EcoMail Hub consumer identity grouping and notice-response count
      endpoints.
  - name: Manage Creditors
    description: >-
      EcoMail Hub creditor profile and company-only member profile table
      endpoints.
  - name: Import Creditor Profiles
    description: EcoMail Hub creditor profile CSV import endpoints.
  - name: Manage Notice Response
    description: >-
      EcoMail Hub top-level notice-response review, reassignment, and close
      endpoints.
  - name: Manage Users
    description: EcoMail Hub user account management endpoints.
  - name: Reports
    description: EcoMail Hub one-time and scheduled CSV report endpoints.
  - name: Communications
    description: EcoMail Hub communication template editor endpoints.
paths:
  /auth/refresh:
    post:
      tags:
        - Authentication
      summary: Refresh EcoMail Hub token
      description: >-
        Rotate the EcoMail Hub access and refresh tokens. The old refresh token
        is revoked on success, and the response returns the replacement token
        pair.
      operationId: ecomailhubRefreshToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefreshTokenRequest'
            example:
              refresh_token: refresh-token
      responses:
        '200':
          description: Token refreshed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefreshTokenResponse'
              example:
                message: Token refreshed.
                meta:
                  access_token: 1|new-access-token
                  refresh_token: new-refresh-token
                  token_type: Bearer
                  access_token_expires_at: '2026-06-05T13:00:00.000000Z'
                  refresh_token_expires_at: '2026-07-05T12:00:00.000000Z'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    RefreshTokenRequest:
      type: object
      required:
        - refresh_token
      properties:
        refresh_token:
          type: string
    RefreshTokenResponse:
      type: object
      required:
        - message
        - meta
      properties:
        message:
          type: string
          example: Token refreshed.
        meta:
          type: object
          required:
            - access_token
            - refresh_token
            - token_type
            - access_token_expires_at
            - refresh_token_expires_at
          properties:
            access_token:
              type: string
            refresh_token:
              type: string
              description: >-
                Plaintext refresh token returned once. Store securely and send
                to POST /auth/refresh.
            token_type:
              type: string
              example: Bearer
            access_token_expires_at:
              type:
                - string
                - 'null'
              format: date-time
              description: >-
                Access token expiry timestamp when an expiry is assigned;
                otherwise null.
            refresh_token_expires_at:
              type: string
              format: date-time
    MessageResponse:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ValidationErrorResponse:
      type: object
      required:
        - message
        - errors
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthenticated:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
          example:
            message: Unauthenticated.
    ValidationError:
      description: Request validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
          example:
            message: The given data was invalid.
            errors:
              email:
                - The email field is required.

````