# Update a loading

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /loadings/{id}:
    patch:
      summary: Update a loading
      deprecated: false
      description: Updates an existing loading. Cannot update cancelled loadings.
      operationId: updateLoading
      tags:
        - LoadingCalendar API/Loadings
        - Loadings
      parameters:
        - name: id
          in: path
          description: Loading ID
          required: true
          example: 0
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              x-apidog-refs:
                01KFT7CHT4XE9VNEW36EKAFYYD:
                  $ref: '#/components/schemas/LoadingUpdateRequest'
                  x-apidog-overrides:
                    status: &ref_0
                      $ref: '#/components/schemas/LoadingStatus'
              x-apidog-orders:
                - 01KFT7CHT4XE9VNEW36EKAFYYD
              properties:
                dock_id:
                  type: integer
                date:
                  type: string
                  format: date
                  description: Date (YYYY-MM-DD)
                time_from:
                  type: string
                  format: time
                duration:
                  type: integer
                  description: Duration in minutes.
                  enum:
                    - 15
                    - 30
                    - 45
                    - 60
                    - 90
                    - 120
                    - 240
                  x-apidog-enum:
                    - value: 15
                      name: ''
                      description: ''
                    - value: 30
                      name: ''
                      description: ''
                    - value: 45
                      name: ''
                      description: ''
                    - value: 60
                      name: ''
                      description: ''
                    - value: 90
                      name: ''
                      description: ''
                    - value: 120
                      name: ''
                      description: ''
                    - value: 240
                      name: ''
                      description: ''
                loading_duration_id:
                  type: integer
                reference:
                  type: string
                supplier:
                  type: string
                goods:
                  type: string
                carrier:
                  type: string
                direction: &ref_1
                  $ref: '#/components/schemas/LoadingDirection'
                status: *ref_0
                notes:
                  type: string
                driver_name:
                  type: string
                driver_phone:
                  type: string
                registration_plate:
                  type: string
                carrier_email:
                  type: string
              x-apidog-ignore-properties:
                - dock_id
                - date
                - time_from
                - duration
                - loading_duration_id
                - reference
                - supplier
                - goods
                - carrier
                - direction
                - status
                - notes
                - driver_name
                - driver_phone
                - registration_plate
                - carrier_email
            examples: {}
      responses:
        '200':
          description: Loading updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoadingWithDocuments'
          headers: {}
          x-apidog-name: ''
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - Invalid API key
          headers: {}
          x-apidog-name: Unauthorized
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                      examples:
                        - Not found
                    examples:
                      - - Not found
                x-apidog-refs: {}
                x-apidog-orders:
                  - errors
                x-apidog-ignore-properties: []
              example:
                errors:
                  - Not found
          headers: {}
          x-apidog-name: NotFound
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                      examples:
                        - Validation failed
                    examples:
                      - - Validation failed
                x-apidog-refs: {}
                x-apidog-orders:
                  - errors
                x-apidog-ignore-properties: []
              example:
                errors:
                  - Validation failed
          headers: {}
          x-apidog-name: UnprocessableEntity
      security: []
      x-apidog-folder: LoadingCalendar API/Loadings
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/361044/apis/api-4047027-run
components:
  schemas:
    LoadingDirection:
      type: string
      description: Loading direction
      enum:
        - inbound
        - outbound
      default: inbound
      x-apidog-folder: ''
    LoadingUpdateRequest:
      type: object
      properties:
        dock_id:
          type: integer
        date:
          type: string
          format: date
          description: Date (YYYY-MM-DD)
        time_from:
          type: string
          format: time
        duration:
          type: integer
          description: Duration in minutes.
          enum:
            - 15
            - 30
            - 45
            - 60
            - 90
            - 120
            - 240
          x-apidog-enum:
            - value: 15
              name: ''
              description: ''
            - value: 30
              name: ''
              description: ''
            - value: 45
              name: ''
              description: ''
            - value: 60
              name: ''
              description: ''
            - value: 90
              name: ''
              description: ''
            - value: 120
              name: ''
              description: ''
            - value: 240
              name: ''
              description: ''
        loading_duration_id:
          type: integer
        reference:
          type: string
        supplier:
          type: string
        goods:
          type: string
        carrier:
          type: string
        direction: *ref_1
        status: *ref_0
        notes:
          type: string
        driver_name:
          type: string
        driver_phone:
          type: string
        registration_plate:
          type: string
        carrier_email:
          type: string
      x-apidog-orders:
        - dock_id
        - date
        - time_from
        - duration
        - loading_duration_id
        - reference
        - supplier
        - goods
        - carrier
        - direction
        - status
        - notes
        - driver_name
        - driver_phone
        - registration_plate
        - carrier_email
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    LoadingStatus:
      type: string
      description: Loading status
      enum:
        - new
        - arrived
        - in_progress
        - completed
        - cancelled
      x-apidog-enum:
        - value: new
          name: ''
          description: ''
        - value: arrived
          name: ''
          description: ''
        - value: in_progress
          name: ''
          description: ''
        - value: completed
          name: ''
          description: ''
        - value: cancelled
          name: ''
          description: ''
      x-apidog-folder: ''
    LoadingWithDocuments:
      allOf:
        - type: object
          x-apidog-refs:
            01KFT9P6H9G2R96D8JF3X0TPMC:
              $ref: '#/components/schemas/Loading'
              x-apidog-overrides:
                started_at: &ref_2
                  type: string
                  format: date-time
                  examples:
                    - 2026-01-25 12:00
                  description: Loading started timestamp (YYYY-MM-DD HH:MM) in local time
                  nullable: true
                finished_at: &ref_3
                  type: string
                  format: date-time
                  examples:
                    - 2026-01-25 12:30
                  description: Loading finished timestamp (YYYY-MM-DD HH:MM) in local time
                  nullable: true
          x-apidog-orders:
            - 01KFT9P6H9G2R96D8JF3X0TPMC
          properties:
            id: &ref_4
              type: integer
            dock_id: &ref_5
              type: integer
            dock_name: &ref_6
              type: string
            warehouse_id: &ref_7
              type: integer
            warehouse_name: &ref_8
              type: string
            date: &ref_9
              type: string
              format: date
              examples:
                - '2026-02-15'
            time_from: &ref_10
              type: string
              format: time
              examples:
                - '09:00'
            time_to: &ref_11
              type: string
              format: time
              examples:
                - '10:00'
            duration: &ref_12
              type: integer
              description: Loading duration in minutes
              examples:
                - 60
              enum:
                - 15
                - 30
                - 45
                - 60
                - 90
                - 120
                - 180
                - 240
              x-apidog-enum:
                - value: 15
                  name: ''
                  description: ''
                - value: 30
                  name: ''
                  description: ''
                - value: 45
                  name: ''
                  description: ''
                - value: 60
                  name: ''
                  description: ''
                - value: 90
                  name: ''
                  description: ''
                - value: 120
                  name: ''
                  description: ''
                - value: 180
                  name: ''
                  description: ''
                - value: 240
                  name: ''
                  description: ''
            loading_duration_id: &ref_13
              type: integer
              nullable: true
            reference: &ref_14
              type: string
              examples:
                - ORD-2026-001
              nullable: true
            cargoson_reference: &ref_15
              type: string
              description: Cargoson TMS reference
              nullable: true
            supplier: &ref_16
              type: string
              nullable: true
            goods: &ref_17
              type: string
              nullable: true
            carrier: &ref_18
              type: string
              nullable: true
            direction: *ref_1
            status: *ref_0
            notes: &ref_19
              type: string
              description: Notes for internal use
              nullable: true
            driver_name: &ref_20
              type: string
              nullable: true
            driver_phone: &ref_21
              type: string
              nullable: true
            registration_plate: &ref_22
              type: string
              nullable: true
            carrier_email: &ref_23
              type: string
              nullable: true
            author_email: &ref_24
              type: string
            author_name: &ref_25
              type: string
            arrived_at: &ref_26
              type: string
              description: Truck arrived timestamp (YYYY-MM-DD HH:MM) in local time
              format: date-time
              examples:
                - 2026-01-25 11:00
              nullable: true
            started_at: *ref_2
            finished_at: *ref_3
            actual_duration: &ref_27
              type: integer
              description: Actual duration in minutes
              nullable: true
          required:
            - duration
          x-apidog-ignore-properties:
            - id
            - dock_id
            - dock_name
            - warehouse_id
            - warehouse_name
            - date
            - time_from
            - time_to
            - duration
            - loading_duration_id
            - reference
            - cargoson_reference
            - supplier
            - goods
            - carrier
            - direction
            - status
            - notes
            - driver_name
            - driver_phone
            - registration_plate
            - carrier_email
            - author_email
            - author_name
            - arrived_at
            - started_at
            - finished_at
            - actual_duration
        - type: object
          properties:
            documents:
              type: array
              items:
                $ref: '#/components/schemas/Document'
          x-apidog-orders:
            - documents
          x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Document:
      type: object
      properties:
        id:
          type: integer
        category:
          type: string
          enum:
            - loading_plan
            - bill_of_lading
            - packing_slip
            - proof_of_loading
            - other
          x-apidog-enum:
            - value: loading_plan
              name: ''
              description: ''
            - value: bill_of_lading
              name: ''
              description: ''
            - value: packing_slip
              name: ''
              description: ''
            - value: proof_of_loading
              name: ''
              description: ''
            - value: other
              name: ''
              description: ''
          examples:
            - bill_of_lading
        filename:
          type: string
          examples:
            - delivery-note.pdf
        content_type:
          type: string
          examples:
            - application/pdf
          enum:
            - application/pdf
            - image/jpeg
            - image/png
            - image/gif
            - text/plain
            - text/csv
            - application/msword
            - >-
              application/vnd.openxmlformats-officedocument.wordprocessingml.document
            - application/vnd.ms-excel
            - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            - application/octet-stream
          x-apidog-enum:
            - value: application/pdf
              name: ''
              description: ''
            - value: image/jpeg
              name: ''
              description: ''
            - value: image/png
              name: ''
              description: ''
            - value: image/gif
              name: ''
              description: ''
            - value: text/plain
              name: ''
              description: ''
            - value: text/csv
              name: ''
              description: ''
            - value: application/msword
              name: ''
              description: ''
            - value: >-
                application/vnd.openxmlformats-officedocument.wordprocessingml.document
              name: ''
              description: ''
            - value: application/vnd.ms-excel
              name: ''
              description: ''
            - value: >-
                application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
              name: ''
              description: ''
            - value: application/octet-stream
              name: ''
              description: ''
        base64:
          type: string
          description: Base64-encoded file content
      x-apidog-orders:
        - id
        - category
        - filename
        - content_type
        - base64
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Loading:
      type: object
      properties:
        id: *ref_4
        dock_id: *ref_5
        dock_name: *ref_6
        warehouse_id: *ref_7
        warehouse_name: *ref_8
        date: *ref_9
        time_from: *ref_10
        time_to: *ref_11
        duration: *ref_12
        loading_duration_id: *ref_13
        reference: *ref_14
        cargoson_reference: *ref_15
        supplier: *ref_16
        goods: *ref_17
        carrier: *ref_18
        direction: *ref_1
        status: *ref_0
        notes: *ref_19
        driver_name: *ref_20
        driver_phone: *ref_21
        registration_plate: *ref_22
        carrier_email: *ref_23
        author_email: *ref_24
        author_name: *ref_25
        arrived_at: *ref_26
        started_at:
          type: string
          format: date-time
          examples:
            - 2026-01-25 12:00
          description: Loading started timestamp (YYYY-MM-DD HH:MM) in local time
          nullable: true
        finished_at:
          type: string
          format: date-time
          examples:
            - 2026-01-25 12:30
          description: Loading finished timestamp (YYYY-MM-DD HH:MM) in local time
          nullable: true
        actual_duration: *ref_27
      x-apidog-orders:
        - id
        - dock_id
        - dock_name
        - warehouse_id
        - warehouse_name
        - date
        - time_from
        - time_to
        - duration
        - loading_duration_id
        - reference
        - cargoson_reference
        - supplier
        - goods
        - carrier
        - direction
        - status
        - notes
        - driver_name
        - driver_phone
        - registration_plate
        - carrier_email
        - author_email
        - author_name
        - arrived_at
        - started_at
        - finished_at
        - actual_duration
      required:
        - duration
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          examples:
            - - Access forbidden
      x-apidog-orders:
        - errors
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    BearerAuth:
      type: bearer
      scheme: bearer
      description: API key obtained from the Developers section
servers:
  - url: https://loadingcalendar-staging.herokuapp.com/api/v1
    description: Testing Env
  - url: https://www.loadingcalendar.com/api/v1
    description: Prod Env
security: []

```