{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/despatch-advice-schema.json",
  "title": "Despatch Advice / Delivery Note",
  "description": "A notification from the despatch party to the consignee that goods have been despatched, detailing the contents of the consignment. The same data set serves as the delivery note accompanying the goods, including proof-of-delivery confirmation on receipt.",
  "type": "object",
  "required": [
    "@context",
    "type",
    "issuer",
    "credentialSubject",
    "credentialSchema"
  ],
  "properties": {
    "@context": {
      "type": "array",
      "description": "JSON-LD contexts: the W3C Verifiable Credentials v2 context, followed by this document's context.",
      "const": [
        "https://www.w3.org/ns/credentials/v2",
        "https://unvtd.unece.org/despatch-advice-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "DespatchAdviceCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Despatch Advice / Delivery Note"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/despatch-advice-schema.json",
          "description": "Public location of the schema"
        },
        "type": {
          "type": "string",
          "const": "JsonSchema",
          "description": "Schema type identifier"
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    "id": {
      "type": "string",
      "format": "uri",
      "description": "Unique identifier for the credential",
      "example": "urn:uuid:da-2025-surfpro-001"
    },
    "validFrom": {
      "example": "2025-03-10T00:00:00Z",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2026-03-10T00:00:00Z",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "name": "Issuer",
      "description": "Identifier of the party issuing the despatch advice (e.g., DID). Must match the despatch party.",
      "type": "string",
      "format": "uri",
      "example": "did:web:surfpro.example.com"
    },
    "credentialSubject": {
      "name": "DespatchAdvice",
      "description": "Despatch advice / delivery note details",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "DespatchAdvice"
        },
        "despatchAdviceNumber": {
          "example": "DA-2025-031-001",
          "type": "string",
          "description": "Identifier assigned by the despatch party to the despatch advice."
        },
        "deliveryNoteNumber": {
          "example": "DN-2025-031-001",
          "type": "string",
          "description": "Reference number to identify the delivery note accompanying the goods. May equal the despatch advice number."
        },
        "issueDate": {
          "example": "2025-03-10T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date that a document was issued."
        },
        "despatchDate": {
          "example": "2025-03-11T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date on which goods are despatched or consigned."
        },
        "estimatedDeliveryDate": {
          "example": "2025-03-28T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date on which the goods are expected to be delivered."
        },
        "purchaseOrderNumber": {
          "example": "PO-2025-001",
          "type": "string",
          "description": "Identifier assigned by the buyer to an order."
        },
        "contractNumber": {
          "example": "CTR-2025-SURF-001",
          "type": "string",
          "description": "Identifier of a contract concluded between parties."
        },
        "invoiceNumber": {
          "example": "INV-2025-031-001",
          "type": "string",
          "description": "Reference number to identify an invoice."
        },
        "transportContractNumber": {
          "example": "BKG123456789",
          "type": "string",
          "description": "Reference number to identify a document evidencing a transport contract."
        },
        "despatchParty": {
          "description": "Party from which goods are despatched (consignor).",
          "type": "object",
          "required": [
            "type",
            "id",
            "name"
          ],
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:surfpro.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "SurfPro Manufacturing Vietnam Co., Ltd",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "Lot C5, VSIP II Industrial Park",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Thu Dau Mot",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "Binh Duong",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "820000",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "VN",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "buyer": {
          "description": "Party to which merchandise or services are sold.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:waveridersupplies.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Wave Rider Supplies Pty Ltd",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "18 Harbord Road",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Brookvale",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2100",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "seller": {
          "description": "Party selling merchandise or services to a buyer.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:nordicswell.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Nordic Swell ApS",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "Ørhagevej 12",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Klitmøller",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "Nordjylland",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "7700",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "DK",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "consignee": {
          "description": "Party to which goods are consigned.",
          "type": "object",
          "required": [
            "type",
            "id",
            "name"
          ],
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:waveridersupplies.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Wave Rider Supplies Pty Ltd",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "18 Harbord Road",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Brookvale",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2100",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "carrier": {
          "description": "Party providing the transport of goods between named points.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Party",
              "enum": [
                "Party"
              ]
            },
            "id": {
              "example": "did:web:pacificshipping.example.com",
              "type": "string",
              "format": "uri",
              "description": "A unique party identifier."
            },
            "name": {
              "example": "Pacific Ocean Shipping Lines",
              "type": "string",
              "description": "Trade party name."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "88 Harbour Street",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Sydney",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2000",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          }
        },
        "despatchLocation": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Location",
              "enum": [
                "Location"
              ]
            },
            "name": {
              "example": "SurfPro Manufacturing Vietnam - Factory 2",
              "type": "string",
              "description": "Location name."
            },
            "unLocode": {
              "type": "string",
              "description": "UN/LOCODE location identifier (5 characters)."
            },
            "postalAddress": {
              "description": "The postal address of the location.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "Lot C5, VSIP II Industrial Park",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Thu Dau Mot",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "Binh Duong",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "820000",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "VN",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          },
          "description": "Place from which despatch is to take place."
        },
        "deliveryLocation": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Location",
              "enum": [
                "Location"
              ]
            },
            "name": {
              "example": "Sydney Secure Warehousing - Facility A",
              "type": "string",
              "description": "Location name."
            },
            "unLocode": {
              "type": "string",
              "description": "UN/LOCODE location identifier (5 characters)."
            },
            "postalAddress": {
              "description": "The postal address of the location.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "45 Logistics Way",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Banksmeadow",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "2019",
                  "type": "string",
                  "description": "Postal code."
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country code."
                }
              }
            }
          },
          "description": "Location to which a consignment is to be delivered."
        },
        "tradeTermsConditionsCode": {
          "example": "CIF",
          "type": "string",
          "description": "The trade terms (Incoterms) code applicable to this delivery."
        },
        "tradeTermsConditionsDescription": {
          "example": "CIF Port Botany, Sydney (Incoterms® 2020)",
          "type": "string",
          "description": "Trade terms description, including the named place."
        },
        "transportMode": {
          "example": "Maritime",
          "type": "string",
          "description": "Mode of transport used for the movement of goods."
        },
        "conveyanceReferenceNumber": {
          "example": "PV-025S",
          "type": "string",
          "description": "Identifier of a journey of a means of transport, such as a voyage or flight number (UID:8028)."
        },
        "vehicleRegistrationNumber": {
          "example": "IMO9876543",
          "type": "string",
          "description": "Identifier of the specific means of transport such as IMO number or vessel registration (UID:8213)."
        },
        "deliveryInstructions": {
          "example": "Deliver to Sydney Secure Warehousing, goods-in dock 3. Notify Wave Rider Supplies 24h in advance.",
          "type": "string",
          "description": "Instructions regarding the delivery of the consignment."
        },
        "handlingInstructions": {
          "example": "Handle with care. Keep dry. This side up.",
          "type": "string",
          "description": "Instructions on how packages should be handled."
        },
        "transportTemperature": {
          "example": "Ambient temperature",
          "type": "string",
          "description": "Instructions regarding the temperature under which the cargo has to be transported."
        },
        "totalGrossWeight": {
          "description": "Total gross weight of all packages.",
          "type": "object",
          "properties": {
            "amount": {
              "example": 520,
              "type": "number",
              "format": "float",
              "description": "Weight amount"
            },
            "unit": {
              "example": "KGS",
              "type": "string",
              "description": "Weight unit"
            }
          }
        },
        "totalNetWeight": {
          "description": "Total net weight of all items.",
          "type": "object",
          "properties": {
            "amount": {
              "example": 475,
              "type": "number",
              "format": "float",
              "description": "Weight amount"
            },
            "unit": {
              "example": "KGS",
              "type": "string",
              "description": "Weight unit"
            }
          }
        },
        "totalPackages": {
          "example": 6,
          "type": "number",
          "description": "Total number of packages."
        },
        "totalVolume": {
          "description": "Total volume of all packages.",
          "type": "object",
          "properties": {
            "amount": {
              "example": 4.85,
              "type": "number",
              "format": "float",
              "description": "Volume amount"
            },
            "unit": {
              "example": "CBM",
              "type": "string",
              "description": "Volume unit (cubic meters)"
            }
          }
        },
        "lineItems": {
          "name": "Line Items",
          "description": "Despatched line items, reconciling ordered against despatched quantities",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "lineNumber": {
                "example": 1,
                "type": "number",
                "description": "Sequential line number within the despatch advice."
              },
              "orderLineNumber": {
                "example": 1,
                "type": "number",
                "description": "Corresponding line number on the referenced purchase order."
              },
              "description": {
                "example": "Professional Longboard - Ocean Series",
                "type": "string",
                "description": "Description of the item."
              },
              "sku": {
                "example": "SURF-LB-001",
                "type": "string",
                "description": "Stock keeping unit identifier assigned by the seller."
              },
              "buyerItemNumber": {
                "example": "WRS-40021",
                "type": "string",
                "description": "Item identifier assigned by the buyer."
              },
              "hsCode": {
                "example": "950629",
                "type": "string",
                "description": "Harmonized System code."
              },
              "originCountry": {
                "example": "VN",
                "type": "string",
                "description": "Country of origin."
              },
              "quantityOrdered": {
                "description": "Quantity ordered on the referenced purchase order.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 25,
                    "type": "number",
                    "description": "Quantity value"
                  },
                  "unit": {
                    "example": "EA",
                    "type": "string",
                    "description": "Quantity unit"
                  }
                }
              },
              "quantityDespatched": {
                "description": "Quantity actually despatched in this consignment.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 25,
                    "type": "number",
                    "description": "Quantity value"
                  },
                  "unit": {
                    "example": "EA",
                    "type": "string",
                    "description": "Quantity unit"
                  }
                }
              },
              "quantityOutstanding": {
                "description": "Quantity remaining to be despatched against the order after this consignment.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 0,
                    "type": "number",
                    "description": "Quantity value"
                  },
                  "unit": {
                    "example": "EA",
                    "type": "string",
                    "description": "Quantity unit"
                  }
                }
              },
              "batchNumber": {
                "example": "BATCH-2025-072",
                "type": "string",
                "description": "Identifier of the production batch or lot."
              },
              "serialNumbers": {
                "description": "Serial numbers of the despatched units, where serialized.",
                "type": "array",
                "items": {
                  "example": "SN-88231",
                  "type": "string",
                  "description": "Serial number of an individual unit."
                }
              },
              "bestBeforeDate": {
                "example": "2026-09-01T00:00:00Z",
                "type": "string",
                "format": "date-time",
                "description": "Best before date applicable to the despatched batch."
              },
              "expiryDate": {
                "example": "2027-03-01T00:00:00Z",
                "type": "string",
                "format": "date-time",
                "description": "Expiry date applicable to the despatched batch."
              },
              "netWeight": {
                "description": "Total net weight of the despatched quantity for this line.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 187.5,
                    "type": "number",
                    "format": "float",
                    "description": "Weight amount"
                  },
                  "unit": {
                    "example": "KGS",
                    "type": "string",
                    "description": "Weight unit"
                  }
                }
              },
              "packageNumbers": {
                "description": "Package numbers in which this line item is contained.",
                "type": "array",
                "items": {
                  "example": 1,
                  "type": "number",
                  "description": "Reference to a package number."
                }
              }
            },
            "description": "A despatched line item."
          }
        },
        "packages": {
          "name": "Packages",
          "description": "Details of individual packages",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "packageNumber": {
                "example": 1,
                "type": "number",
                "description": "Sequential package number"
              },
              "packageType": {
                "example": "CT",
                "type": "string",
                "description": "Code specifying the type of packaging (CT=Carton)."
              },
              "shippingMark": {
                "example": "SURFPRO/WRS/001",
                "type": "string",
                "description": "Marks and numbers on the package."
              },
              "sscc": {
                "example": "00003123456700000016",
                "type": "string",
                "description": "Serial Shipping Container Code identifying the logistic unit."
              },
              "grossWeight": {
                "description": "Gross weight of the package.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 104,
                    "type": "number",
                    "format": "float",
                    "description": "Weight amount"
                  },
                  "unit": {
                    "example": "KGS",
                    "type": "string",
                    "description": "Weight unit"
                  }
                }
              },
              "volume": {
                "description": "Volume of the package.",
                "type": "object",
                "properties": {
                  "amount": {
                    "example": 1.35,
                    "type": "number",
                    "format": "float",
                    "description": "Volume amount"
                  },
                  "unit": {
                    "example": "CBM",
                    "type": "string",
                    "description": "Volume unit"
                  }
                }
              }
            },
            "description": "Details of a specific package."
          }
        },
        "proofOfDelivery": {
          "description": "Informational snapshot of receipt as recorded by the despatch party's systems. Because this credential is signed by the despatch party and immutable, this block carries no evidential weight for receipt. In fully electronic processes the confirmation of delivery is a separate DeliveryConfirmation credential signed by the consignee (see delivery-confirmation-schema.yaml), referencing this credential by id and digest.",
          "type": "object",
          "properties": {
            "receivedBy": {
              "example": "J. Smith, Goods-In Supervisor",
              "type": "string",
              "description": "Name and role of the person acknowledging receipt."
            },
            "receivedDate": {
              "example": "2025-03-18T14:30:00Z",
              "type": "string",
              "format": "date-time",
              "description": "Date and time at which the consignment was received."
            },
            "condition": {
              "example": "Received complete and in good condition",
              "type": "string",
              "description": "Condition of the consignment as received."
            },
            "remarks": {
              "example": "",
              "type": "string",
              "description": "Reservations or remarks recorded by the receiver."
            }
          }
        }
      },
      "required": [
        "type",
        "despatchAdviceNumber",
        "issueDate",
        "despatchDate",
        "despatchParty",
        "consignee",
        "lineItems"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
