{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/opentrack/json-schema/opentrack-master-bill-status-schema.json",
  "title": "MasterBillStatus",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/opentrack-api-openapi.yml#/components/schemas/MasterBillStatus",
  "required": [
    "number",
    "scacCode",
    "createdAt",
    "status"
  ],
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "LOCATING",
        "TRACKED",
        "ARCHIVED"
      ]
    },
    "number": {
      "type": "string"
    },
    "scacCode": {
      "type": "string"
    },
    "settings": {
      "type": "object"
    },
    "referenceNumbers": {
      "type": "object"
    },
    "containers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ContainerStatus"
      }
    }
  },
  "$defs": {
    "Account": {
      "required": [
        "domain"
      ],
      "properties": {
        "domain": {
          "type": "string",
          "description": "The organization domain name.  i.e acme.com"
        },
        "region": {
          "type": "string",
          "description": "The region of the sub-account"
        }
      }
    },
    "ContainerStatus": {
      "required": [
        "containerId",
        "createdAt",
        "scacCode",
        "account",
        "status"
      ],
      "properties": {
        "account": {
          "$ref": "#/$defs/Account"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp of the response"
        },
        "containerId": {
          "type": "string"
        },
        "completionReason": {
          "type": "string",
          "description": "Indicates why tracking was stopped. If this property has any value, then tracking is no longer active"
        },
        "scacCode": {
          "description": "The scac code of the ocean carrier",
          "type": "string"
        },
        "masterBillNumber": {
          "type": "string"
        },
        "officialMasterBillNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Carrier MBL written by tracing (`MasterBill.masterBillNumber`). Null until the SSL reports it, including when masterBillNumber is already an MBL. May match bookingNumber."
        },
        "masterBill": {
          "description": "An object that includes all information stored on the container's Master Bill",
          "$ref": "#/$defs/MasterBill"
        },
        "tradeType": {
          "type": "string",
          "enum": [
            "import",
            "export",
            "international"
          ]
        },
        "steamshipLine": {
          "type": "string"
        },
        "vessel": {
          "description": "The vessel performing the mother voyage (terminating at final discharge port).  Learn more <a href=\"/docs/vessels-voyages\" target=\"_blank\">here</a>",
          "$ref": "#/$defs/Vessel"
        },
        "currentVessel": {
          "description": "The vessel which the container is currently on. Learn more <a href=\"/docs/vessels-voyages\" target=\"_blank\">here</a>",
          "$ref": "#/$defs/Vessel"
        },
        "loadingVessel": {
          "description": "The vessel on which the container is first loaded at its port of loading. Can be different from the mother vessel if the container has a transshipment stop. Learn more <a href=\"/docs/vessels-voyages\" target=\"_blank\">here</a>",
          "$ref": "#/$defs/Vessel"
        },
        "loadingVoyageNumber": {
          "description": "The operating carrier identifier for the voyage on which the container is first loaded at its port of loading. Can be different from the mother vessel voyage if the container has a transshipment stop. Learn more <a href=\"/docs/vessels-voyages\" target=\"_blank\">here</a>",
          "type": "string"
        },
        "voyageNumber": {
          "description": "The operating carrier identifier for the mother voyage",
          "type": "string"
        },
        "vesselName": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access vessel object properties instead"
        },
        "vesselImo": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please use the imo property of the vessel object instead"
        },
        "equipmentType": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please use the standardized \"containerSize\" and \"containerType\" fields instead."
        },
        "containerSize": {
          "type": "string",
          "enum": [
            "TWENTY_FT",
            "FORTY_FT",
            "FORTY_FT_HC",
            "FORTY_FIVE_FT_HC"
          ],
          "description": "The size of container based on a simplified set of ISO standard sizes"
        },
        "containerType": {
          "type": "string",
          "enum": [
            "DRY",
            "FLAT_RACK",
            "OPEN",
            "REEFER",
            "TANK",
            "VENTILATED"
          ],
          "description": "The type of container based on a simplified set of ISO standard types"
        },
        "grossWeight": {
          "type": "number",
          "description": "The gross weight of the container - including the weight of the container itself. It is either reported by the carrier or approximated by adding the weight of the container to the weight of the cargo when only the cargo weight is reported.  Weight is standardized to kilograms."
        },
        "itNumber": {
          "type": "string",
          "description": "Inland Transit Number"
        },
        "status": {
          "$ref": "#/$defs/Status"
        },
        "carrierReleasedDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date at which the ocean carrier released the freight"
        },
        "customsReleasedDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date at which customs released the freight"
        },
        "etaAtTerminal": {
          "description": "The ETA to the final discharge port",
          "type": "string",
          "format": "date-time"
        },
        "etdFromOrigin": {
          "description": "The ETD from the initial port of loading",
          "type": "string",
          "format": "date-time"
        },
        "earlyReturnDate": {
          "description": "The earliest date at which a container will be physically accepted for loading on a particular vessel at the origin port",
          "type": "string",
          "format": "date-time"
        },
        "cutoffDate": {
          "description": "The physical cutoff date for accepting new containers for loading on a particular vessel at the origin port",
          "type": "string",
          "format": "date-time"
        },
        "railEarlyReturnDate": {
          "description": "The earliest date at which a container will be physically accepted for loading on a particular train at the origin rail ramp",
          "type": "string",
          "format": "date-time"
        },
        "railCutoff": {
          "description": "The physical cutoff date for accepting new containers for loading at the origin rail ramp",
          "type": "string",
          "format": "date-time"
        },
        "shippingInstructionCutoff": {
          "description": "The cutoff date for accepting shipping instructions (aka Document Cutoff)",
          "type": "string",
          "format": "date-time"
        },
        "lastFreeDay": {
          "description": "The last free day before demurrage is incurred, at the ocean terminal at the final discharge port",
          "type": "string",
          "format": "date-time"
        },
        "lineLastFreeDay": {
          "description": "The last free day before demurrage is incurred, issued by the steamship line. Can apply to either ocean terminal or final rail station depending on isRailMove",
          "type": "string",
          "format": "date-time"
        },
        "detentionLastFreeDay": {
          "type": "string",
          "format": "date-time",
          "description": "The last free day before detention per diem is incurred"
        },
        "appointmentDate": {
          "description": "The pickup appointment date/time booked at the final discharge port",
          "type": "string",
          "format": "date-time"
        },
        "demurrageOwedAtPort": {
          "description": "The amount of demurrage currently owed at the port",
          "type": "number"
        },
        "demurrageOwedAtPortDecimal": {
          "description": "The amount of demurrage currently owed at the port (in cents)",
          "type": "number"
        },
        "demurrageIncurred": {
          "description": "The total value of demurrage incurred at the port",
          "type": "number"
        },
        "demurrageIncurredDecimal": {
          "description": "The total value of demurrage incurred (in cents)",
          "type": "number"
        },
        "origin": {
          "description": "The inland origin",
          "$ref": "#/$defs/Location"
        },
        "portOfLoading": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please use the originPort object instead."
        },
        "originPort": {
          "description": "The initial ocean port of loading",
          "$ref": "#/$defs/Location"
        },
        "portOfDischarge": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please use the destinationPort object instead."
        },
        "terminalAtPortOfDischarge": {
          "type": "string"
        },
        "destinationPort": {
          "description": "The final ocean port of discharge",
          "$ref": "#/$defs/Location"
        },
        "destination": {
          "type": "string",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please use the finalDestination object instead."
        },
        "finalDestination": {
          "description": "The container's final delivery destination",
          "$ref": "#/$defs/Location"
        },
        "currentLocation": {
          "description": "The location of the last known facility that handled the container",
          "$ref": "#/$defs/Location"
        },
        "lastKnownPosition": {
          "$ref": "#/$defs/Position",
          "description": "The last known coordinates of the container. This can be a point on the water or inland"
        },
        "lastKnownPositionDate": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp of the last known position of the container"
        },
        "terminalAtDestinationPort": {
          "description": "The terminal at the final port of discharge for the ocean leg",
          "$ref": "#/$defs/Terminal"
        },
        "terminalAtOriginPort": {
          "description": "The terminal at the initial port of loading for the ocean leg",
          "$ref": "#/$defs/Terminal"
        },
        "yardLocation": {
          "type": "string",
          "description": "The specific location of the container indicated by the terminal at port of discharge"
        },
        "holds": {
          "type": "array",
          "description": "A list of holds affecting the container, both currently active and resolved.  For a comprehensive list of holds types and codes, check out <a href=\"https://airtable.com/shrV9rWHSr56o7naB/tblticaJXvBno5trv/viw15dmJfUUBnIGUT\" target=\"_blank\">this guide</a>",
          "items": {
            "$ref": "#/$defs/Hold"
          }
        },
        "history": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HistoryEvent"
          }
        },
        "timeline": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HistoryEvent"
          }
        },
        "confirmedOnBoardDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "vesselArrivedDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "dischargedDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "outgatedDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "deliveredDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "emptyReturnedDate": {
          "type": "string",
          "format": "date-time",
          "deprecated": true,
          "description": "⚠️ Deprecated ⚠️ Please access timestamp in history instead"
        },
        "etaAtDestination": {
          "type": "string",
          "description": "The ETA to the final rail facility",
          "format": "date-time"
        },
        "etnAtDestination": {
          "type": "string",
          "description": "The predicted ETN (Estimated Time of Notification) at the final destination rail facility",
          "format": "date-time"
        },
        "isRailMove": {
          "type": "boolean",
          "description": "Indicates whether or not the container is expected to have a rail leg at destination"
        },
        "loadStatus": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "EMPTY",
            "LADEN"
          ],
          "description": "Whether this voyage is empty or laden. Domestic rail empty and laden voyages share the same milestone names; use this field to tell them apart. Omitted when unknown."
        },
        "railCarrier": {
          "type": "object",
          "description": "The rail carrier of the final rail leg",
          "properties": {
            "name": {
              "type": "string"
            },
            "scacCode": {
              "type": "string"
            }
          }
        },
        "finalRailStation": {
          "type": "object",
          "description": "The destination facility of the final rail leg",
          "properties": {
            "name": {
              "type": "string"
            },
            "fsac": {
              "type": "string"
            },
            "unlocode": {
              "type": "string"
            },
            "firmsCode": {
              "type": "string"
            }
          }
        },
        "lastFreeDayAtRailStation": {
          "description": "The last free day before demurrage is incurred, at the final rail station",
          "type": "string",
          "format": "date-time"
        },
        "demurrageOwedAtRailStation": {
          "description": "The amount of demurrage currently owed at the final rail station",
          "type": "number"
        },
        "demurrageIncurredAtRailStation": {
          "description": "The total amount of demurrage incurred at the final rail station",
          "type": "number"
        },
        "customFields": {
          "description": "Additional fields that allow you to add and store data on the container inside OpenTrack. To learn more, <a href=\"https://support.opentrack.co/en/articles/5354556-guide-add-additional-fields-via-bulk-upload\" target=\"_blank\">see our help guide.</a>",
          "type": "object"
        },
        "trackingPage": {
          "description": "URL to public TrackIt page for this container",
          "type": "string"
        },
        "truckingCarrier": {
          "description": "Trucking carrier for this container",
          "$ref": "#/$defs/TruckingCarrier"
        },
        "dispatchedTruckingCarrier": {
          "description": "Dispatched Trucking carrier for this container",
          "$ref": "#/$defs/TruckingCarrier"
        },
        "chassisNumber": {
          "description": "Chassis number for this container",
          "type": "string"
        },
        "pickupNumber": {
          "description": "Pickup number for this container",
          "type": "string"
        },
        "sealNumber": {
          "description": "Seal number for this container",
          "type": "string"
        },
        "deliveryAppointmentDate": {
          "type": "string",
          "format": "date-time",
          "description": "The timestamp of the delivery appointment date of the container"
        },
        "receivingFacility": {
          "description": "Receiving facility for this container",
          "$ref": "#/$defs/ReceivingFacility"
        },
        "offDockFacility": {
          "description": "Off-dock storage facility for this container",
          "$ref": "#/$defs/OffDockFacility"
        }
      }
    },
    "HistoryEvent": {
      "required": [
        "milestone",
        "location",
        "timestamp"
      ],
      "properties": {
        "milestone": {
          "$ref": "#/$defs/Status"
        },
        "location": {
          "$ref": "#/$defs/Location"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "vessel": {
          "description": "The vessel transporting the container if applicable",
          "$ref": "#/$defs/Vessel"
        }
      }
    },
    "Hold": {
      "required": [
        "type",
        "reportedAt"
      ],
      "properties": {
        "type": {
          "description": "Generally Terminal, Line, Customs or USDA. <br/> Demurrage was previously reported as a hold, but that is being deprecated in favor of the demurrageOwed/demurrageIncurred properties",
          "type": "string"
        },
        "code": {
          "description": "A more specific description of the hold",
          "type": "string"
        },
        "remarks": {
          "type": "string"
        },
        "amountDue": {
          "type": "integer"
        },
        "reportedAt": {
          "type": "string",
          "format": "date-time"
        },
        "resolvedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Location": {
      "required": [
        "name",
        "coordinates",
        "type"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "Can be: port, locality",
          "enum": [
            "port",
            "locality"
          ]
        },
        "unlocode": {
          "type": "string",
          "description": "Present when the location type is port"
        },
        "timezone": {
          "type": "string"
        },
        "coordinates": {
          "$ref": "#/$defs/Point"
        }
      }
    },
    "MasterBill": {
      "required": [
        "number"
      ],
      "properties": {
        "number": {
          "type": "string"
        },
        "referenceNumbers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the reference number property that was provided"
              },
              "value": {
                "type": "string",
                "description": "The value of the reference number that was provided"
              }
            }
          }
        }
      }
    },
    "OffDockFacility": {
      "required": [
        "name",
        "unlocode"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "firmsCode": {
          "type": "string"
        },
        "unlocode": {
          "type": "string"
        }
      }
    },
    "Point": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      }
    },
    "Position": {
      "required": [
        "coordinates"
      ],
      "properties": {
        "coordinates": {
          "$ref": "#/$defs/Point"
        }
      }
    },
    "ReceivingFacility": {
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "firmsCode": {
          "type": "string"
        }
      }
    },
    "Status": {
      "type": "string",
      "description": "The current status of the container.  Can either be a lifecycle milestone, or a status indicating that OpenTrack is still searching for information about the container. Click <a href=\"/docs/container-voyage-milestones\" target=\"_blank\">here</a> for more information",
      "enum": [
        "DISCOVERING",
        "DISCOVERED",
        "BOOKED",
        "NOT_FOUND",
        "EMPTY_OUTGATED",
        "FULL_INGATED_AT_ORIGIN_RAIL_FACILITY",
        "LOADED_ON_RAIL_AT_ORIGIN",
        "DEPARTED_ON_RAIL_FROM_ORIGIN",
        "ARRIVED_AT_ORIGIN_PORT_RAIL_FACILITY",
        "UNLOADED_FROM_RAIL_AT_ORIGIN_PORT",
        "FULL_INGATED",
        "LOADED_ON_BARGE_AT_ORIGIN",
        "BARGE_DEPARTED_FROM_ORIGIN",
        "BARGE_BERTHED_AT_ORIGIN_PORT",
        "DISCHARGED_FROM_BARGE_AT_ORIGIN_PORT",
        "LOADED",
        "VESSEL_DEPARTED",
        "VESSEL_ARRIVED_AT_TRANSSHIPMENT_PORT",
        "VESSEL_BERTHED_AT_TRANSSHIPMENT_PORT",
        "DISCHARGED_AT_TRANSSHIPMENT_PORT",
        "LOADED_AT_TRANSSHIPMENT_PORT",
        "VESSEL_DEPARTED_FROM_TRANSSHIPMENT_PORT",
        "VESSEL_ARRIVED",
        "VESSEL_BERTHED",
        "DISCHARGED",
        "LOADED_ON_BARGE_AT_DESTINATION_PORT",
        "BARGE_DEPARTED_FROM_DESTINATION_PORT",
        "BARGE_BERTHED_AT_DESTINATION",
        "DISCHARGED_FROM_BARGE_AT_DESTINATION",
        "AVAILABLE",
        "FULL_OUTGATED",
        "FULL_INGATED_TO_RAIL_FACILITY",
        "LOADED_ON_RAIL",
        "DEPARTED_ON_RAIL",
        "ARRIVED_AT_RAIL_FACILITY",
        "UNLOADED_FROM_RAIL",
        "ACTUAL_PLACEMENT",
        "AVAILABLE_AT_RAIL_FACILITY",
        "FULL_OUTGATED_FROM_RAIL_FACILITY",
        "FULL_INGATED_TO_OFFDOCK_FACILITY",
        "AVAILABLE_AT_OFFDOCK_FACILITY",
        "FULL_OUTGATED_FROM_OFFDOCK_FACILITY",
        "FULL_DROPPED_OFF_AT_TRUCKER_YARD",
        "FULL_PICKED_UP_FROM_TRUCKER_YARD",
        "DELIVERED",
        "EMPTY_READY_FOR_PICKUP",
        "EMPTY_PICKED_UP_FOR_RETURN",
        "EMPTY_DROPPED_OFF_AT_TRUCKER_YARD",
        "EMPTY_PICKED_UP_FROM_TRUCKER_YARD",
        "EMPTY_RETURNED"
      ]
    },
    "Terminal": {
      "required": [
        "name",
        "address",
        "firmsCode"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "firmsCode": {
          "type": "string"
        }
      }
    },
    "TruckingCarrier": {
      "required": [
        "scac"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "scac": {
          "type": "string"
        }
      }
    },
    "Vessel": {
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "imo": {
          "type": "string"
        },
        "mmsi": {
          "type": "string"
        },
        "countryCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166-1 alpha-2 country code for the vessel's flag"
        },
        "operator": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "scacCode": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}