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

# Edit Input

> Edit model input

export const permission_0 = 'model:update'

<Info>Requires permission: **{permission_0}**</Info>


## OpenAPI

````yaml PATCH /v1/model/{modelId}/input/{inputId}
openapi: 3.0.1
info:
  title: Variable API
  description: This is the Variable API
  version: 1.1.0
servers:
  - url: https://app.variable.global/api
security:
  - basicAuth: []
  - bearerAuth: []
  - oAuthNoScopes: []
paths:
  /v1/model/{modelId}/input/{inputId}:
    parameters:
      - in: path
        name: modelId
        required: true
        schema:
          type: string
          format: uuid
      - in: path
        name: inputId
        required: true
        schema:
          type: string
          format: uuid
    patch:
      summary: Edit an input
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
                - uuid
              allOf:
                - $ref: '#/components/schemas/EditInput'
      responses:
        '200':
          description: An input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnedInput'
        '401':
          description: ExpiredToken
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExpiredTokenResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    EditInput:
      allOf:
        - properties:
            uuid:
              $ref: '#/components/schemas/UUID'
        - $ref: '#/components/schemas/NewInput'
    ReturnedInput:
      allOf:
        - $ref: '#/components/schemas/EditInput'
        - $ref: '#/components/schemas/CreatedUpdated'
        - properties:
            CO2e:
              type: string
              example: '1234.5678'
            declaredAmount:
              description: >
                Read-only canonical amount in the source product's declared
                unit, used by

                impact calculation. Present only when `quantity` + `unit` you
                sent are in

                a different dimension than the source product's declared unit
                (e.g. you

                sent `kg` for an `m3`-declared source product that has a weight
                conversion

                factor). Ignored on POST/PATCH.
              type: object
              properties:
                quantity:
                  type: number
                  example: 0.002
                unit:
                  $ref: '#/components/schemas/UnitString'
            recycledPercent:
              description: >
                Read-only. Recycled content of this input as a percentage
                (0–100), inherited

                from its source product — the source's modeled recycled content
                when available,

                otherwise its declared value. 0 when the input has no source
                product or the

                source has neither. Ignored on POST/PATCH.
              type: number
              readOnly: true
              example: 30
    ExpiredTokenResponse:
      type: object
      properties:
        message:
          type: string
          example: token expired
    UUID:
      type: string
      format: uuid
    NewInput:
      properties:
        syncId:
          $ref: '#/components/schemas/SyncId'
        quantity:
          type: number
          example: 150
        unit:
          $ref: '#/components/schemas/UnitString'
        order:
          type: number
          example: 1
        material:
          properties:
            uuid:
              $ref: '#/components/schemas/UUID'
            name:
              type: string
              example: Material name
        block:
          properties:
            uuid:
              $ref: '#/components/schemas/UUID'
            name:
              type: string
              example: Block name
        lifecycleStage:
          $ref: '#/components/schemas/LifecycleStage'
        materialGroup:
          description: >
            How this input is categorized within its life-cycle stage. Common
            values

            are `product`, `packaging`, and `ancillary`; custom values (e.g.
            from a PCR

            document) are allowed. `isPackaging` is kept consistent
            automatically.
          type: array
          items:
            type: string
          example:
            - packaging
        transport:
          allOf:
            - $ref: '#/components/schemas/InputTransport'
          nullable: true
          description: >-
            Freight transport attached to this input as a single transport leg.
            Set to attach or update the binding; send `null` on `PATCH` to
            detach (omitting `transport` leaves an existing binding untouched).
            An input cannot be both a material line and a transport leg —
            sending `material` and `transport` together returns `400`.
    CreatedUpdated:
      type: object
      properties:
        created:
          type: string
          description: ISO 8601 date
          example: '2021-01-01T00:00:00.000Z'
        updated:
          type: string
          description: ISO 8601 date
          example: '2021-01-31T23:59:59.000Z'
    UnitString:
      type: string
      example: kg
      description: >-
        The unit code (e.g. kg, lbs, etc.). All unit codes can be found in the
        [List Units](/api-reference/v1/unit/get) endpoint.
    SyncId:
      type: string
      description: >-
        An identifier to use when syncing data with other systems. [Read
        more](/docs/syncId)
      example: sync123
    LifecycleStage:
      type: object
      properties:
        code:
          type: string
          example: A1
        name:
          type: string
          example: Materials
    InputTransport:
      type: object
      properties:
        lane:
          allOf:
            - $ref: '#/components/schemas/InputTransportRef'
          description: The freight route this leg follows. Must be visible to your company.
        for:
          allOf:
            - $ref: '#/components/schemas/InputTransportRef'
          nullable: true
          description: >-
            The material input — in the same model — this leg carries. Setting
            it derives the leg's lifecycle stage and cargo weight from that
            material (so `weight` must be omitted). Send `null` to unlink (the
            leg reverts to standalone and `weight` becomes settable again); omit
            to leave the link unchanged. A cross-model or non-material target
            returns `400`; an unknown or out-of-company one returns `404`.
        weight:
          type: object
          description: >-
            Cargo weight moved along the lane. Required for a standalone leg (no
            `for`); the unit must be a weight unit (e.g. kg, t, lbs). Forbidden
            when `for` is set — the cargo weight is then derived from the
            carried material and any `weight` you send is rejected with `400`
            (`transport.weight is derived from transport.for; omit it.`).
          properties:
            quantity:
              type: number
              example: 250
            unit:
              $ref: '#/components/schemas/UnitString'
        tkm:
          type: number
          readOnly: true
          description: >-
            Tonne-kilometres carried, derived server-side from the lane distance
            and cargo weight. The leg's absolute carbon footprint is computed
            from `tkm` and the lane's `CO2ePerTkm` and rolls into the input's
            own `CO2e` and the model total. Ignored on write.
          example: 1510.6
    InputTransportRef:
      type: object
      description: >-
        A reference to a transport lane or a carried material input. On write,
        address it by `uuid` or `syncId` (the same forms
        `/v1/transport/lane/:id` accepts); reads echo `uuid`, `syncId`, and the
        resolved `name`.
      properties:
        uuid:
          $ref: '#/components/schemas/UUID'
        syncId:
          $ref: '#/components/schemas/SyncId'
        name:
          type: string
          readOnly: true
          example: Newark, NJ to Rotterdam, NL
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    oAuthNoScopes:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /auth/token
          scopes: {}

````