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

# Create a version

> Create a new version of a document with updated content.



## OpenAPI

````yaml /openapi/brms.json post /api/projects/{projectId}/documents/{documentId}/versions
openapi: 3.0.3
info:
  title: GoRules BRMS
  version: local
servers: []
security: []
tags:
  - name: AI
    description: >-
      AI-powered assistant for interactive conversations and decision logic
      generation
  - name: Audit log
    description: Track and export organisation activity logs for compliance and monitoring
  - name: Branches
    description: >-
      Manage feature branches for collaborative decision development with
      commits and merging
  - name: Change requests
    description: Review and approve changes before merging or deploying to environments
  - name: Cloud
    description: Cloud-specific endpoints for organisation and client management
  - name: Decision
    description: Evaluate and simulate decision graphs with trace and performance data
  - name: Deployment workflows
    description: Manage deployment workflow runs and job approvals
  - name: Deployments
    description: Configure cloud storage providers for release deployments
  - name: Document
    description: Manage decision documents, versions, and file operations within projects
  - name: Environment
    description: >-
      Configure deployment environments with approval workflows and access
      tokens
  - name: Group
    description: Manage permission groups for project-level access control
  - name: Infrastructure
    description: Health check and infrastructure status endpoints
  - name: Integration
    description: Configure external integrations for HTTP requests and data sources
  - name: Invitation
    description: Manage organisation invitations for new members
  - name: Member
    description: Manage project membership and group assignments
  - name: Organisation
    description: Manage organisation settings, preferences, and licensing
  - name: Personal access token
    description: Create and manage personal access tokens for API authentication
  - name: Profile
    description: Manage current user profile settings
  - name: Project
    description: Create and manage projects with approval workflows
  - name: Release
    description: >-
      Package, version, and deploy decision documents. Learn more about
      [Releases](https://gorules.io/developers/brms/multi-environment)
  - name: Roles
    description: Define custom roles with permissions for organisation-wide access control
  - name: Security
    description: Manage project access tokens for API authentication
  - name: Templates
    description: Browse and apply project templates for quick onboarding
  - name: Test events
    description: Manage test events for decision evaluation and testing
  - name: User
    description: Manage organisation users, invitations, and service accounts
paths:
  /api/projects/{projectId}/documents/{documentId}/versions:
    post:
      tags:
        - Document
      summary: Create a version
      description: Create a new version of a document with updated content.
      operationId: createDocumentVersion
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: documentId
          required: true
          description: Document unique identifier
        - schema:
            type: string
            format: uuid
          in: path
          name: projectId
          required: true
          description: Project unique identifier
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  nullable: true
                  description: Version name
                versionId:
                  type: string
                  nullable: true
                  format: uuid
                  description: Optional version ID to use
                content:
                  type: object
                  nullable: true
                  additionalProperties: true
                  example: null
                  description: Version content
      responses:
        '200':
          description: Document with the new version
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Document unique identifier
                  key:
                    type: string
                    description: Materialized lowercase path based on the name
                  path:
                    type: string
                    description: Materialized path based on the name
                  name:
                    type: string
                    description: Document name
                  type:
                    type: string
                    enum:
                      - f
                      - d
                      - e
                    description: Document type (file, directory, or external file)
                  meta:
                    type: object
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: boolean
                    description: Document metadata
                  contentType:
                    type: string
                    description: Content MIME type
                  size:
                    type: number
                    description: Document size in bytes
                  parentId:
                    type: string
                    nullable: true
                    format: uuid
                    description: Parent document ID
                  projectId:
                    type: string
                    format: uuid
                    description: Project ID
                  publishedId:
                    type: string
                    nullable: true
                    format: uuid
                    description: Currently published version ID
                  publishedAt:
                    type: string
                    nullable: true
                    description: Publication timestamp
                  publishedBy:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: User unique identifier
                      email:
                        type: string
                        format: email
                        description: User email address
                      firstName:
                        type: string
                        nullable: true
                        description: User first name
                      lastName:
                        type: string
                        nullable: true
                        description: User last name
                    required:
                      - id
                    description: User who published the document
                  published:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Version unique identifier
                      name:
                        type: string
                        nullable: true
                        description: Version name
                      parentId:
                        type: string
                        nullable: true
                        format: uuid
                        description: Parent version ID for sub-versions
                      status:
                        type: string
                        description: Version status (draft or completed)
                      content:
                        description: Version content data
                      documentId:
                        type: string
                        format: uuid
                        description: Associated document ID
                      createdBy:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                            description: User unique identifier
                          email:
                            type: string
                            format: email
                            description: User email address
                          firstName:
                            type: string
                            nullable: true
                            description: User first name
                          lastName:
                            type: string
                            nullable: true
                            description: User last name
                        required:
                          - id
                        description: User who created the version
                      createdAt:
                        type: string
                        description: Version creation timestamp
                      versions:
                        type: array
                        items: {}
                        description: Sub-versions (recursive structure)
                      releases:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              description: Release ID
                            version:
                              type: string
                              description: Release version string
                          required:
                            - id
                        description: Associated releases
                    required:
                      - id
                    description: Published version details
                  versions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Version unique identifier
                        name:
                          type: string
                          nullable: true
                          description: Version name
                        parentId:
                          type: string
                          nullable: true
                          format: uuid
                          description: Parent version ID for sub-versions
                        status:
                          type: string
                          description: Version status (draft or completed)
                        content:
                          description: Version content data
                        documentId:
                          type: string
                          format: uuid
                          description: Associated document ID
                        createdBy:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              description: User unique identifier
                            email:
                              type: string
                              format: email
                              description: User email address
                            firstName:
                              type: string
                              nullable: true
                              description: User first name
                            lastName:
                              type: string
                              nullable: true
                              description: User last name
                          required:
                            - id
                          description: User who created the version
                        createdAt:
                          type: string
                          description: Version creation timestamp
                        versions:
                          type: array
                          items: {}
                          description: Sub-versions (recursive structure)
                        releases:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                description: Release ID
                              version:
                                type: string
                                description: Release version string
                            required:
                              - id
                          description: Associated releases
                      required:
                        - id
                      description: Document version information
                    description: Document versions
                  changeRequests:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Change request unique identifier
                        type:
                          type: string
                          description: Type of change request
                        status:
                          type: string
                          description: Change request status
                        createdAt:
                          type: string
                          description: Creation timestamp
                      required:
                        - id
                        - type
                        - status
                      description: Change request information
                    description: Pending change requests
                  view:
                    type: object
                    nullable: true
                    properties:
                      description:
                        type: string
                        nullable: true
                        description: View description
                      permissions:
                        type: object
                        nullable: true
                        additionalProperties:
                          type: string
                          enum:
                            - edit:full
                            - edit:rules
                            - edit:values
                        description: View permissions mapping
                    description: Document view configuration
                  updatedAt:
                    type: string
                    description: Last update timestamp
                  deletedAt:
                    type: string
                    nullable: true
                    description: Deletion timestamp if soft deleted
                required:
                  - id
                  - key
                  - path
                  - name
                  - type
                  - projectId
                description: Document with the new version
      security:
        - personalAccessToken: []
        - internalAuth: []
components:
  securitySchemes:
    personalAccessToken:
      type: http
      scheme: bearer
      description: Personal access token is obtained through your profile
    internalAuth:
      type: http
      scheme: internal
      description: Cannot be used directly

````