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

# Replay a retained trace artifact or restore a native-session projection

> Requires runs:write and an interactive tenant owner session. One terminal run per request, limited to 10 attempts per tenant per minute including retries and failures. Projection and result commit atomically; no artifacts are deleted. Retry failed requests with the same requestId. Conflicting reuse is rejected. Missing bytes cannot be recovered. Does not change the source declaration of an active or future run.

Requires the runs:write scope.

An interactive owner session is required; bearer tokens cannot call this operation.



## OpenAPI

````yaml /openapi.yaml post /api/v1/runs/{runId}/trace/replay
openapi: 3.1.0
info:
  title: Factorize API
  version: 1.0.0
  description: >-
    Versioned Factorize REST API. See the hosted docs for examples and OAuth
    discovery.
  x-dashboard-auth: >-
    Access-token and authorized-client management and trace replay operations
    require an interactive owner session; all other operations accept a suitably
    scoped bearer token or owner session.
servers:
  - url: https://app.factorize.sh
security:
  - bearerAuth: []
paths:
  /api/v1/runs/{runId}/trace/replay:
    post:
      tags:
        - runs
      summary: Replay a retained trace artifact or restore a native-session projection
      description: >-
        Requires runs:write and an interactive tenant owner session. One
        terminal run per request, limited to 10 attempts per tenant per minute
        including retries and failures. Projection and result commit atomically;
        no artifacts are deleted. Retry failed requests with the same requestId.
        Conflicting reuse is rejected. Missing bytes cannot be recovered. Does
        not change the source declaration of an active or future run.


        Requires the runs:write scope.


        An interactive owner session is required; bearer tokens cannot call this
        operation.
      operationId: post_api_v1_runs_runId_trace_replay
      parameters:
        - name: runId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TraceReplayRequest'
      responses:
        '200':
          description: Durable replay result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraceReplayResult'
        '400':
          $ref: '#/components/responses/Error400'
          description: Invalid request
        '401':
          $ref: '#/components/responses/Error401'
          description: Invalid owner session
        '403':
          $ref: '#/components/responses/Error403'
          description: Missing runs:write scope or interactive owner session
        '404':
          $ref: '#/components/responses/Error404'
          description: Run not found within the tenant
        '409':
          $ref: '#/components/responses/Error409'
          description: Request ID conflict or artifact ownership/checksum mismatch
        '415':
          $ref: '#/components/responses/Error415'
        '429':
          $ref: '#/components/responses/Error429'
          description: Tenant rate limit reached; wait one minute before retrying
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'
          description: Artifact storage unavailable
      security:
        - bearerAuth: []
components:
  schemas:
    TraceReplayRequest:
      type: object
      properties:
        requestId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            Tenant-scoped idempotency key; preserve it when retrying. Use a new
            key to reconsider a previously skipped or unrecoverable run.
        source:
          default: primary
          description: >-
            Primary replays the persisted source declaration (native for
            historical runs); native_session selects retained native bytes for
            other providers or historical native-only Codex runs. Canonical
            Codex runs reject native replay.
          type: string
          enum:
            - primary
            - native_session
      required:
        - requestId
      additionalProperties: false
    TraceReplayResult:
      type: object
      required:
        - requestId
        - runId
        - status
      properties:
        requestId:
          type: string
          format: uuid
        runId:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - projected
            - already_projected
            - skipped
            - unrecoverable
        reason:
          type: string
          enum:
            - run_active
            - ambiguous_artifacts
            - missing_artifact
            - unsupported_artifact
            - artifact_not_retained
        sourceKind:
          type: string
          enum:
            - execution_stream
            - native_session
        sha256:
          type: string
        parserVersion:
          type: string
        reconciliation:
          type: object
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
  responses:
    Error400:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error401:
      description: Invalid or revoked credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error403:
      description: Missing scope or required owner session
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error404:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error409:
      description: Operation conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error415:
      description: Unsupported media type; use application/json
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error429:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error500:
      description: Internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error503:
      description: Service unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: OAuth2

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.