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

# Rotate the metadata token

> Issues a new metadata access token for the filesystem and returns the full filesystem, including the new `meta_token` and credential-bearing `meta_url`. The previous token stops authenticating immediately; the metadata database and S3 bucket are unchanged. The request takes no body. Allowed while the filesystem is `ready` or `needs_format`; otherwise returns a `409`. Retrying with the same `Idempotency-Key` within 24 hours replays the original response — including the same token — instead of rotating again.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/edge-compute.yml post /storage/cloudfs/{id}/actions/rotate-meta-token
openapi: 3.1.0
info:
  title: Telnyx Edge Compute API
  version: 2.0.0
  description: API for Edge Compute key-value storage (namespaces and keys).
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /storage/cloudfs/{id}/actions/rotate-meta-token:
    post:
      tags:
        - cloudfs filesystems
      summary: Rotate the metadata token
      description: >-
        Issues a new metadata access token for the filesystem and returns the
        full filesystem, including the new `meta_token` and credential-bearing
        `meta_url`. The previous token stops authenticating immediately; the
        metadata database and S3 bucket are unchanged. The request takes no
        body. Allowed while the filesystem is `ready` or `needs_format`;
        otherwise returns a `409`. Retrying with the same `Idempotency-Key`
        within 24 hours replays the original response — including the same token
        — instead of rotating again.
      operationId: RotateCloudfsMetaToken
      parameters:
        - description: CloudFS filesystem ID
          name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - description: >-
            Unique key that makes the request idempotent (1-255 characters:
            letters, numbers, `_`, and `-`). Retrying with the same key within
            24 hours replays the original response (marked with an
            `Idempotent-Replayed: true` header) instead of repeating the action.
            Reusing a key with a different request returns a `422`; sending a
            key while the original request is still being processed returns a
            `409`.
          name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 255
            pattern: ^[A-Za-z0-9_-]+$
      responses:
        '200':
          description: >-
            New metadata token issued; the response includes the new
            `meta_token` and credential-bearing `meta_url`
          headers:
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudfsFilesystemResponseWrapper'
        '400':
          description: Bad request — missing or invalid `Idempotency-Key` header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/edge-compute_Errors'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/edge-compute_Errors'
        '404':
          description: CloudFS filesystem not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/edge-compute_Errors'
        '409':
          description: >-
            Conflict — the filesystem is not in a state that allows rotation
            (`status` is neither `ready` nor `needs_format`), or a request with
            this `Idempotency-Key` is still being processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/edge-compute_Errors'
        '422':
          description: >-
            Unprocessable entity — `id` is not a valid UUID, or the
            `Idempotency-Key` was already used for a different request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/edge-compute_Errors'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.storage.cloudfs.actions.rotateMetaToken('id');


            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.storage.cloudfs.actions.rotate_meta_token(
                "id",
            )
            print(response.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Storage.Cloudfs.Actions.RotateMetaToken(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    CloudfsFilesystemResponseWrapper response = client.storage()cloudfs()actions()rotateMetaToken("id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.storage.cloudfs.actions.rotate_meta_token("id")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->storage->cloudfs->actions->rotateMetaToken(
                'id',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx storage:cloudfs:actions rotate-meta-token \
              --api-key 'My API Key' \
              --id id
components:
  headers:
    IdempotentReplayed:
      description: >-
        Present with value `true` when Edge replayed a stored successful
        response for the supplied Idempotency-Key. Omitted for first-time
        requests and error responses.
      schema:
        type: boolean
        enum:
          - true
        example: true
  schemas:
    CloudfsFilesystemResponseWrapper:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CloudfsFilesystem'
    edge-compute_Errors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/edge-compute_Error'
    GenericErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/edge-compute_Error'
    CloudfsFilesystem:
      type: object
      description: >-
        A CloudFS filesystem, including its metadata credential. This shape is
        returned only by create and rotate-meta-token.
      properties:
        record_type:
          type: string
          example: cloudfs
        id:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          example: agent-fs
        status:
          $ref: '#/components/schemas/CloudfsFilesystemStatus'
        meta_url:
          type: string
          description: >-
            PostgreSQL connection URL for the filesystem's metadata database. In
            create and rotate-meta-token responses it embeds the metadata token
            as the password:
            `postgres://<database>:<meta_token>@us-east-1.telnyxcloudfs.com:5432/<database>?sslmode=require`
            (the example below is shown without the credential; the actual
            response includes it). Pass it to `juicefs mount`: the storage
            configuration is baked in at provisioning, so the metadata URL is
            all a client needs to mount the filesystem.
          example: >-
            postgres://fs_0123456789abcdef@us-east-1.telnyxcloudfs.com:5432/fs_0123456789abcdef?sslmode=require
        meta_token:
          type: string
          description: >-
            Metadata access token, in cleartext. Returned only by create and
            rotate-meta-token and not retrievable afterwards — store it
            securely.
          example: cloudfs_tok_0123456789abcdef0123456789abcdef
        s3_endpoint:
          type: string
          description: URL of the Telnyx Cloud Storage endpoint backing this filesystem.
          example: https://us-east-1.telnyxcloudstorage.com
        s3_bucket:
          type: string
          description: >-
            Name of the bucket that stores this filesystem's data. Created
            during provisioning.
          example: cloudfs-fs-0123456789abcdef
        region:
          type: string
          example: us-east-1
        created_at:
          type: string
          format: date-time
          example: '2026-07-14T21:42:01Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-07-14T21:42:01Z'
    edge-compute_Error:
      type: object
      properties:
        code:
          type: string
          example: '10005'
        detail:
          type: string
          example: The requested function does not exist or you don't have access to it
        meta:
          $ref: '#/components/schemas/ErrorMeta'
        source:
          $ref: '#/components/schemas/ErrorSource'
        title:
          type: string
          example: Function not found
    CloudfsFilesystemStatus:
      type: string
      description: >-
        Lifecycle status of the filesystem. `ready` means it is fully
        provisioned and usable. `needs_format` means the storage bucket and
        metadata database were provisioned but the filesystem has not yet been
        formatted — run `juicefs format` with the filesystem's `meta_url` before
        mounting. `failed` means the last lifecycle action failed — see the
        filesystem's `error` message. `deleted` appears only in the delete
        response: deleted filesystems are excluded from list results and return
        a `404` on retrieval.
      enum:
        - provisioning
        - ready
        - needs_format
        - deleting
        - failed
        - deleted
      example: ready
    ErrorMeta:
      type: object
      properties:
        url:
          type: string
          example: https://docs.telnyx.com/api/errors/10005
    ErrorSource:
      type: object
      properties:
        parameter:
          type: string
          example: id
        pointer:
          type: string
          example: /id
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````