{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/ch-robinson-worldwide/main/json-schema/ch-robinson-worldwide-invoice-schema.json",
  "title": "invoice",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ch-robinson-worldwide-visibility-api-openapi.yml#/components/schemas/invoice",
  "required": [
    "invoiceNumber",
    "invoiceIssuer",
    "invoiceLevel",
    "number",
    "charges",
    "tenantId"
  ],
  "type": "object",
  "properties": {
    "invoiceNumber": {
      "type": "string",
      "minimum": 1,
      "maximum": 20,
      "description": "Invoice Number"
    },
    "customerName": {
      "type": "string",
      "minimum": 1,
      "maximum": 20,
      "description": "Name of the customer"
    },
    "tenantId": {
      "type": "string",
      "minimum": 1,
      "maximum": 20,
      "description": "This ID indicates who the underlying customer is."
    },
    "invoiceLevel": {
      "type": "string",
      "minimum": 1,
      "maximum": 10,
      "description": "Invoice Level",
      "enum": [
        "shipment",
        "order"
      ]
    },
    "invoiceIssuer": {
      "type": "string",
      "minimum": 1,
      "maximum": 20,
      "description": "Who is issuing the invoice to the customer?"
    },
    "number": {
      "type": "string",
      "minimum": 1,
      "maximum": 20,
      "description": "Number of either the shipment or order, depending on the invoice level"
    },
    "invoiceDate": {
      "type": "string",
      "format": "date-time",
      "description": "An ISO8601 UTC date-time"
    },
    "invoiceWeight": {
      "type": "number",
      "description": "Invoice weight"
    },
    "weightUnitOfMeasure": {
      "$ref": "#/$defs/weightUomEnum"
    },
    "sourceName": {
      "type": "string",
      "minimum": 1,
      "maximum": 60,
      "description": "Party managing and sending invoice. (Meant to help tie the invoice to the shipment/order.)"
    },
    "charges": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/visibilityCharge"
      }
    },
    "referenceNumbers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/referenceNumber"
      }
    }
  },
  "$defs": {
    "referenceNumber": {
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "C.H. Robinson defined code for reference number types. Here is a list of the most commonly used reference number types: \n\n`SHID` - Shipment ID #, `MBOL` - Master Bill of Lading #, `PO` - Purchase Order #, `BOL` - Bill of Lading #, `CRID` - Customer Specific Ref Number, `CUSTPO` - Customer PO Number, `DEL` - Delivery #, `JNO` - Job Number, `PU` - Pickup #, `CON` - Customer Order Number, `APPT` - Appointment Number \n\nFor a detailed description of all enumerated codes please find them <a href=\"https://api.navisphere.com/api/B2B/Portal/v1/documents/descriptions/ReferenceNumberTypes.xlsx\" target=\"_blank\">here</a>.",
          "enum": [
            "SHID",
            "MBOL",
            "PO",
            "BOL",
            "CFRM",
            "CRID",
            "CUSTPO",
            "DEL",
            "DIST",
            "FIN",
            "GL",
            "JNO",
            "PU",
            "RANumber",
            "RLPRO",
            "MREF",
            "Empty",
            "PRO",
            "CCN",
            "SBOL",
            "CON",
            "APPT",
            "CHRW_ID",
            "FDA",
            "IREF",
            "LIC",
            "ORD",
            "PLU",
            "SCAC",
            "SEAL",
            "SKU",
            "SREF",
            "STCC",
            "TEB",
            "VPO",
            "WB",
            "XXXX",
            "TRIA",
            "TRANS",
            "GCC",
            "SDATE",
            "CDATE",
            "ACCT",
            "CCTR",
            "IGM",
            "GIGM",
            "LIGM",
            "SMTP",
            "PERMIT",
            "RNO",
            "DVCN",
            "PRCL",
            "CPUC",
            "SHPMD",
            "AFR",
            "BUYID",
            "VNDID",
            "DIV",
            "DEPT",
            "POTYPE",
            "GRGI",
            "DUNS",
            "PALLETREF",
            "CITTN",
            "CIN",
            "SHIPWITH",
            "PN",
            "UPC",
            "PRCD",
            "VESSEL",
            "VOYAGE",
            "FN",
            "FEEDVESS",
            "FEEDVOY",
            "SHIPREF",
            "CBL",
            "SPAC",
            "POLN",
            "VPOLN",
            "EIN",
            "CNSG",
            "PROFITCTR",
            "MFGPART",
            "PACKSLIP",
            "THIRDPRTY",
            "DEFATTR",
            "FSTRK",
            "FOItemID",
            "POLineNum",
            "PARCELSPC",
            "CNS1",
            "CNS2",
            "CNS3",
            "CNS4",
            "CNS5",
            "CNS6",
            "CNS7",
            "TREF",
            "VREF",
            "UPRICE",
            "FWPARTY",
            "BYPARTY",
            "HBL",
            "CBP",
            "TRANSFER",
            "SO",
            "ORDTRK",
            "QUOTEID",
            "EQT",
            "BOOTH",
            "TS",
            "OH #",
            "CNTNR",
            "VAS",
            "Size",
            "Color",
            "Style",
            "HCERT",
            "B#",
            "ETMSID",
            "214-IMO",
            "SHPWeight",
            "SHPVolume",
            "SHPDims",
            "SERIALIZED",
            "SERIALNUM",
            "CPSIA",
            "EDIINVREF",
            "SQID",
            "QSeqNum",
            "OuterPkStu",
            "GLC",
            "COMP",
            "COST",
            "DTYGL",
            "DTYCC",
            "BRKGL",
            "BRKCC",
            "GPS",
            "IAC",
            "WHRCT",
            "ERGUID",
            "SONUM",
            "CCNUM",
            "PrimCCNUM",
            "PrevCCNUM",
            "CMRN",
            "TRANSSHIP",
            "PGIDATE",
            "AESFIL",
            "CUSTQUOTID",
            "QUOTETRACE",
            "ODATE",
            "FRCLS",
            "NMFC",
            "OrderItemId"
          ]
        },
        "value": {
          "type": "string",
          "minimum": 1,
          "maximum": 100,
          "description": "The actual value of the reference number."
        }
      }
    },
    "visibilityCharge": {
      "required": [
        "invoicedCurrency",
        "invoiceAmount",
        "invoiceLine"
      ],
      "type": "object",
      "properties": {
        "invoicedCurrency": {
          "type": "string",
          "minimum": 1,
          "maximum": 10,
          "description": "ISO 4217 currency code"
        },
        "invoiceAmount": {
          "type": "number",
          "description": "Amount invoiced per line item"
        },
        "code": {
          "minimum": 1,
          "maximum": 20,
          "type": "string",
          "description": "Standard Charge Code"
        },
        "invoiceLine": {
          "type": "integer",
          "description": "Invoice line"
        },
        "description": {
          "type": "string",
          "minimum": 1,
          "maximum": 100,
          "description": "Description of the charge code."
        }
      }
    },
    "weightUomEnum": {
      "type": "string",
      "description": "Unit of measure for weight parameters.",
      "enum": [
        "Pounds",
        "Kilograms"
      ]
    }
  }
}