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

# Refresh the M2M access token

> Rotate the access token for the active machine-to-machine session using the refresh token



## OpenAPI

````yaml /swagger.json post /v1/apps/{app_id}/m2m/refresh
openapi: 3.0.1
info:
  title: Scute API
  version: v1
  description: API for managing users in Scute applications
servers:
  - url: https://{defaultHost}
    variables:
      defaultHost:
        default: api.scute.io
  - url: http://localhost:3333
    description: Development server
security:
  - apiSecret: []
    userAccess: []
paths:
  /v1/apps/{app_id}/m2m/refresh:
    parameters:
      - name: app_id
        in: path
        required: true
        description: App ID
        schema:
          type: string
    post:
      tags:
        - M2M Sessions
      summary: Refresh the M2M access token
      description: >-
        Rotate the access token for the active machine-to-machine session using
        the refresh token
      operationId: refreshM2mToken
      parameters:
        - name: Authorization
          in: header
          required: true
          description: M2M access token
          schema:
            type: string
        - name: X-CSRF-Token
          in: header
          required: false
          description: CSRF token required when refresh tokens are stored in cookies
          schema:
            type: string
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  access:
                    type: string
                    description: Newly issued JWT access token
                  access_expires_at:
                    type: string
                    format: date-time
                    description: Timestamp when the new access token expires
                  refresh:
                    type: string
                    nullable: true
                    description: Refresh token if the app uses refresh payloads
                  refresh_expires_at:
                    type: string
                    format: date-time
                    nullable: true
                    description: Timestamp when the refresh token expires
                  csrf:
                    type: string
                    description: CSRF token to pair with cookie-based refresh tokens
                required:
                  - access
                  - access_expires_at
                  - csrf
        '401':
          description: unauthorized - refresh failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Token refresh failed
                  error_code:
                    type: string
                    nullable: true
                required:
                  - error
components:
  securitySchemes:
    apiSecret:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API Secret token
    userAccess:
      type: apiKey
      name: X-Authorization
      in: header
      description: User Access token

````