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

# Preview version restore

> Compute what restoring this version would change, without applying anything.

The preview returns the changed fields, any configuration issues, and the
hashes needed to accept the restore: copy `acceptance_hash` from the preview
and `candidate_hash`, `resource_hash`, and `dependency_hash` from its
`preparation` object into the accept request. The request body is optional;
when `restore_historical_name` is set here it must be sent with the same value
on accept.




## OpenAPI

````yaml /api-reference/agents/agents.oas.yaml post /v1/agents/{agent_id}/versions/{version_number}/restore/preview
openapi: 3.0.3
info:
  title: SLNG Voice Agents API
  version: 1.0.0
  description: >
    Public API for managing Voice Agents, dispatching outbound calls, and
    creating web (non-telephony) sessions.


    Base URL: `https://api.agents.slng.ai`
  contact:
    name: SLNG Support
    email: support@slng.ai
servers:
  - url: https://api.agents.slng.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: Voice agent CRUD.
  - name: Versions
    description: Agent configuration version history and restore.
  - name: Calls
    description: Call dispatch and status.
  - name: Sessions
    description: Web (non-telephony) sessions.
paths:
  /v1/agents/{agent_id}/versions/{version_number}/restore/preview:
    parameters:
      - $ref: '#/components/parameters/AgentIdPath'
      - $ref: '#/components/parameters/VersionNumberPath'
    post:
      tags:
        - Versions
      summary: Preview version restore
      description: >
        Compute what restoring this version would change, without applying
        anything.


        The preview returns the changed fields, any configuration issues, and
        the

        hashes needed to accept the restore: copy `acceptance_hash` from the
        preview

        and `candidate_hash`, `resource_hash`, and `dependency_hash` from its

        `preparation` object into the accept request. The request body is
        optional;

        when `restore_historical_name` is set here it must be sent with the same
        value

        on accept.
      operationId: previewAgentVersionRestore
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentConfigRestoreOptions'
      responses:
        '200':
          description: >-
            Restore preview. Check `state` — `ready` previews can be accepted;
            `failed` previews list blocking `issues`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentConfigRestorePreview'
        '202':
          description: >
            The restored config references organisation resources that require

            resolution before it can be activated. Retry the preview after the
            delay

            indicated by the `Retry-After` header.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Suggested delay in seconds before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentConfigRestorePreview'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          description: Conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                history-unsafe:
                  summary: Historical config cannot be activated safely
                  value:
                    detail: The historical AgentConfig cannot be activated safely.
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    AgentIdPath:
      name: agent_id
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/UUID'
      description: Voice agent ID.
    VersionNumberPath:
      name: version_number
      in: path
      required: true
      schema:
        type: integer
        minimum: 1
      description: Agent config version number.
  schemas:
    AgentConfigRestoreOptions:
      type: object
      additionalProperties: false
      properties:
        restore_historical_name:
          type: boolean
          default: false
          description: |
            When `true`, also restore the agent name recorded in the version. By
            default the agent keeps its current name.
    AgentConfigRestorePreview:
      type: object
      required:
        - state
        - restore_kind
        - target_version
        - target_version_id
        - current_version
        - current_version_id
        - current_config_hash
        - target_config_hash
      properties:
        state:
          type: string
          enum:
            - ready
            - preparing
            - failed
          description: >
            - `ready`: the restore can be accepted with the returned hashes.

            - `preparing`: referenced organisation resources are still being
            resolved; retry the preview.

            - `failed`: the restore is blocked by the listed `issues`.
        restore_kind:
          type: string
          enum:
            - exact
        target_version:
          type: integer
          description: Version number being restored.
        target_version_id:
          $ref: '#/components/schemas/UUID'
        current_version:
          type: integer
          nullable: true
          description: The agent's latest version number.
        current_version_id:
          $ref: '#/components/schemas/UUID'
          nullable: true
        current_config_hash:
          type: string
          description: Content hash of the agent's current config.
        target_config_hash:
          type: string
          description: Content hash of the version being restored.
        candidate_config_hash:
          type: string
          nullable: true
          description: Content hash of the config that would be applied.
        acceptance_hash:
          type: string
          nullable: true
          description: >-
            Opaque hash binding this preview; pass it unchanged to the accept
            endpoint. Present when `state` is `ready`.
        changed_fields:
          type: array
          items:
            type: string
          description: Top-level config fields that would change.
        issues:
          type: array
          items:
            $ref: '#/components/schemas/DependencyIssue'
        preparation:
          $ref: '#/components/schemas/AgentConfigPreparationStatus'
          nullable: true
          description: >-
            Source of `candidate_hash`, `resource_hash`, and `dependency_hash`
            for the accept request.
        candidate:
          $ref: '#/components/schemas/AgentConfigDocument'
          nullable: true
          description: The config document that would be applied.
    ErrorResponse:
      type: object
      additionalProperties: true
      description: >
        Error payloads can vary depending on where the error is raised (edge
        gateway vs backend).


        Common shapes include:

        - `{ "error": "message" }`

        - `{ "detail": "message" }`

        - `{ "detail": [ { "loc": [...], "msg": "...", "type": "..." } ] }`
        (validation)
      properties:
        error:
          type: string
        detail:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
    UUID:
      type: string
      format: uuid
      example: 550e8400-e29b-41d4-a716-446655440000
    DependencyIssue:
      type: object
      additionalProperties: false
      required:
        - path
        - code
        - resource_type
        - message
      properties:
        path:
          type: string
          description: Path of the config field the issue relates to.
        code:
          type: string
        resource_type:
          type: string
        resource_id:
          type: string
          nullable: true
        message:
          type: string
        remediation:
          type: string
          nullable: true
      description: >-
        A dependency issue detected while validating an agent config document
        against the organisation's current resources.
    AgentConfigPreparationStatus:
      type: object
      required:
        - state
        - candidate_hash
        - resource_hash
        - config
      properties:
        state:
          type: string
          enum:
            - ready
            - preparing
            - failed
        candidate_hash:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: Content hash of the prepared config document.
        resource_hash:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: Hash of the organisation resources the config depends on.
        dependency_hash:
          type: string
          pattern: ^[0-9a-f]{64}$
          nullable: true
        preparation_operation_id:
          type: string
          nullable: true
        retry_after_seconds:
          type: integer
          minimum: 1
          maximum: 60
          nullable: true
          description: >-
            Suggested delay in seconds before retrying (also sent as the
            `Retry-After` header).
        config:
          $ref: '#/components/schemas/AgentConfigDocument'
      description: >
        Status returned while a config document references organisation
        resources

        that require resolution before it can be activated.
    AgentConfigDocument:
      type: object
      additionalProperties: true
      description: >
        Canonical agent configuration document, exactly as produced by the agent

        config download endpoints. The document is a portable, secret-free

        representation of the agent's configuration; webhook auth is carried as

        organisation Vault secret references. Treat it as an opaque file:
        download,

        store, and re-import it without modification.
  responses:
    UnauthorizedError:
      description: Unauthorized.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized:
              summary: Authentication failed
              value:
                detail: Authentication is required for this endpoint.
    ForbiddenError:
      description: Forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            forbidden:
              summary: Access denied
              value:
                detail: You do not have access to this resource.
    NotFoundError:
      description: Not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            not-found:
              summary: Resource not found
              value:
                detail: The requested resource was not found.
    ValidationError:
      description: Validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            validation-error:
              summary: Request validation failed
              value:
                detail:
                  - loc:
                      - body
                      - language
                    msg: Input should be a valid string
                    type: string_type
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal-server-error:
              summary: Unexpected application error
              value:
                detail: An unexpected internal error occurred.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````