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

# Restore Block Version

Restore a workflow block version into the current workflow draft.

<RequestExample>
  ```python Python theme={null}
  from retab import Retab

  client = Retab()

  block = client.workflows.blocks.create_version_restore("bkv_abc123")
  print(block)
  ```

  ```typescript TypeScript theme={null}
  import { Retab } from "@retab/node";

  const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

  const block = await client.workflows.blocks.create_version_restore("bkv_abc123");
  console.log(block);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	retab "github.com/retab-dev/retab/clients/go"
  )

  func main() {
  	ctx := context.Background()

  	client, err := retab.NewClient("")
  	if err != nil {
  		log.Fatal(err)
  	}

  	block, err := client.Workflows.Blocks.CreateVersionRestore(ctx, "bkv_abc123")
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(*block)
  }
  ```

  ```ruby Ruby theme={null}
  require 'retab'

  client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])

  block = client.workflows.blocks.create_version_restore(block_version_id: 'bkv_abc123')
  puts block
  ```

  ```rust Rust theme={null}
  use retab::Retab;

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = Retab::new(std::env::var("RETAB_API_KEY")?);

      let block = client
          .workflows()
          .blocks()
          .create_version_restore("bkv_abc123")
          .await?;
      println!("{:?}", block);
      Ok(())
  }
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Retab\Client;

  $client = new Client(apiKey: getenv('RETAB_API_KEY'));

  $block = $client->workflows()->blocks()->createVersionRestore(
      blockVersionId: 'bkv_abc123',
  );
  print_r($block);
  ```

  ```csharp C# theme={null}
  using Retab;
  using RetabClient = Retab.Retab;

  var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
  var client = new RetabClient(apiKey);

  var block = await client.Workflows.Blocks.CreateVersionRestoreAsync("bkv_abc123");
  Console.WriteLine(block);
  ```

  ```java Java theme={null}
  import com.retab.RetabClient;

  public final class Example {
    public static void main(String[] args) throws Exception {
      RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

      var block = client.workflows().blocks().createVersionRestore("bkv_abc123");
      System.out.println(block);
    }
  }
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.retab.com/v1/workflows/blocks/versions/bkv_abc123/restore?workflow_id=wf_abc123" \
    -H "Authorization: Bearer $RETAB_API_KEY"
  ```
</RequestExample>


## OpenAPI

````yaml POST /v1/workflows/blocks/versions/{block_version_id}/restore
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/workflows/blocks/versions/{block_version_id}/restore:
    post:
      tags:
        - Workflows
        - Workflow Blocks
      summary: Restore Block Version
      operationId: restore_block_version
      parameters:
        - in: path
          name: block_version_id
          required: true
          schema:
            type: string
            title: Block Version Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowBlock'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WorkflowBlock:
      properties:
        id:
          type: string
          title: Id
        workflow_id:
          type: string
          title: Workflow Id
          description: Foreign key to workflow
        type:
          type: string
          enum:
            - start_document
            - start_json
            - note
            - parse
            - edit
            - extract
            - split
            - classifier
            - conditional
            - api_call
            - function
            - while_loop
            - for_each
            - merge_dicts
            - while_loop_sentinel_start
            - while_loop_sentinel_end
            - for_each_sentinel_start
            - for_each_sentinel_end
          title: Type
          description: Block type (extract, parse, classifier, etc.)
        label:
          type: string
          title: Label
          description: Display label for the block
          default: ''
        position_x:
          type: number
          title: Position X
          description: X position on canvas
          default: 0
        position_y:
          type: number
          title: Position Y
          description: Y position on canvas
          default: 0
        width:
          anyOf:
            - type: number
            - type: 'null'
          title: Width
          description: Block width for resizable blocks
        height:
          anyOf:
            - type: number
            - type: 'null'
          title: Height
          description: Block height for resizable blocks
        config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Config
          description: Block-specific configuration
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: ID of parent container (while_loop, for_each)
        declarative_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Declarative Path
          description: Canonical declarative block path used to reconcile imported specs.
        declarative_source_block_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Declarative Source Block Id
          description: Authored declarative block id before import-time id regeneration.
        updated_at:
          type: string
          format: date-time
          title: Updated At
        resolved_schemas:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Resolved Schemas
          description: Schemas resolved for this block from the workflow graph.
      type: object
      required:
        - id
        - type
        - updated_at
        - workflow_id
      title: WorkflowBlock
      description: Public live workflow block object.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````