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

# Regenerate Simulation Token

> Replaces the Simulation's token, including while the Simulation is stopped. When the replacement commits, requests with the previous token return 401 auth_invalid with X-Continuous-Simulation-Token-Rejected: true. Reuse the Idempotency-Key to retry safely.



## OpenAPI

````yaml /openapi/simulation.yaml post /v1/simulations/{id}/token/regenerate
openapi: 3.1.0
info:
  description: >-
    Build Simulators from OpenAPI or WSDL documents, create Simulations from
    them, and build Worlds that run Simulations together. Authenticate every
    request with an API key sent as a Bearer token.
  title: Continuous Simulation API
  version: v1
servers:
  - description: Continuous production API.
    url: https://api.continuouslabs.ai
security: []
tags:
  - description: >-
      Build Simulators from OpenAPI or WSDL documents, check or cancel a build,
      and delete Simulators.
    name: simulators
    x-group: Simulators
  - description: >-
      Create Simulations from ready Simulators, then fork, stop, start, and
      delete them.
    name: simulations
    x-group: Simulations
  - description: >-
      Build Worlds from one or more Simulators and start or stop their
      Simulations together.
    name: worlds
    x-group: Worlds
paths:
  /v1/simulations/{id}/token/regenerate:
    post:
      tags:
        - simulations
      summary: Regenerate Simulation Token
      description: >-
        Replaces the Simulation's token, including while the Simulation is
        stopped. When the replacement commits, requests with the previous token
        return 401 auth_invalid with X-Continuous-Simulation-Token-Rejected:
        true. Reuse the Idempotency-Key to retry safely.
      operationId: regenerate-simulation-token
      parameters:
        - description: Simulation ID.
          in: path
          name: id
          required: true
          schema:
            pattern: ^sim_[0-9A-HJKMNP-TV-Z]{26}$
            type: string
        - description: Stable key for this regeneration request.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CurrentSimulationToken'
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          content:
            application/problem+json:
              examples:
                auth_forbidden_simulation:
                  $ref: '#/components/examples/auth_forbidden_simulation'
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              examples:
                simulation_not_found:
                  $ref: '#/components/examples/simulation_not_found'
              schema:
                $ref: '#/components/schemas/Error'
          description: Not Found
        '409':
          content:
            application/problem+json:
              examples:
                simulation_platform_owned:
                  $ref: '#/components/examples/simulation_platform_owned'
                simulation_token_regeneration_superseded:
                  $ref: >-
                    #/components/examples/simulation_token_regeneration_superseded
              schema:
                $ref: '#/components/schemas/Error'
          description: Conflict
        '422':
          content:
            application/problem+json:
              examples:
                validation_idempotency_key:
                  $ref: '#/components/examples/validation_idempotency_key'
              schema:
                $ref: '#/components/schemas/Error'
          description: Unprocessable Entity
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          content:
            application/problem+json:
              examples:
                simulation_unreachable:
                  $ref: '#/components/examples/simulation_unreachable'
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Gateway
        '503':
          content:
            application/problem+json:
              examples:
                auth_provider_unavailable:
                  $ref: '#/components/examples/auth_provider_unavailable'
                internal_unavailable:
                  $ref: '#/components/examples/internal_unavailable'
              schema:
                $ref: '#/components/schemas/Error'
          description: Service Unavailable
      security:
        - apiKeyAuth: []
