> ## 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.

# Create Version

> Create one immutable, content-addressed review version.

Create one immutable content-addressed review version. The version is
addressable by its `rvr_…` id and forms the parent of any subsequent
correction in the version graph.

Versions live in their own collection, addressable via flat CRUD —
`review_id` lives in the body, not the URL.

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

  client = Retab()

  version = client.workflows.reviews.versions.create(
      review_id="rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY",
      parent_id="rvr_HQ6ZZBQTJLSGLZQCWBSI25SCOQ",
      snapshot={"total_amount": 325, "vendor_name": "Acme Corp"},
      note="Corrected total.",
  )
  print(version.id)
  ```

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

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

  const version = await client.workflows.reviews.versions.create("rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY", undefined, { total_amount: 325, vendor_name: "Acme Corp" }, "Corrected total.");

  console.log(version.id);
  ```

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

  import (
  	"context"
  	"fmt"
  	"log"

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

  func ptr[T any](v T) *T { return &v }

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

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

  	version, err := client.Workflows.Reviews.Versions.Create(ctx, &retab.WorkflowReviewVersionsCreateParams{
  		ReviewID: "rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY",
  		ParentID: "rvr_HQ6ZZBQTJLSGLZQCWBSI25SCOQ",
  		Snapshot: map[string]any{
  			"total_amount": 325,
  			"vendor_name":  "Acme Corp",
  		},
  		Note: ptr("Corrected total."),
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	fmt.Println(version.ID)
  }
  ```

  ```rust Rust theme={null}
  use retab::models::CreateReviewVersionRequest;
  use retab::resources::workflow_review_versions::CreateParams;
  use retab::Retab;
  use std::collections::HashMap;

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

      let mut snapshot: HashMap<String, serde_json::Value> = HashMap::new();
      snapshot.insert("total_amount".into(), serde_json::json!(325));
      snapshot.insert("vendor_name".into(), serde_json::json!("Acme Corp"));

      let mut body = CreateReviewVersionRequest::new(
          "rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY",
          "rvr_HQ6ZZBQTJLSGLZQCWBSI25SCOQ",
          snapshot,
      );
      body.note = Some("Corrected total.".into());

      let version = client
          .workflows()
          .reviews()
          .versions()
          .create(CreateParams::new(body))
          .await?;
      println!("{}", version.id);
      Ok(())
  }
  ```

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

  use Retab\Client;

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

  $result = $client->workflows()->reviews()->versions()->create(
      reviewId: 'rev_abc123',
      parentId: 'parent_id_abc123',
      snapshot: [],
  );
  print_r($result);
  ```

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

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

  var result = await client.Workflows.Reviews.Versions.CreateAsync(new WorkflowReviewVersionsCreateOptions());
  Console.WriteLine(result);
  ```

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

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

  result = client.workflows.reviews.versions.create
  puts result
  ```

  ```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 result = client.workflows().reviews().versions().create("review_abc123", null, null, null);
      System.out.println(result);
    }
  }
  ```

  ```curl cURL theme={null}
  curl -X POST \
    'https://api.retab.com/v1/workflows/reviews/versions' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <your-api-key>' \
    -d '{
      "review_id": "rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY",
      "parent_id": "rvr_HQ6ZZBQTJLSGLZQCWBSI25SCOQ",
      "snapshot": { "total_amount": 325, "vendor_name": "Acme Corp" },
      "note": "Corrected total."
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "rvr_PFBGO3R6T3PG5O37U4Y3NDXWAM",
    "review_id": "rev_D4J7WZBRV4H7C2SKQJ4NP6W2EY",
    "parent_id": "rvr_HQ6ZZBQTJLSGLZQCWBSI25SCOQ",
    "author": {
      "kind": "human",
      "id": "user_42",
      "display_name": "Dana Rivera"
    },
    "snapshot": { "total_amount": 325, "vendor_name": "Acme Corp" },
    "note": "Corrected total.",
    "created_at": "2026-05-13T09:05:00.000Z"
  }
  ```
</ResponseExample>

## Idempotency

Version ids are `sha256(canonical_json(normalized_snapshot))`. Submitting
the same `(review_id, parent_id, snapshot)` triple returns the existing
row; the server does not create a duplicate. Submitting the same content
with a different `parent_id` returns `409 parent_conflict`.


## OpenAPI

````yaml POST /v1/workflows/reviews/versions
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/workflows/reviews/versions:
    post:
      tags:
        - Workflows
        - Workflow Reviews
      summary: Create Review Version
      description: Create one immutable, content-addressed review version.
      operationId: create_review_version
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReviewVersionRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowReviewVersion'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateReviewVersionRequest:
      properties:
        review_id:
          type: string
          minLength: 1
          title: Review Id
        parent_id:
          type: string
          pattern: ^rvr_[A-Z2-7]{26}$
          title: Parent Id
        snapshot:
          additionalProperties: true
          type: object
          title: Snapshot
          description: >-
            The full reviewed snapshot to store as an immutable version. The
            object must match the gated block type: extract uses the raw output
            object; classifier uses {'category': string}; split uses
            {'documents': [{'name': string, 'pages': positive sorted int[]}]};
            for_each uses {'partitions': [{'key': string, 'pages': positive
            sorted int[]}]}. The server validates the shape and stores the exact
            submitted object when valid.
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
      additionalProperties: false
      type: object
      required:
        - parent_id
        - review_id
        - snapshot
      title: CreateReviewVersionRequest
      description: |-
        Create a corrected version of a review.

        `parent_id` must reference an existing version under the same
        `review_id`.
    WorkflowReviewVersion:
      properties:
        id:
          type: string
          pattern: ^rvr_[A-Z2-7]{26}$
          title: Id
        review_id:
          type: string
          title: Review Id
        parent_id:
          anyOf:
            - type: string
              pattern: ^rvr_[A-Z2-7]{26}$
            - type: 'null'
          title: Parent Id
        author:
          $ref: '#/components/schemas/Actor'
          description: Actor that created the version.
        snapshot:
          additionalProperties: true
          type: object
          title: Snapshot
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the review version was created.
      type: object
      required:
        - author
        - created_at
        - id
        - review_id
        - snapshot
      title: WorkflowReviewVersion
      description: Public API shape for one immutable review version.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    Actor:
      properties:
        kind:
          type: string
          enum:
            - model
            - agent
            - human
          title: Kind
        id:
          type: string
          minLength: 1
          title: Id
        display_name:
          type: string
          minLength: 1
          title: Display Name
      type: object
      required:
        - display_name
        - id
        - kind
      title: Actor
      description: One actor shape for humans, agents, and models.
    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

````