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

# Create a new model version

> Create a new version of an existing model with an updated YAML definition. Can only be called on the latest version. The new version inherits the model name and increments the version number.



## OpenAPI

````yaml POST /models/{model_id}/versions
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /models/{model_id}/versions:
    post:
      summary: Create a new model version
      description: >-
        Create a new version of an existing model with an updated YAML
        definition. Can only be called on the latest version. The new version
        inherits the model name and increments the version number.
      operationId: create-model-version
      parameters:
        - name: model_id
          in: path
          description: Model friendly ID (e.g., mdl_abc123def456)
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - yaml
              properties:
                yaml:
                  type: string
                  description: YAML defining the updated node tree
            examples:
              Result:
                value:
                  yaml: |
                    nexus:
                      - name: Updated Net Carbon Removal
                        formula: input_1 - input_2 - input_3
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: mdl_xyz789abc123
                    name: Carbon Calculation Model
                    version: 2
                    is_latest: true
                    cadence: monthly
                    partition_type: feedstock
                    order: 1
                    created_at: '2025-01-16T10:00:00.000Z'
                    updated_at: '2025-01-16T10:00:00.000Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  version:
                    type: integer
                  is_latest:
                    type: boolean
                  cadence:
                    type: string
                  partition_type:
                    type: string
                  order:
                    type: integer
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value:
                    status: error
                    statusCode: 422
                    errors:
                      - message: Can only create versions from the latest model version
              schema:
                type: object
                properties:
                  status:
                    type: string
                  statusCode:
                    type: integer
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: string
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````