> ## 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., mod_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
                version_label:
                  type: string
                  description: >-
                    A short name for the version, up to 255 characters (letters,
                    numbers, spaces and `_ - . ( ) /`).
                description:
                  type: string
                  description: What changed in the version, up to 500 characters.
            examples:
              Result:
                value:
                  yaml: |
                    nexus:
                      - name: Updated Net Carbon Removal
                        formula: input_1 - input_2 - input_3
                  version_label: Measured density
                  description: Uses the measured density in place of the default factor.
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: mod_xyz789abc123
                    name: Carbon Calculation Model
                    version: 2
                    version_label: Measured density
                    description: Uses the measured density in place of the default factor.
                    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'
                    ui_url: >-
                      https://app.gomangrove.com/nexus/prj_AbCd1234567890Ef/system/mod_abc123def456
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  version:
                    type: integer
                  version_label:
                    type: string
                    nullable: true
                    description: >-
                      A short name for the version, up to 255 characters
                      (letters, numbers, spaces and `_ - . ( ) /`).
                  description:
                    type: string
                    nullable: true
                    description: What changed in the version, up to 500 characters.
                  is_latest:
                    type: boolean
                  cadence:
                    type: string
                  partition_type:
                    type: string
                    description: >-
                      Batch partition strategy: time, feedstock, tracking_id,
                      asset, tracking_id_and_feedstock, or
                      tracking_id_and_asset. The two composite strategies
                      partition by both dimensions at once.
                  order:
                    type: integer
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
                  ui_url:
                    type: string
                    nullable: true
                    description: >-
                      Link that opens this model in the Mangrove app. Null when
                      the model has no project.
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value:
                    errors:
                      - message: Can only create versions from the latest model version
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: string
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.