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

# Roll a flow back to an earlier version

> Make an older version current.

Nothing is overwritten: the old config is written as a **new** version, so the rollback is itself revertible and the record of what ran when stays intact. A version that no longer validates — its enrichment was deleted, its dataset changed — is refused with the reasons.

<Info>
  Nothing is overwritten. The old config is written as a **new** version, so the rollback is itself revertible and the record of what ran when stays intact — the response returns both the restored flow and the version the rollback created.
</Info>

<Warning>
  A version that no longer validates — its enrichment was deleted, its dataset changed — is refused with `400` and the reasons, rather than restoring a graph that would fail on every run.
</Warning>


## OpenAPI

````yaml POST /v1/flows/{flow_id}/versions/{number}/restore
openapi: 3.1.0
info:
  title: Databar.ai API
  description: >-

    # Authentication


    Databar uses API keys to allow access to the API. You can find your API key
    in your workspace home page, but to use the REST API you’ll first need to
    schedule a call with us.

    Our API expects the API key to be included in all API requests to the server
    in the Header of your request with the key `x-apikey`.

    To find your API key, head over to your Databar workspace and click
    Integrations.


    **Example:**


    `bash

    curl https://api.databar.ai/v1/user/me -H x-apikey: {YOUR_API_KEY}`
  contact:
    email: info@databar.ai
  version: 0.1.2
servers:
  - url: https://api.databar.ai
    description: Production
security: []
paths:
  /v1/flows/{flow_id}/versions/{number}/restore:
    post:
      tags:
        - Flows
      summary: Roll a flow back to an earlier version
      description: >-
        Make an older version current.


        Nothing is overwritten: the old config is written as a **new** version,
        so the rollback is itself revertible and the record of what ran when
        stays intact. A version that no longer validates — its enrichment was
        deleted, its dataset changed — is refused with the reasons.
      operationId: restore_flow_version_v1_flows__flow_id__versions__number__restore_post
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            title: Flow ID
          description: Flow identifier, e.g. `fl_ab12cd34`
        - name: number
          in: path
          required: true
          schema:
            type: integer
            title: Version number
          description: Version number from `GET /v1/flows/{flow_id}/versions`
        - name: x-apikey
          in: header
          required: true
          schema:
            type: string
            title: API Key
            description: API Key for authentication
          description: API Key for authentication
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreFlowVersionIn'
      responses:
        '200':
          description: The restored flow and the version the rollback created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestoreFlowVersionOut'
        '400':
          description: That version no longer validates; the message lists why
        '403':
          description: Forbidden
        '404':
          description: Flow or version not found
        '409':
          description: '`internal_version` is stale'
components:
  schemas:
    RestoreFlowVersionIn:
      properties:
        internal_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Internal Version
          description: Optional concurrency check, same semantics as on update.
      type: object
      title: RestoreFlowVersionIn
    RestoreFlowVersionOut:
      properties:
        flow:
          $ref: '#/components/schemas/FlowDetail'
        version:
          $ref: '#/components/schemas/FlowVersion'
      type: object
      required:
        - flow
        - version
      title: RestoreFlowVersionOut
    FlowDetail:
      description: >-
        A flow plus the pieces needed to edit it. `config` is the graph, `ui` is
        editor-only metadata the runtime ignores, and `internal_version` is the
        concurrency token you send back on a write.
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowInput'
          title: Inputs
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowOutput'
          title: Outputs
        config:
          type: object
          title: Config
          description: 'The flow definition: `inputs`, `nodes`, `output`.'
        ui:
          type: object
          title: Ui
          description: Editor-only metadata. The runtime never reads it.
        internal_version:
          type: string
          title: Internal Version
          description: >-
            Concurrency token. Send it back on PUT (required) and on PATCH when
            changing `config`.
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - id
        - name
        - description
        - inputs
        - outputs
        - config
        - ui
        - internal_version
        - created_at
        - updated_at
      title: FlowDetail
    FlowVersion:
      description: >-
        One saved version of a flow. The list arrives newest first, so the first
        entry is the version the flow is currently on.
      properties:
        number:
          type: integer
          title: Number
          description: 1-based, monotonic within one flow.
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        changed_fields:
          type: array
          items:
            type: string
          title: Changed Fields
          description: >-
            Which of `name`, `description`, `config`, `ui` differ from the
            previous version — so a canvas-only move can be told from a graph
            edit.
        source:
          type: string
          enum:
            - ui
            - api
            - mcp
            - admin
            - system
          title: Source
          description: Where the edit came from.
        created_at:
          type: string
          title: Created At
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
          description: Email of the author, or null for edits made outside a user session.
        restored_from:
          anyOf:
            - type: integer
            - type: 'null'
          title: Restored From
          description: Set when this version was produced by a rollback.
      type: object
      required:
        - number
        - name
        - description
        - changed_fields
        - source
        - created_at
        - created_by
      title: FlowVersion
    FlowInput:
      properties:
        id:
          type: string
          title: Id
          description: >-
            Unique identifier for this input (used as key in the `inputs` map
            when running the flow).
        description:
          type: string
          title: Description
        type:
          type: string
          title: Type
          description: Data type of the input, e.g. `text`.
        required:
          type: boolean
          title: Required
      type: object
      required:
        - id
        - description
        - type
        - required
      title: FlowInput
    FlowOutput:
      properties:
        id:
          type: string
          title: Id
        response_field_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Response Field Id
      type: object
      required:
        - id
      title: FlowOutput

````