{
  "openapi": "3.0.1",
  "info": {
    "version": "1.10.0",
    "title": "RPIS Cargo API",
    "description": "\n\n\n### The RPIS Cargo API is an HTTPS REST API. It is the interface that RheinPorts uses to receive cargo status updates from terminal and barge operators.\n\n![Overview diagram](overview.svg \"Overvew Diagram\")\n\n\n#### These steps let you manage your customs declarations efficiently and systematically via the RPIS Cargo API\n\n1. The RPIS user creates a voyage<br/>\n- The correct voyage ID must be entered, because it is shared between all logistics partners.\n- The slot at the terminal must be confirmed by the terminal operator for the registration with customs to succeed.\n<br/>\n\n2. Keep RPIS up to date with the cargo planning:\n\n<table>\n    <thead>\n        <tr>\n            <th>Update Type</th>\n            <th>API Endpoint</th>\n        </tr>\n    </thead>\n    <tbody>\n        <tr>\n            <td rowspan=1>Sending loading and discharge lists</td>\n            <td rowspan=1>\n                <div class=\"td-divider\">\n                    <span class=\"api-post\">POST</span>\n                    <span class=\"api-endpoint\">cargo-move-list</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span>NB: <a href=\"#move-list-updates\">Move List Updates</a></span>\n                </div>\n            </td>\n        </tr>\n        <tr>\n            <td>Updating a specific item</td>\n            <td>\n                <div class=\"td-divider\">\n                    <span class=\"api-put\">PUT</span>\n                    <span class=\"api-endpoint\">cargo-item-by-container-no</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span class=\"api-put\">PUT</span>\n                    <span class=\"api-endpoint\">cargo-item-by-bulk-id</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span>NB: <a href=\"#cargo-item-reference-options\">Cargo Item Reference Options</a></span>\n                </div>\n            </td>\n        </tr>\n    </tbody>\n</table>\n\n3. Let us know the progress of your handling.\n\n<table>\n    <thead>\n        <tr>\n            <th>Update Type</th>\n            <th>API Endpoint</th>\n        </tr>\n    </thead>\n    <tbody>\n        <tr>\n            <td>Submit a handling event</td>\n            <td>\n                <div class=\"td-divider\">\n                    <span class=\"api-post\">POST</span>\n                    <span class=\"api-endpoint\">handling-event-by-container-no</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span class=\"api-post\">POST</span>\n                    <span class=\"api-endpoint\">handling-event-by-bulk-id</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span>NB: <a href=\"#zoll-risiko-analyze\">Customs Risk Analysis</a></span>\n                </div>\n            </td>\n        </tr>\n    </tbody>\n</table>\n\n4. Status updates on your cargo at Swiss customs can be retrieved via the following endpoints:\n\n<table>\n    <thead>\n        <tr>\n            <th>Request Type</th>\n            <th>API Endpoint</th>\n        </tr>\n    </thead>\n    <tbody>\n        <tr>\n            <td>For information about the entire cargo list</td>\n            <td>\n                <div class=\"td-divider\">\n                    <span class=\"api-get\">GET</span>\n                    <span class=\"api-endpoint\">ch-customs-list</span>\n                </div>\n            </td>\n        </tr>\n        <tr>\n            <td>For information about individual items</td>\n            <td>\n                <div class=\"td-divider\">\n                    <span class=\"api-get\">GET</span>\n                    <span class=\"api-endpoint\">ch-customs-item-by-container-no</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span class=\"api-get\">GET</span>\n                    <span class=\"api-endpoint\">ch-customs-item-by-bulk-id</span>\n                </div>\n                <div class=\"td-divider\">\n                    <span>NB: <a href=\"#cargo-item-reference-options\">Cargo Item Reference Options</a></span>\n                </div>\n            </td>\n        </tr>\n    </tbody>\n</table>\n\n#### Guidelines for using the API\n\nSo that the RPIS Cargo API can successfully register your cargo with the customs API, the following guidelines must be observed:\n\n- The vessel must exist in RPIS and have the AIS connection enabled.\n- The voyage must exist in RPIS, with the correct vessel and approximately the right ETA.\n- If you are both loading and discharging cargo, there is an import voyage and an export voyage. These have separate voyage IDs and must both be registered separately in RPIS.\n- There must be a **confirmed** slot booking at the terminal that registers the transport.\n- The voyage ID of the voyage in RPIS must match the voyage ID that you use in the API calls (e.g. cargo-move-list).\n- The container must be defined in a cargo move list that has been sent to RPIS.\n- An MRN number must be correctly configured in the customs objects of the containers in the cargo move list.\n- The final cargo move list must have been received before the vessel passes the tri-border corner (Dreiländereck).\n- The transport declaration must be in the status \"TRANSPORT_DECLARATION_ACCEPTED\" before handling events are sent.\n\n#### Process\n\nThe registration phases with Passar run as follows:\n- The initial declaration takes place as soon as:\n  * the ETA is less than 21 days in the future\n  * a valid cargo move list has been reported\n- Activation / risk analysis takes place as soon as:\n  * the handling event is sent to RPIS (export)\n  * the vessel passes the tri-border corner (import)\n- Release / inspection\n\n#### Updates\n\n<table>\n    <thead>\n        <tr>\n            <th>Update Type</th>\n            <th>Possible until</th>\n        </tr>\n    </thead>\n    <tbody>\n        <tr>\n            <td rowspan=1>Updates via the cargo move list</td>\n            <td>Can be sent up until the initial declaration. Updates to cargo-move-list REPLACE the entire list. Information sent previously about specific containers or cargo items in this voyage is overwritten.</td>\n        </tr>\n        <tr>\n            <td rowspan=1>Updates via the single container endpoints</td>\n            <td>Possible until activation.</td>\n        </tr>\n    </tbody>\n</table>\n\n#### Cargo Item Reference Options\n\nWhen using the RPIS Cargo API there are two options for referring to individual cargo items:\n\n1. Bulk ID: if you want to use your own internal reference, you must fill in the bulkId attribute when sending the cargo-move-list. If you send an empty bulk ID, one is created for you. To find out the bulk ID, you must call the GET ch-customs-list endpoint with the voyage ID.\n2. Container number: container handlings must be referenced by the container number.\n\n",
    "license": {
      "name": "RPIS API License",
      "url": "https://rpis.eu/privacy"
    },
    "termsOfService": "https://rpis.eu/privacy"
  },
  "servers": [
    {
      "url": "https://test.partner-api.rpis.link"
    }
  ],
  "security": [
    {
      "OAuth2ClientCredentials": []
    }
  ],
  "paths": {
    "/cargo-move-list/v1/{voyage-id}": {
      "post": {
        "security": [
          {
            "OAuth2ClientCredentials": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "vehicle": {
                    "$ref": "#/components/schemas/vehicleRequest"
                  },
                  "handling": {
                    "$ref": "#/components/schemas/handlingRequest"
                  },
                  "cargo": {
                    "$ref": "#/components/schemas/cargoRequest"
                  }
                },
                "required": [
                  "vehicle",
                  "handling",
                  "cargo"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Loading list or discharge list",
        "description": "<img src=\"cargo-move-list.svg\"/><br/>The /cargo-move-list endpoint is used to submit loading and discharge lists, including the current status.",
        "operationId": "post-cargo-move-list"
      }
    },
    "/ch-customs-list/v1/{voyage-id}/terminal-location/{terminal-location}": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/chCustomsListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Customs status of loading and discharge lists",
        "description": "<img src=\"ch-customs-list.svg\"/><br/>The /ch-customs-list endpoint is used to retrieve loading and discharge lists, including the current status.",
        "operationId": "get-ch-customs-list"
      }
    },
    "/cargo-item-by-container-no/v1/{voyage-id}/container/{container-no}": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "vehicle": {
                    "$ref": "#/components/schemas/vehicleRequest"
                  },
                  "handling": {
                    "$ref": "#/components/schemas/handlingRequest"
                  },
                  "container": {
                    "$ref": "#/components/schemas/containerRequest"
                  }
                },
                "required": [
                  "vehicle",
                  "handling",
                  "container"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/container-no"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "description": "<img src=\"cargo-update-item.svg\"/><br/>The /cargo-item-by-container-no endpoint is used to update RPIS about the planned container.",
        "summary": "Report or update a container",
        "operationId": "put-cargo-item-by-container-no"
      }
    },
    "/cargo-item-by-container-no/v1/{voyage-id}/terminal-location/{terminal-location}/container/{container-no}": {
      "delete": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/container-no"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "description": "<img src=\"cargo-update-item.svg\"/><br/>The /cargo-item-by-container-no endpoint is used with the DELETE method to remove a container from the list.",
        "summary": "Deregister a container",
        "operationId": "delete-cargo-item-by-container-no"
      }
    },
    "/cargo-item-by-bulk-id/v1/{voyage-id}/bulk-id/{bulk-id}": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "vehicle": {
                    "$ref": "#/components/schemas/vehicleRequest"
                  },
                  "handling": {
                    "$ref": "#/components/schemas/handlingRequest"
                  },
                  "bulk": {
                    "$ref": "#/components/schemas/bulkRequest"
                  }
                },
                "required": [
                  "vehicle",
                  "handling",
                  "bulk"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/bulk-id"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Report or update bulk cargo",
        "description": "The PUT cargo-item-by-bulk-id endpoint is used to update RPIS with the status of a cargo item",
        "operationId": "put-cargo-item-by-bulk-id"
      }
    },
    "/cargo-item-by-bulk-id/v1/{voyage-id}/terminal-location/{terminal-location}/bulk-id/{bulk-id}": {
      "delete": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/bulk-id"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Deregister bulk cargo",
        "description": "The DELETE bulkcargoitem endpoint is used to remove bulk cargo from the list.",
        "operationId": "delete-cargo-item-by-bulk-id"
      }
    },
    "/handling-event-by-container-no/v1/{voyage-id}/terminal-location/{terminal-location}/container/{container-no}": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "handlingEvent": {
                    "$ref": "#/components/schemas/handlingEventRequest"
                  }
                },
                "required": [
                  "handlingEvent"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/container-no"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Report a container handling",
        "description": "<img src=\"ch-customs-item-notify.svg\"/><br/>The /handling-event-by-container-no endpoint is used to inform RPIS that a handling event has occurred.",
        "operationId": "post-handling-event-by-container-no"
      }
    },
    "/handling-event-by-bulk-id/v1/{voyage-id}/terminal-location/{terminal-location}/bulk-id/{bulk-id}": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "handlingEvent": {
                    "$ref": "#/components/schemas/handlingEventRequest"
                  }
                },
                "required": [
                  "handlingEvent"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/bulk-id"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Report a bulk cargo handling",
        "description": "<img src=\"ch-customs-item-notify.svg\"/><br/>The /handling-event-by-bulk-id endpoint is used to inform RPIS that a handling event has occurred.",
        "operationId": "post-handling-event-by-bulk-id"
      }
    },
    "/transport-event-by-terminal-location/v1/{voyage-id}/terminal-location/{terminal-location}": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "transportEvent": {
                    "$ref": "#/components/schemas/transportEventRequest"
                  }
                }
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Success"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Report a transport event",
        "description": "<img src=\"ch-customs-item-notify.svg\"/><br/>The /transport-event-by-terminal-location endpoint is used to inform RPIS that a transport event has occurred.",
        "operationId": "post-transport-event-by-terminal-location"
      }
    },
    "/ch-customs-item-by-container-no/v1/{voyage-id}/terminal-location/{terminal-location}/container/{container-no}": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/container-no"
          }
        ],
        "responses": {
          "200": {
            "description": "Success!",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/chCustomsItemByContainerNoResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Customs status of a container",
        "description": "<img src=\"ch-customs-item.svg\"/><br/>The /ch-customs-item-by-container-no endpoint is used to query the status of a cargo item",
        "operationId": "get-ch-customs-item-by-container-no"
      }
    },
    "/ch-customs-item-by-bulk-id/v1/{voyage-id}/terminal-location/{terminal-location}/bulk-id/{bulk-id}": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/bulk-id"
          }
        ],
        "responses": {
          "200": {
            "description": "Success!",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/chCustomsItemByBulkIdResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Customs status of a bulk unit",
        "description": "The /ch-customs-item-by-bulk-id endpoint is used to query the status of a cargo item",
        "operationId": "get-ch-customs-item-by-bulk-id"
      }
    },
    "/ch-customs-event-history/v1/{voyage-id}": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/voyage-id"
          },
          {
            "name": "loadingUnitId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Specify a container number or bulk ID"
          },
          {
            "name": "terminalLocation",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/terminalLocation"
            },
            "description": "Optional restriction by terminal"
          }
        ],
        "responses": {
          "200": {
            "description": "The event history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "title": "TransportDeclarationEvent",
                    "description": "An event that has occurred in the transport declaration to customs",
                    "discriminator": {
                      "propertyName": "type"
                    },
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/TransportDeclarationCreated"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationUpdated"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationUpdatedFromSlotBooking"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationAmendmentInitiatedFromSlotBooking"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationDiscarded"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationSent"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationAmendmentInitiated"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationAccepted"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationBorderArrivalReported"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationBorderArrivalAccepted"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationSelectedForInspection"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationReleased"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationAmendmentAccepted"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationAmendmentRejected"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationWithdrawalInitiated"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationWithdrawalAccepted"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationSlotBookingCancelled"
                      },
                      {
                        "$ref": "#/components/schemas/TransportDeclarationError"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "History of the customs declarations for a voyage",
        "description": "The /ch-customs-event-history endpoint is used to query the history of all customs events for a voyage",
        "operationId": "get-ch-customs-event-history-by-voyage"
      }
    },
    "/slot-bookings-by-terminal/v1/{terminal-location}/search": {
      "get": {
        "security": [
          {
            "OAuth2ClientCredentials": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/terminal-location"
          },
          {
            "$ref": "#/components/parameters/eni"
          },
          {
            "$ref": "#/components/parameters/eta-from"
          },
          {
            "$ref": "#/components/parameters/eta-to"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/stopsSearchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "summary": "Search voyage stops",
        "description": "The /slot-bookings-by-terminal/v1/{terminal-location}/search endpoint is used to search for voyage stops at a terminal.\n\n**Authorization**: The terminal must belong to the company (the CompanyId is derived from the token).",
        "operationId": "get-slot-bookings-by-terminal-id-search"
      }
    },
    "/Changelog": {
      "get": {
        "security": [
          {
            "OAuth2ClientCredentials": []
          }
        ],
        "summary": "Revision History",
        "description": "### Revision History\n- **1.0.0** (2025-01-10): Initial release\n- **1.0.1** (2025-01-28): New /transport-event-by-terminal-location endpoint\n- **1.0.2** (2025-02-12) Minor documentation improvements\n- **1.0.3** (2025-02-26) Review and update of mandatory fields in cargo-move-list. Improved error format with validation errors\n- **1.0.4** (2025-02-27) Added WAITING_FOR_CONSOLE enum to customs status. Stricter definition of voyage-id parameter\n- **1.0.5** (2025-03-11) Added 404 to cargo-move-list. Refined quantity rules to allow multiple weights and forbid un number 0000\n- **1.0.6** (2025-03-17) Changed WAITING_FOR_CONSOLE to WAIT_FOR_CONTROL\n- **1.0.7** (2025-03-25)\n  * Set maximum length of voyageId to 50\n  * Barge name (if present) cannot be pure whitespace or begin with a space\n  * Added invoiceRecipient to otherTransportDetails\n  * Added 30_FT to container type enums\n- **1.0.8** (2025-03-28) Weights can be accurate to 3dp\n- **1.0.9** (2025-04-02) Add terminal location parameter to ch-customs-list\n- **1.0.10** (2025-04-04)\n  * Correct MRN Number format\n  * MMSI or ENI must be present, name alone not sufficient\n- **1.0.11** (2025-04-08)\n  * New customs status enums / descriptions\n  * ISO date-time-string pattern\n  * Type definitions for types missing definitions\n- **1.0.12** (2025-04-30)\n  * Correct placement of array limits definitions\n- **1.0.13** (2025-05-08)\n  * Use date-time format instead of regex pattern\n  * Add enum also at property level for handling action\n  * Consolidate chCustomsList and chCustomsItem definition schemas\n  * Use additionalProperties: false to restrict schema to expected values\n- **1.0.14** (2025-05-15)\n  * Add type: object and disable additionalProperties for handlingEventRequests\n  * Make handlingEvent a required element for handlingEventRequest\n- **1.0.15** (2025-07-03)\n  * Add delete cargo item commands\n  * Add hazardNumber to dangerous goods\n  * Correct the regex for dangerousGoods.classification\n  * Now optional: handling.eta|etd in cargo-move-list\n  * Add FT_23, FT_25 container types\n  * Remove lowercase letters from terminal location regex\n- **1.2.0** (2025-11-18)\n  * Add new AMEND_INITIATED chCustomsStatus\n- **1.3.0** (2025-11-05)\n  * Add new required parameter terminalLocation to /ch-customs-item-by-container-no and /ch-customs-item-by-bulk-id endpoint\n  * Add new parameter terminalLocation to /handling-event-by-container-no and /handling-event-by-bulk-id endpoint\n  * Add new optional parameters container, terminalLocation to /ch-customs-event-history endpoint\n- **1.4.0** (2025-11-28)\n  * Added new event history event slot booking updates\n  * JourneyReferenceNumber is now only contained in the TransportDeclarationAccepted of the event-history\n- **1.5.0** (2026-01-15)\n  * Smallest length of contents array is 0 (empty)\n- **1.6.0** (2026-03-09)\n  * Added slot-booking query endpoint\n- **1.7.0** (2026-06-01)\n  * Skipped\n- **1.8.0** (2026-06-01)\n  * Dangerous Goods arrays instead of single objects\n  * No longer optional: borderClearanceRequired\n- **1.10.0** (2026-07-22)\n  * ch-customs-event-history.containerNumber -> loadingUnitId\n  * journeyReferenceNumber -> passarJourneyReference w/  number + version",
        "operationId": "revision-history",
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": ""
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Success": {
        "description": "Success!",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Empty"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Bad Request - This could be a validation error, bad parameters, or missing parameters",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ServerError": {
        "description": "Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden - The terminal does not belong to the company",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Empty": {
        "type": "object",
        "additionalProperties": false,
        "properties": {}
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message describing the type of error"
          },
          "errors": {
            "type": "object"
          },
          "path": {
            "type": "string",
            "description": "Resource path where the error occurred"
          },
          "requestId": {
            "type": "string",
            "description": "Unique request identifier for troubleshooting"
          }
        }
      },
      "vehicleRequest": {
        "title": "vehicle",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "barge": {
            "title": "barge",
            "type": "array",
            "minItems": 1,
            "maxItems": 9,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "title": "name",
                  "type": "string",
                  "pattern": "^\\S+.*$",
                  "minLength": 1,
                  "description": "The name of the barge"
                },
                "mmsi": {
                  "title": "mmsi",
                  "type": "string",
                  "pattern": "^\\d{9}$",
                  "description": "The MMSI number of the barge"
                },
                "eni": {
                  "title": "eni",
                  "type": "string",
                  "pattern": "^\\d{8}$",
                  "description": "The ENI number of the barge"
                }
              },
              "description": "A barge",
              "anyOf": [
                {
                  "title": "mmsi",
                  "required": [
                    "mmsi"
                  ]
                },
                {
                  "title": "eni",
                  "required": [
                    "eni"
                  ]
                }
              ]
            },
            "description": "Details of a barge"
          }
        },
        "required": [
          "barge"
        ],
        "description": "This object must define a barge"
      },
      "handlingRequest": {
        "title": "handling",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action": {
            "title": "action",
            "type": "string",
            "description": "Whether the list is a loading or a discharge list",
            "enum": [
              "LOAD",
              "UNLOAD"
            ]
          },
          "location": {
            "$ref": "#/components/schemas/terminalLocation"
          },
          "eta": {
            "allOf": [
              {
                "$ref": "#/components/schemas/dateTimeString"
              },
              {
                "description": "The ETA at the handling location<br/><i>ISO 8601 date-time string with time zone"
              }
            ]
          },
          "etd": {
            "allOf": [
              {
                "$ref": "#/components/schemas/dateTimeString"
              },
              {
                "description": "The ETD from the handling location<br/><i>ISO 8601 date-time string with time zone"
              }
            ]
          }
        },
        "required": [
          "action",
          "location"
        ],
        "description": "The handling object contains details of the time, place and direction of the handling"
      },
      "cargoRequest": {
        "title": "cargo",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "bulk": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/bulkRequest"
            }
          },
          "containers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/containerRequest"
            }
          }
        },
        "description": "All details of the cargo and its packaging"
      },
      "containerRequest": {
        "title": "container",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "grossWeight": {
            "title": "grossWeight",
            "type": "number",
            "multipleOf": 0.001,
            "description": "The weight of the container and all its contents"
          },
          "netWeight": {
            "title": "netWeight",
            "type": "number",
            "multipleOf": 0.001,
            "description": "The weight of all the container contents"
          },
          "tareWeight": {
            "title": "tareWeight",
            "type": "number",
            "multipleOf": 0.001,
            "description": "The weight of the empty container"
          },
          "loadingUnit": {
            "title": "loadingUnit",
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "owner": {
                "title": "owner",
                "type": "string",
                "description": "The owner of the container"
              },
              "containerNumber": {
                "$ref": "#/components/schemas/containerNumber"
              },
              "containerType": {
                "$ref": "#/components/schemas/containerType"
              },
              "loadingState": {
                "title": "loadingState",
                "type": "string",
                "description": "The loading state of the container",
                "enum": [
                  "FULL",
                  "EMPTY"
                ]
              }
            },
            "required": [
              "containerNumber",
              "loadingState"
            ],
            "description": "Details that relate specifically to the physical container"
          },
          "contents": {
            "title": "contents",
            "type": "array",
            "minItems": 0,
            "maxItems": 999,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "description": {
                  "title": "description",
                  "type": "string",
                  "description": "Free-text description of the cargo contents"
                },
                "grossWeight": {
                  "title": "grossWeight",
                  "type": "number",
                  "multipleOf": 0.001,
                  "description": "The total weight of this item including packaging"
                },
                "netWeight": {
                  "title": "netWeight",
                  "type": "number",
                  "multipleOf": 0.001,
                  "description": "The weight of the goods without packaging"
                },
                "tareWeight": {
                  "title": "tareWeight",
                  "type": "number",
                  "multipleOf": 0.001,
                  "description": "The weight of the packaging"
                },
                "customs": {
                  "$ref": "#/components/schemas/customs"
                },
                "dangerousGoods": {
                  "title": "dangerousGoods",
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/dangerousGoods"
                  }
                }
              },
              "description": ""
            },
            "description": "Detailed information about the contents of the container"
          },
          "sealNumbers": {
            "title": "sealNumbers",
            "type": "array",
            "minItems": 0,
            "maxItems": 999,
            "items": {
              "maxLength": 64,
              "type": "string"
            }
          },
          "otherTransportDetails": {
            "$ref": "#/components/schemas/otherTransportDetails"
          }
        },
        "required": [
          "loadingUnit"
        ],
        "description": "If containers are being transported, the details should be entered in this object"
      },
      "bulkRequest": {
        "title": "bulk",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "description": {
            "title": "description",
            "type": "string",
            "description": "Free-text description of the cargo contents"
          },
          "type": {
            "title": "type",
            "type": "string",
            "description": "Whether the bulk cargo is dry bulk, break bulk or liquid bulk",
            "enum": [
              "DRY",
              "BREAK",
              "LIQUID"
            ]
          },
          "bulkId": {
            "title": "bulkId",
            "type": "string",
            "description": "The bulk ID must uniquely identify your cargo item within the cargo list"
          },
          "quantity": {
            "title": "quantity",
            "type": "object",
            "additionalProperties": false,
            "anyOf": [
              {
                "title": "count",
                "required": [
                  "count"
                ]
              },
              {
                "title": "grossWeight",
                "required": [
                  "grossWeight"
                ]
              },
              {
                "title": "netWeight",
                "required": [
                  "netWeight"
                ]
              },
              {
                "title": "volume",
                "required": [
                  "volume"
                ]
              },
              {
                "title": "tareWeight",
                "required": [
                  "tareWeight"
                ]
              }
            ],
            "properties": {
              "count": {
                "title": "count",
                "type": "integer",
                "minimum": 1,
                "description": "If break bulk is being transported, the number of items should be entered here"
              },
              "grossWeight": {
                "title": "grossWeight",
                "type": "number",
                "multipleOf": 0.001,
                "description": "For break bulk, the grossWeight is the weight of the item plus pallets and packaging<br/><b>Units / precision</b>: kilograms to 3 decimal places (smallest possible weight 1 gram)<br/><b>Decimal separator</b>: the comma is the decimal separator"
              },
              "netWeight": {
                "title": "netWeight",
                "type": "number",
                "multipleOf": 0.001,
                "description": "For dry bulk, liquid bulk or break bulk, the netWeight is the weight of the goods without packaging"
              },
              "volume": {
                "title": "volume",
                "type": "integer",
                "minimum": 1,
                "description": "For liquid bulk, the volume is the volume of the liquid in litres"
              },
              "tareWeight": {
                "title": "tareWeight",
                "type": "number",
                "multipleOf": 0.001,
                "description": "For dry bulk, liquid bulk or break bulk, the tareWeight is the weight of the packaging"
              }
            }
          },
          "customs": {
            "$ref": "#/components/schemas/customs"
          },
          "dangerousGoods": {
            "title": "dangerousGoods",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/dangerousGoods"
            }
          },
          "otherTransportDetails": {
            "$ref": "#/components/schemas/otherTransportDetails"
          }
        },
        "required": [
          "description",
          "type",
          "bulkId",
          "quantity"
        ],
        "description": "If bulk cargo is being transported, the details should be entered in this object"
      },
      "customs": {
        "title": "customs",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "goodsDeclarationIdReference": {
            "$ref": "#/components/schemas/goodsDeclarationIdReference"
          },
          "borderClearanceRequired": {
            "title": "borderClearanceRequired",
            "type": "boolean",
            "description": "<p/>ZV / ZE - borderClearanceRequired is set to 'false'<p/>All other circumstances will set borderClearanceRequired to 'true'"
          }
        },
        "required": [
          "goodsDeclarationIdReference",
          "borderClearanceRequired"
        ],
        "description": "The customs object contains all details for the customs clearance of the goods<p/>Mandatory for the customs declaration!"
      },
      "dangerousGoods": {
        "title": "dangerousGoods",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "unNumber": {
            "title": "unNumber",
            "type": "string",
            "pattern": "^(?!0000)\\d{4}$",
            "description": "The UN number is a four-digit code identifying dangerous substances and goods"
          },
          "hazardNumber": {
            "title": "hazard Identification Number",
            "type": "string",
            "pattern": "^X?[0-9]{1,3}$",
            "description": "Hazard identification number (Kemler code) indicating the type of hazard in dangerous goods transport"
          },
          "classification": {
            "title": "classification",
            "type": "string",
            "pattern": "^[1-9](\\.[1-6])?$",
            "description": "The hazard class indicates the type of danger posed by a substance or item, e.g. “Class 3: Flammable”"
          },
          "packagingGroup": {
            "title": "packagingGroup",
            "type": "string",
            "description": "The packaging group indicates how dangerous a substance is and assigns it to group I (high danger), II (medium danger) or III (low danger)"
          }
        },
        "description": ""
      },
      "otherTransportDetails": {
        "title": "otherTransportDetails",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "previousModeOfTransport": {
            "title": "previousModeOfTransport",
            "type": "string",
            "description": "The mode of transport used before the handling",
            "enum": [
              "TRUCK",
              "RAIL",
              "SHIP",
              "WAREHOUSE"
            ]
          },
          "nextModeOfTransport": {
            "title": "nextModeOfTransport",
            "type": "string",
            "description": "The mode of transport used after the handling",
            "enum": [
              "TRUCK",
              "RAIL",
              "SHIP",
              "WAREHOUSE"
            ]
          },
          "previousHandlingLocation": {
            "title": "previousHandlingLocation",
            "type": "string",
            "description": "The location of the previous handling"
          },
          "nextHandlingLocation": {
            "title": "nextHandlingLocation",
            "type": "string",
            "description": "The location of the next handling"
          },
          "origin": {
            "title": "origin",
            "type": "string",
            "description": "The origin of the goods"
          },
          "destination": {
            "title": "destination",
            "type": "string",
            "description": "The final destination of the goods"
          },
          "specialGroups": {
            "title": "specialGroups",
            "type": "string",
            "enum": [
              "NEW_GOODS",
              "RECYCLING"
            ],
            "description": "Whether a goods item belongs to a special group (Basel)"
          },
          "invoiceRecipient": {
            "title": "invoiceRecipient",
            "type": "string",
            "description": "The intended recipient of the invoice for the port billing"
          },
          "oceanVessel": {
            "title": "oceanVessel",
            "type": "string",
            "description": "The name of the vessel for goods that are to be exported by deep-sea transport"
          },
          "cargoOpening": {
            "allOf": [
              {
                "$ref": "#/components/schemas/dateTimeString"
              },
              {
                "description": "The earliest loading time of the cargo for goods that are to be exported by deep-sea transport<br/><i>ISO 8601 date-time string with time zone"
              }
            ]
          },
          "cargoClosing": {
            "allOf": [
              {
                "$ref": "#/components/schemas/dateTimeString"
              },
              {
                "description": "The latest loading time of the cargo for goods that are to be exported by deep-sea transport<br/><i>ISO 8601 date-time string with time zone"
              }
            ]
          }
        },
        "description": ""
      },
      "handlingEventRequest": {
        "title": "handlingEvent",
        "type": "string",
        "enum": [
          "PRELIMINARY_LOADING",
          "CONFIRMED_LOADING",
          "PRELIMINARY_DISCHARGE",
          "CONFIRMED_DISCHARGE",
          "CARGO_ON_SITE"
        ],
        "description": "The handling event informs RPIS of the current processing state of the cargo object"
      },
      "transportEventRequest": {
        "title": "transportEvent",
        "type": "string",
        "enum": [
          "VEHICLE_ARRIVAL",
          "HANDLING_START",
          "HANDLING_PAUSE",
          "HANDLING_COMPLETE",
          "VEHICLE_DEPARTURE"
        ],
        "description": "The transport event informs RPIS of the current processing state of the transport stop of a voyage"
      },
      "chCustomsItem": {
        "type": "object",
        "description": "",
        "additionalProperties": false,
        "required": [
          "loadingUnitId"
        ],
        "properties": {
          "chCustomsStatus": {
            "$ref": "#/components/schemas/chCustomsStatus"
          },
          "loadingUnitId": {
            "$ref": "#/components/schemas/loadingUnitId"
          },
          "passarJourneyReference": {
            "$ref": "#/components/schemas/passarJourneyReference"
          },
          "goods": {
            "type": "array",
            "description": "The list of goods",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "properties": {
                "description": {
                  "description": "Description of the goods",
                  "type": "string"
                },
                "goodsDeclarationIdReference": {
                  "$ref": "#/components/schemas/goodsDeclarationIdReference"
                }
              }
            }
          }
        }
      },
      "chCustomsListResponse": {
        "type": "array",
        "description": "",
        "items": {
          "$ref": "#/components/schemas/chCustomsItem"
        }
      },
      "chCustomsItemByContainerNoResponse": {
        "type": "object",
        "description": "",
        "additionalProperties": false,
        "required": [
          "containerNumber"
        ],
        "properties": {
          "chCustomsStatus": {
            "$ref": "#/components/schemas/chCustomsStatus"
          },
          "containerNumber": {
            "$ref": "#/components/schemas/containerNumber"
          },
          "passarJourneyReference": {
            "$ref": "#/components/schemas/passarJourneyReference"
          },
          "goods": {
            "type": "array",
            "description": "The list of goods",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "properties": {
                "description": {
                  "description": "Description of the goods",
                  "type": "string"
                },
                "goodsDeclarationIdReference": {
                  "$ref": "#/components/schemas/goodsDeclarationIdReference"
                }
              }
            }
          }
        }
      },
      "chCustomsItemByBulkIdResponse": {
        "type": "object",
        "description": "",
        "additionalProperties": false,
        "required": [
          "bulkId"
        ],
        "properties": {
          "chCustomsStatus": {
            "$ref": "#/components/schemas/chCustomsStatus"
          },
          "bulkId": {
            "type": "string",
            "description": "The bulk ID"
          },
          "passarJourneyReference": {
            "$ref": "#/components/schemas/passarJourneyReference"
          },
          "goods": {
            "type": "array",
            "description": "The list of goods",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "properties": {
                "description": {
                  "description": "Description of the goods",
                  "type": "string"
                },
                "goodsDeclarationIdReference": {
                  "$ref": "#/components/schemas/goodsDeclarationIdReference"
                }
              }
            }
          }
        }
      },
      "goodsDeclarationIdReference": {
        "title": "goodsDeclarationIdReference",
        "type": "string",
        "pattern": "^[0-9]{2}[A-Z]{2}[A-Za-z0-9]{14}$",
        "description": "Mandatory for the customs declaration! The goodsDeclarationIdReference contains the MRN number"
      },
      "passarJourneyReference": {
        "type": "object",
        "description": "Journey reference for the Swiss customs authorities",
        "additionalProperties": false,
        "required": [
          "number",
          "version"
        ],
        "properties": {
          "number": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{9}$",
            "description": "Journey reference number – 9 alphanumeric characters"
          },
          "version": {
            "type": "integer",
            "description": "The version of the journey reference number"
          }
        }
      },
      "chCustomsStatus": {
        "type": "string",
        "enum": [
          "NEW",
          "DISCARDED",
          "TRANSPORT_DECLARATION_SENT",
          "TRANSPORT_DECLARATION_ACCEPTED",
          "TRANSPORT_DECLARATION_REJECTED",
          "AMEND_INITIATED",
          "AMENDMENT_REJECTED",
          "BORDER_ARRIVAL",
          "AWAITING_INSPECTION_DECISION",
          "SELECTED_FOR_INSPECTION",
          "RELEASED",
          "WITHDRAWAL_INITIATED",
          "WITHDRAWN"
        ],
        "description": "The customs status of the cargo item"
      },
      "dateTimeString": {
        "type": "string",
        "format": "date-time"
      },
      "terminalLocation": {
        "description": "UNLOCODE and Terminal Location Code",
        "type": "string",
        "pattern": "^[A-Z0-9]{5}\\+[A-Z0-9]{5}$"
      },
      "loadingUnitId": {
        "description": "The ID of the loading unit",
        "type": "string"
      },
      "containerNumber": {
        "title": "containerNumber",
        "description": "The container number according to ISO 6346 including the check digit (BIC code)",
        "type": "string",
        "pattern": "^[A-Z]{3}[UJZ][0-9]{7}$"
      },
      "containerType": {
        "title": "containerType",
        "type": "string",
        "description": "The container type",
        "enum": [
          "FT_10",
          "FT_20",
          "FT_23",
          "FT_25",
          "FT_30",
          "FT_40",
          "FT_45"
        ]
      },
      "countryCode": {
        "type": "string",
        "pattern": "^[A-Z]{2}$"
      },
      "voyageId": {
        "description": "Identifier of the voyage. May contain alphanumeric characters, certain symbols (-, _, ., $, !, (), *) or URL-encoded characters.",
        "type": "string",
        "maxLength": 50,
        "pattern": "^([A-Za-z0-9_\\-\\.\\$\\!\\(\\)\\*]|(%[0-9A-Fa-f]{2}))+$"
      },
      "TransportDeclarationVessel": {
        "required": [
          "vesselFlag"
        ],
        "properties": {
          "vesselFlag": {
            "$ref": "#/components/schemas/countryCode"
          },
          "eni": {
            "type": "string",
            "pattern": "^\\d{8}$"
          },
          "mmsi": {
            "type": "string",
            "pattern": "^\\d{9}$"
          }
        }
      },
      "TransportDeclarationGood": {
        "required": [
          "goodsDeclarationId",
          "borderClearance"
        ],
        "properties": {
          "goodsDeclarationId": {
            "$ref": "#/components/schemas/goodsDeclarationIdReference"
          },
          "borderClearance": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "CommonTransportDeclarationEventProperties": {
        "required": [
          "type",
          "timestamp",
          "voyageId",
          "loadingUnitId"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "timestamp": {
            "$ref": "#/components/schemas/dateTimeString"
          },
          "voyageId": {
            "$ref": "#/components/schemas/voyageId"
          },
          "loadingUnitId": {
            "$ref": "#/components/schemas/loadingUnitId"
          }
        }
      },
      "CommonTransportDeclarationSlotBookingEventProperties": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "vesselName",
              "vesselFlag",
              "eta"
            ],
            "properties": {
              "vesselName": {
                "type": "string"
              },
              "vesselFlag": {
                "$ref": "#/components/schemas/countryCode"
              },
              "eni": {
                "type": "string",
                "pattern": "^\\d{8}$"
              },
              "eta": {
                "$ref": "#/components/schemas/dateTimeString"
              }
            }
          }
        ]
      },
      "TransportDeclarationCreated": {
        "description": "The transport declaration has been created initially but not yet submitted to customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "direction",
              "terminal",
              "loadingUnitType",
              "goods"
            ],
            "properties": {
              "direction": {
                "type": "string",
                "enum": [
                  "IMPORT",
                  "EXPORT"
                ]
              },
              "vessel": {
                "$ref": "#/components/schemas/TransportDeclarationVessel"
              },
              "terminal": {
                "$ref": "#/components/schemas/terminalLocation"
              },
              "eta": {
                "$ref": "#/components/schemas/dateTimeString"
              },
              "loadingUnitType": {
                "type": "string",
                "enum": [
                  "CONTAINER",
                  "BULK"
                ]
              },
              "container": {
                "required": [
                  "type",
                  "number"
                ],
                "properties": {
                  "type": {
                    "$ref": "#/components/schemas/containerType"
                  },
                  "number": {
                    "$ref": "#/components/schemas/containerNumber"
                  }
                }
              },
              "goods": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TransportDeclarationGood"
                }
              }
            }
          }
        ]
      },
      "TransportDeclarationUpdated": {
        "description": "The transport declaration has been updated",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "terminal",
              "goods"
            ],
            "properties": {
              "vessel": {
                "$ref": "#/components/schemas/TransportDeclarationVessel"
              },
              "terminal": {
                "$ref": "#/components/schemas/terminalLocation"
              },
              "eta": {
                "$ref": "#/components/schemas/dateTimeString"
              },
              "goods": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TransportDeclarationGood"
                }
              }
            }
          }
        ]
      },
      "TransportDeclarationAmendmentInitiated": {
        "description": "An amendment to the transport declaration has been submitted to customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "terminal",
              "goods"
            ],
            "properties": {
              "vessel": {
                "$ref": "#/components/schemas/TransportDeclarationVessel"
              },
              "terminal": {
                "$ref": "#/components/schemas/terminalLocation"
              },
              "eta": {
                "$ref": "#/components/schemas/dateTimeString"
              },
              "goods": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TransportDeclarationGood"
                }
              }
            }
          }
        ]
      },
      "TransportDeclarationUpdatedFromSlotBooking": {
        "description": "The transport declaration has been updated by a slot booking",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationSlotBookingEventProperties"
          }
        ]
      },
      "TransportDeclarationAmendmentInitiatedFromSlotBooking": {
        "description": "The transport declaration has been updated by a slot booking and the amendment is being submitted to customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationSlotBookingEventProperties"
          }
        ]
      },
      "TransportDeclarationSent": {
        "description": "The transport declaration has been submitted to customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationAccepted": {
        "description": "The transport declaration has been accepted by customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "passarJourneyReferenceNumber"
            ],
            "properties": {
              "passarJourneyReferenceNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9]{9}$",
                "description": "Journey reference number – 9 alphanumeric characters"
              },
              "passarJourneyReferenceVersion": {
                "type": "integer",
                "description": "The version of the journey reference number"
              }
            }
          }
        ]
      },
      "TransportDeclarationBorderArrivalReported": {
        "description": "The border arrival has been reported for the loading unit",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationDiscarded": {
        "description": "The transport declaration has been discarded",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationBorderArrivalAccepted": {
        "description": "The border arrival for the loading unit has been registered by customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationSelectedForInspection": {
        "description": "An inspection is being carried out for the loading unit",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationReleased": {
        "description": "The loading unit has been released",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationWithdrawalInitiated": {
        "description": "A withdrawal of the transport declaration has been submitted to customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationWithdrawalAccepted": {
        "description": "A withdrawal of the transport declaration has been accepted by customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationAmendmentAccepted": {
        "description": "The amendment to the transport declaration has been accepted by customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "properties": {
              "passarJourneyReferenceVersion": {
                "type": "integer",
                "description": "The version of the journey reference number for the Swiss customs authorities"
              }
            }
          }
        ]
      },
      "TransportDeclarationAmendmentRejected": {
        "description": "The amendment to the transport declaration has been rejected by customs",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "TransportDeclarationSlotBookingCancelled": {
        "description": "The slot booking for the voyage has been cancelled",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          }
        ]
      },
      "stopsSearchResponse": {
        "type": "array",
        "description": "List of the voyage stops found",
        "items": {
          "$ref": "#/components/schemas/stopItem"
        }
      },
      "stopItem": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "voyageId": {
            "type": "string",
            "description": "The unique identifier of the voyage"
          },
          "eni": {
            "type": "string",
            "pattern": "^\\d{8}$",
            "description": "The ENI number of the vessel"
          },
          "shipName": {
            "type": "string",
            "description": "The name of the vessel"
          },
          "eta": {
            "type": "string",
            "format": "date-time",
            "description": "The expected time of arrival at the terminal (ISO 8601 date-time string)"
          },
          "bulkToDischarge": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of bulk units to discharge"
          },
          "bulkToLoad": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of bulk units to load"
          },
          "containersToDischarge": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of containers to discharge"
          },
          "containersToLoad": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of containers to load"
          }
        },
        "required": [
          "voyageId",
          "eta"
        ]
      },
      "TransportDeclarationError": {
        "description": "An error has occurred",
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonTransportDeclarationEventProperties"
          },
          {
            "required": [
              "errorType"
            ],
            "properties": {
              "errorType": {
                "type": "string"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "title": "TransportDeclarationRejectionReason",
                  "required": [
                    "code",
                    "message",
                    "field"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      }
    },
    "parameters": {
      "voyage-id": {
        "in": "path",
        "name": "voyage-id",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/voyageId"
        }
      },
      "container-no": {
        "in": "path",
        "name": "container-no",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/containerNumber"
        }
      },
      "bulk-id": {
        "in": "path",
        "name": "bulk-id",
        "schema": {
          "type": "string"
        },
        "required": true
      },
      "terminal-location": {
        "in": "path",
        "name": "terminal-location",
        "schema": {
          "$ref": "#/components/schemas/terminalLocation"
        },
        "required": true
      },
      "eni": {
        "in": "query",
        "name": "eni",
        "required": false,
        "schema": {
          "type": "string",
          "pattern": "^\\d{8}$"
        },
        "description": "The ENI number of the vessel (optional, for filtering)"
      },
      "eta-from": {
        "in": "query",
        "name": "etaFrom",
        "required": false,
        "schema": {
          "type": "string",
          "format": "date-time"
        },
        "description": "ETA start date for the search (ISO 8601 date-time string)"
      },
      "eta-to": {
        "in": "query",
        "name": "etaTo",
        "required": false,
        "schema": {
          "type": "string",
          "format": "date-time"
        },
        "description": "ETA end date for the search (ISO 8601 date-time string)"
      }
    },
    "securitySchemes": {
      "OAuth2ClientCredentials": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.example.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  }
}