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

# List all versions of a model

> Returns every version (active, labeled, and draft) of the model identified by `model_id`, ordered by version number descending unless `sort` is given. The `is_active` flag identifies the version new batch generations and model runs use by default; `version_label` is a human-readable tag (e.g. "Production") set with Update a model version label. Filterable fields: `name`, `version`, `cadence`, `partition_type`, `created_at`, `updated_at`. Requires the `read:model` token scope.



## OpenAPI

````yaml GET /models/{model_id}/versions
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
  description: >
    ## Filtering and sorting


    List endpoints that accept `filter` take one query parameter per condition,
    written `filter[field][comparator]=value`, for example
    `filter[name][contains]=North`. The comparators are `eq`, `neq`, `gt`,
    `geq`, `lt`, `leq` and `contains`, and `filter[field]=value` is short for
    `eq`. Conditions combine with AND. `contains` matches part of the value, is
    case-sensitive, and applies only to text fields. An unknown field or
    comparator, a value that doesn't fit the field's type, or a list or object
    as the value returns 400 with a message naming the problem. Each list
    operation names its filterable fields; some take only `eq`, and say so.


    `sort` takes a comma-separated list of fields, for example
    `sort=-created_at,name`. Each field sorts ascending, or descending with a
    `-` prefix. Unknown sort fields are ignored. Sorting by `id` orders by the
    record's internal ID, not its friendly ID. Each list operation names its
    sortable fields.
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /models/{model_id}/versions:
    get:
      summary: List all versions of a model
      description: >-
        Returns every version (active, labeled, and draft) of the model
        identified by `model_id`, ordered by version number descending unless
        `sort` is given. The `is_active` flag identifies the version new batch
        generations and model runs use by default; `version_label` is a
        human-readable tag (e.g. "Production") set with Update a model version
        label. Filterable fields: `name`, `version`, `cadence`,
        `partition_type`, `created_at`, `updated_at`. Requires the `read:model`
        token scope.
      operationId: list-model-versions
      parameters:
        - name: model_id
          in: path
          description: >-
            The friendly ID of any version of the model (e.g.
            `mod_aBcD1234eFgH5678`).
          schema:
            type: string
          required: true
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PageSize'
        - name: sort
          in: query
          description: >-
            Sortable fields: `id`, `name`, `version`, `created_at`,
            `updated_at`.
          schema:
            type: string
            example: version
        - $ref: '#/components/parameters/Fields'
        - $ref: '#/components/parameters/ResponseMode'
        - $ref: '#/components/parameters/ExportFormat'
      responses:
        '200':
          description: >-
            Paginated list. With `response_mode=summary`, a count and up to 10
            samples instead; with `summary_with_export`, the same plus a queued
            export.
          content:
            application/json:
              example:
                data:
                  - id: mod_xYzW7890aBcD1234
                    name: Carbon Calculation Model
                    version: 2
                    version_label: Production
                    description: Uses the measured density in place of the default factor.
                    is_active: true
                    cadence: monthly
                    partition_type: feedstock
                    order: 1
                    is_latest: true
                    is_score_producing: false
                    created_at: '2025-01-16T10:00:00.000Z'
                    updated_at: '2025-01-16T10:00:00.000Z'
                    ledger: null
                    quantification_methodology: null
                    ui_url: >-
                      https://app.gomangrove.com/nexus/prj_AbCd1234567890Ef/system/mod_xYzW7890aBcD1234
                  - id: mod_aBcD1234eFgH5678
                    name: Carbon Calculation Model
                    version: 1
                    version_label: null
                    description: null
                    is_active: false
                    cadence: monthly
                    partition_type: feedstock
                    order: 1
                    is_latest: false
                    is_score_producing: false
                    created_at: '2025-01-15T10:00:00.000Z'
                    updated_at: '2025-01-16T10:00:00.000Z'
                    ledger: null
                    quantification_methodology: null
                    ui_url: >-
                      https://app.gomangrove.com/nexus/prj_AbCd1234567890Ef/system/mod_aBcD1234eFgH5678
                info:
                  items: 2
                  page_size: 20
                  total_items: 2
                  current_page: 1
                  next_page: null
                  previous_page: null
                  total_pages: 1
                  sort: []
                  filter: []
                  fields: null
              schema:
                oneOf:
                  - type: object
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Model'
                      info:
                        $ref: '#/components/schemas/PaginationInfo'
                    required:
                      - data
                      - info
                  - allOf:
                      - $ref: '#/components/schemas/SummaryResponse'
                      - properties:
                          samples:
                            items:
                              $ref: '#/components/schemas/Model'
                  - allOf:
                      - $ref: '#/components/schemas/SummaryWithExportResponse'
                      - properties:
                          samples:
                            items:
                              $ref: '#/components/schemas/Model'
        '400':
          description: >-
            An unsupported filter, comparator, `response_mode` or
            `export_format`, an invalid `page`, or a filter value that does not
            match its field's type.
          content:
            application/json:
              example:
                errors:
                  - message: >-
                      Unsupported filter 'project_id'. Filterable fields: id,
                      name, version, cadence, partition_type, created_at,
                      updated_at.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    Page:
      name: page
      in: query
      description: >-
        The page to return, starting at 1. A value below 1 or a non-numeric
        value returns 400.
      schema:
        type: integer
        format: int32
        default: 1
        minimum: 1
    PageSize:
      name: page_size
      in: query
      description: >-
        Rows per page, from 1 to 200. A value below 1 counts as 1 and a value
        above 200 as 200; a non-numeric value uses the default.
      schema:
        type: integer
        format: int32
        default: 20
        minimum: 1
        maximum: 200
    Fields:
      name: fields
      in: query
      description: Comma-separated fields to return in each row. Other names are ignored.
      schema:
        type: string
    ResponseMode:
      name: response_mode
      in: query
      description: >-
        `default` returns a page of rows. `summary` returns the number of
        matching records and up to 10 sample rows. `summary_with_export` returns
        the summary and queues an export of every matching record.
      schema:
        type: string
        enum:
          - default
          - summary
          - summary_with_export
    ExportFormat:
      name: export_format
      in: query
      description: >-
        The export's file format. Applies only with
        `response_mode=summary_with_export`.
      schema:
        type: string
        enum:
          - csv
          - json
        default: csv
  schemas:
    Model:
      type: object
      description: >-
        One version of a model. Every endpoint that returns a model returns this
        shape.
      properties:
        id:
          type: string
          description: >-
            The model's friendly ID (e.g. `mod_aBcD1234eFgH5678`). Each version
            has its own.
          example: mod_aBcD1234eFgH5678
        name:
          type: string
          description: Shared by every version of the model.
        version:
          type: integer
          description: >-
            Version number. A model created through the API starts at 0, and
            each new version adds one.
        version_label:
          type:
            - string
            - 'null'
          description: >-
            A short name for the version, up to 255 characters (letters,
            numbers, spaces and `_ - . ( ) /`).
        description:
          type:
            - string
            - 'null'
          description: What changed in the version, up to 500 characters.
        is_active:
          type: boolean
          description: >-
            Whether this is the version new batch generations and model runs use
            by default. At most one version of a model is active; the first
            version is active when it is created.
        cadence:
          type:
            - string
            - 'null'
          enum:
            - hourly
            - daily
            - weekly
            - monthly
            - annually
            - null
        partition_type:
          type:
            - string
            - 'null'
          enum:
            - time
            - feedstock
            - tracking_id
            - asset
            - tracking_id_and_feedstock
            - tracking_id_and_asset
            - null
          description: >-
            How batches are partitioned. The composite values partition by both
            dimensions at once.
        order:
          type: integer
        is_latest:
          type: boolean
          description: Whether this is the highest version number of the model.
        is_score_producing:
          type: boolean
          description: >-
            Whether the model produces carbon intensity score sets rather than
            batches.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        ledger:
          type:
            - object
            - 'null'
          description: >-
            The production accounting ledger the model produces batches into, or
            null when it is not linked to one.
          properties:
            id:
              type: string
              example: led_aBcD1234eFgH5678
            name:
              type: string
        quantification_methodology:
          type:
            - object
            - 'null'
          description: >-
            The designated quantification methodology, or null for a production
            model.
          properties:
            id:
              type: integer
            name:
              type: string
        ui_url:
          type:
            - string
            - 'null'
          format: uri
          description: >-
            Link that opens this model in the Mangrove app. Null when the model
            has no project.
          example: >-
            https://app.gomangrove.com/nexus/prj_AbCd1234567890Ef/system/mod_aBcD1234eFgH5678
    PaginationInfo:
      type: object
      description: >-
        Where this page sits in the full result, and the sort, filters and
        fields the request applied.
      properties:
        items:
          type: integer
          description: Rows on this page.
          example: 2
        page_size:
          type: integer
          description: Rows per page.
          example: 20
        total_items:
          type: integer
          description: Rows matching the request across all pages.
          example: 2
        current_page:
          type: integer
          description: This page's number, starting at 1.
          example: 1
        next_page:
          type:
            - integer
            - 'null'
          description: The next page's number, or null on the last page.
        previous_page:
          type:
            - integer
            - 'null'
          description: The previous page's number, or null on the first page.
        total_pages:
          type: integer
          description: Pages in the full result.
          example: 1
        sort:
          type: array
          description: >-
            The sort applied, one entry per field, in order. Present on list
            endpoints that accept `sort`.
          items:
            type: object
            properties:
              field:
                type: string
              direction:
                type: string
                enum:
                  - asc
                  - desc
        filter:
          type: array
          description: >-
            The filters applied, one entry per field and comparator. Present on
            list endpoints that accept `filter`.
          items:
            type: object
            properties:
              field:
                type: string
              comparator:
                type: string
                enum:
                  - eq
                  - neq
                  - gt
                  - geq
                  - lt
                  - leq
                  - contains
              value: {}
        fields:
          type:
            - array
            - 'null'
          description: >-
            The requested `fields`, or null when none were requested. Present on
            list endpoints that accept `fields`.
          items:
            type: string
    SummaryResponse:
      type: object
      description: Returned instead of a page when `response_mode=summary`.
      required:
        - count
        - samples
        - response_mode
      properties:
        count:
          type: integer
          description: Number of records matching the request's filters.
        samples:
          type: array
          maxItems: 10
          description: >-
            Up to 10 matching records, in the same shape as the page's `data`
            rows.
          items:
            type: object
        response_mode:
          type: string
          enum:
            - summary
    SummaryWithExportResponse:
      type: object
      description: >-
        Returned when `response_mode=summary_with_export`: the summary, plus an
        export of every matching record queued in the background. Poll `GET
        /exports/{export_id}` with `export.id`. With 5 exports already pending
        or processing for the account, the request returns 400.
      required:
        - count
        - samples
        - response_mode
        - export
      properties:
        count:
          type: integer
          description: Number of records matching the request's filters.
        samples:
          type: array
          maxItems: 10
          description: >-
            Up to 10 matching records, in the same shape as the page's `data`
            rows.
          items:
            type: object
        response_mode:
          type: string
          enum:
            - summary_with_export
        export:
          type: object
          properties:
            id:
              type: string
              example: exp_aBcD1234eFgH5678
            status:
              type: string
              enum:
                - pending
            status_url:
              type: string
              format: uri
    ErrorResponse:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            required:
              - message
            properties:
              message:
                type: string
                description: Human-readable error message
              field:
                type: string
                description: Attribute the error applies to (validation errors only)
              code:
                type: string
                description: Machine-readable error code (validation errors only)
              blocking:
                type: array
                description: >-
                  Bounded preview of the records blocking a destroy
                  (blocked-destroy errors only)
                items:
                  $ref: '#/components/schemas/DeletionBlockingRecord'
              blocking_count:
                type: integer
                description: >-
                  Total count of records blocking a destroy (blocked-destroy
                  errors only)
              config_key:
                type: string
                description: >-
                  The data feed source config setting to fix, when the error is
                  on `config` (data feed source validation errors only)
              count:
                type: number
                description: >-
                  The limit or comparison value the failed validation checked
                  against, e.g. a maximum length or a numeric bound (validation
                  errors only, when the validation has one)
              value:
                description: >-
                  The rejected value, e.g. on an inclusion or uniqueness failure
                  (validation errors only, when the validation reports one)
    DeletionBlockingRecord:
      type: object
      required:
        - type
      properties:
        type:
          type: string
        friendly_id:
          type: string
        name:
          type:
            - string
            - 'null'
          description: >-
            Display label, and the only identifier for records that have no
            friendly_id
  responses:
    Unauthorized:
      description: >-
        The API token is missing, invalid or expired. The body is empty, except
        for an expired token, which returns the error below.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - message: API token has expired
    Forbidden:
      description: >-
        The token lacks the scope the operation's description names, or a
        condition the description states applies, such as a feature that isn't
        enabled for your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - message: You are not authorized to perform this action
    NotFound:
      description: >-
        A resource named in the path doesn't exist in your account, or the token
        can't see it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - message: Record not found
  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.