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

# Report wagon damage (full snapshot)

> Report each wagon's complete set of open defects. Each wagon in the body replaces everything ARMS shows for that wagon; ARMS never merges it with earlier messages.

Usage notes:
- An empty `defects` list means the wagon has no open defects (repaired).
- The wagon's colour is its worst defect severity: red > blue > white.
- A wagon whose defects already match what ARMS shows is a no-op: nothing is written, no `wagon_damaged` event is emitted, and the result has `changed: false`. Resending is always safe.
- The whole request is one transaction: a validation error (400) writes nothing.
- A `wagon_damaged` event is emitted only for changed wagons with exactly one inbound or online inventory record (`equipmentKnown: true`).
- A missing permission returns 401.



## OpenAPI

````yaml /user-docs/api-reference/external-openapi.json post /ims/equipment/wagon-damage
openapi: 3.1.0
info:
  title: ARMS External API
  version: 1.0.0
  description: >-
    OpenAPI specification generated from external API schemas. Endpoints require
    query parameter carrierId and headers x-arms-api-key and x-arms-assume-user.
  license:
    name: Proprietary
    url: https://cedarai.com
servers:
  - url: https://api-lg.arms.cedarai.com
    description: Production (US)
  - url: https://api-lg.arms.cedarai.se
    description: Production (EU)
security:
  - ApiKeyAuth: []
    AssumeUser: []
paths:
  /ims/equipment/wagon-damage:
    post:
      summary: Report wagon damage (full snapshot)
      description: >-
        Report each wagon's complete set of open defects. Each wagon in the body
        replaces everything ARMS shows for that wagon; ARMS never merges it with
        earlier messages.


        Usage notes:

        - An empty `defects` list means the wagon has no open defects
        (repaired).

        - The wagon's colour is its worst defect severity: red > blue > white.

        - A wagon whose defects already match what ARMS shows is a no-op:
        nothing is written, no `wagon_damaged` event is emitted, and the result
        has `changed: false`. Resending is always safe.

        - The whole request is one transaction: a validation error (400) writes
        nothing.

        - A `wagon_damaged` event is emitted only for changed wagons with
        exactly one inbound or online inventory record (`equipmentKnown: true`).

        - A missing permission returns 401.
      operationId: updateWagonDamage
      parameters:
        - $ref: '#/components/parameters/CarrierId'
        - $ref: '#/components/parameters/ViewAsUserGroup'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWagonDamageInput'
            examples:
              damaged:
                summary: Wagon with a red and a blue defect
                value:
                  wagons:
                    - wagonNumber: '437443800606'
                      defects:
                        - defectCode: 1.3.5.1
                          defectDescription: Krossår/håligheter/avskalning på löpytan > 60 mm
                          defectRemark: ''
                          defectSeverity: red
                        - defectCode: 6.1.7.3
                          defectDescription: Fotsteg skadat, fara säkerhet personal
                          defectRemark: ''
                          defectSeverity: blue
              repaired:
                summary: Repaired wagon (no open defects)
                value:
                  wagons:
                    - wagonNumber: '437443800606'
                      defects: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateWagonDamageOutput'
        '400':
          description: Bad Request (validation failed; nothing was written)
        '401':
          description: Unauthorized (bad key, carrier not permitted, or missing permission)
        '500':
          description: Internal Server Error (nothing was written; safe to retry)
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    CarrierId:
      name: carrierId
      in: query
      required: true
      schema:
        type: integer
      description: Carrier identifier; required for all endpoints
    ViewAsUserGroup:
      name: viewAsUserGroup
      in: query
      required: false
      schema:
        type: string
      description: Optional user group context
  schemas:
    UpdateWagonDamageInput:
      type: object
      description: >-
        Request body for reporting wagon damage. The whole request is applied or
        rejected as one unit.
      required:
        - wagons
      properties:
        carrierId:
          type: integer
          description: >-
            Carrier identifier. Optional here; the carrierId query parameter is
            required and takes precedence.
        wagons:
          type: array
          minItems: 1
          maxItems: 500
          description: >-
            Each wagonNumber at most once; at most 5,000 defects across all
            wagons.
          items:
            $ref: '#/components/schemas/WagonDamageSnapshot'
    UpdateWagonDamageOutput:
      type: object
      properties:
        items:
          type: array
          description: One entry per wagon, in request order.
          items:
            $ref: '#/components/schemas/WagonDamageResult'
    Error:
      type: object
      properties:
        message:
          type: string
    WagonDamageSnapshot:
      type: object
      description: >-
        The complete set of one wagon's open defects. Replaces everything ARMS
        shows for that wagon.
      required:
        - wagonNumber
        - defects
      properties:
        wagonNumber:
          type: string
          pattern: ^[0-9]{12}$
          description: 12-digit wagon number.
        defects:
          type: array
          maxItems: 100
          description: >-
            All of the wagon's open defects. An empty list means the wagon is
            repaired.
          items:
            $ref: '#/components/schemas/WagonDefect'
    WagonDamageResult:
      type: object
      description: Outcome for one wagon in the request.
      properties:
        wagonNumber:
          type: string
          description: Wagon number from the request.
        damageStatus:
          type: string
          enum:
            - RED
            - BLUE
            - WHITE
            - NOT_DAMAGED
          description: Wagon colour ARMS shows after this call.
        defectCount:
          type: integer
          description: Active defects ARMS shows after this call.
        changed:
          type: boolean
          description: false if the snapshot matched what ARMS already showed.
        equipmentKnown:
          type: boolean
          description: >-
            true if exactly one inbound or online inventory record matches the
            wagon.
    WagonDefect:
      type: object
      description: One open defect on a wagon.
      required:
        - defectCode
        - defectSeverity
      properties:
        defectCode:
          type: string
          minLength: 1
          maxLength: 64
          description: GC defect code, e.g. 1.3.5.1.
        defectDescription:
          type: string
          nullable: true
          maxLength: 1000
          default: ''
          description: >-
            Standard description of the defect code. Missing or null is treated
            as an empty string.
        defectRemark:
          type: string
          nullable: true
          description: Free-text remark. Accepted but not stored.
        defectSeverity:
          type: string
          enum:
            - red
            - blue
            - white
          description: >-
            Defect card colour, case-insensitive. The wagon's colour is its
            worst defect: red > blue > white.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-arms-api-key
      description: Your ARMS API key
    AssumeUser:
      type: apiKey
      in: header
      name: x-arms-assume-user
      description: Email of a user assigned to the appropriate user group

````

## Related topics

- [API Introduction](/user-docs/api-reference/introduction.md)
- [Load Data Depot deliveries into Databricks](/user-docs/data-depot/databricks.md)
- [Train Set Webhook](/user-docs/arms/webhooks/train-set.md)
- [Notes](/user-docs/arms/ops/notes.md)
- [Tools & API Keys](/user-docs/admin/tools-api-keys.md)