components:
  schemas:
    CurrentSimulationToken:
      additionalProperties: false
      examples:
        - expires_at: null
          token: <redacted>
      properties:
        expires_at:
          deprecated: true
          description: >-
            Always null; Simulation tokens do not expire. Deprecated; will be
            removed.
          format: date-time
          type:
            - string
            - 'null'
        token:
          description: >-
            The Simulation's current token for requests to its endpoint. Send it
            in the X-Continuous-Simulation-Token header.
          minLength: 1
          type: string
      required:
        - token
        - expires_at
      type: object
    Error:
      additionalProperties: false
      properties:
        code:
          description: Stable machine-readable error code.
          minLength: 1
          type: string
        detail:
          description: Safe human-readable error detail.
          minLength: 1
          type: string
        validation:
          $ref: '#/components/schemas/SpecificationValidation'
          description: >-
            Safe specification diagnostics for a rejected build request, when
            available.
      required:
        - validation
        - code
        - detail
      type: object
    SpecificationValidation:
      additionalProperties: false
      properties:
        issues:
          description: Specification validation problems. At most 20 are returned.
          items:
            $ref: '#/components/schemas/SpecificationIssue'
          maxItems: 20
          type: array
      required:
        - issues
      type:
        - object
        - 'null'
    SpecificationIssue:
      additionalProperties: false
      properties:
        code:
          description: Stable validation rule code.
          type: string
        kind:
          description: >-
            Whether the input is invalid, unsupported, incomplete, or has no
            specific diagnosis.
          enum:
            - invalid
            - unsupported
            - incomplete
            - unknown
          type: string
        location:
          description: Readable endpoint or field affected by this issue.
          maxLength: 512
          type: string
        message:
          description: What needs attention at this location.
          type: string
        operation:
          description: >-
            Affected operation ID or method and path, when available. Empty for
            document-level issues.
          maxLength: 243
          type: string
        suggestion:
          description: How to correct or address the problem.
          type: string
      required:
        - code
        - operation
        - location
        - kind
        - message
        - suggestion
      type: object
  responses:
    Unauthorized:
      content:
        application/problem+json:
          examples:
            auth_invalid:
              $ref: '#/components/examples/auth_invalid'
            auth_missing:
              $ref: '#/components/examples/auth_missing'
          schema:
            $ref: '#/components/schemas/Error'
      description: Unauthorized
    InternalServerError:
      content:
        application/problem+json:
          examples:
            internal:
              $ref: '#/components/examples/internal'
          schema:
            $ref: '#/components/schemas/Error'
      description: Internal Server Error
  examples:
    auth_forbidden_simulation:
      value:
        code: auth_forbidden
        detail: >-
          The Simulation with ID "sim_01J8Z5X4K7M2N9P0Q1R2S3T4V6" belongs to
          another workspace.
        validation: null
    simulation_not_found:
      value:
        code: simulation_not_found
        detail: No Simulation was found with ID "sim_01J8Z5X4K7M2N9P0Q1R2S3T4V6".
        validation: null
    simulation_platform_owned:
      value:
        code: simulation_platform_owned
        detail: >-
          The Simulation with ID "sim_01J8Z5X4K7M2N9P0Q1R2S3T4V6" is in use by
          the platform and cannot be changed.
        validation: null
    simulation_token_regeneration_superseded:
      value:
        code: simulation_token_regeneration_superseded
        detail: >-
          A later regeneration replaced this token. Use a new Idempotency-Key to
          regenerate again.
        validation: null
    validation_idempotency_key:
      value:
        code: validation
        detail: Idempotency-Key must contain between 1 and 256 bytes
        validation: null
    simulation_unreachable:
      value:
        code: simulation_unreachable
        detail: The Simulation is still initializing. Retry shortly.
        validation: null
    auth_provider_unavailable:
      value:
        code: auth_provider_unavailable
        detail: >-
          The authentication provider is unavailable. Retry the request after a
          short delay.
        validation: null
    internal_unavailable:
      value:
        code: internal_unavailable
        detail: >-
          The service is temporarily unavailable. Retry the request after a
          short delay.
        validation: null
    auth_invalid:
      value:
        code: auth_invalid
        detail: The authentication credential is invalid.
        validation: null
    auth_missing:
      value:
        code: auth_invalid
        detail: Authentication credentials are required.
        validation: null
    internal:
      value:
        code: internal
        detail: The server encountered an unexpected error.
        validation: null
  securitySchemes:
    apiKeyAuth:
      bearerFormat: Continuous API key
      description: >-
        Use a Continuous API key. Send it in the Authorization header as a
        Bearer token.
      scheme: bearer
      type: http

````