{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/customs-declaration-schema.json",
  "title": "Customs Declaration",
  "description": "A formal document submitted to customs authorities declaring the details of goods being imported or exported, including their nature, value, and origin for duty assessment and regulatory compliance.",
  "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/customs-declaration-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "CustomsDeclarationCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Customs Declaration"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/customs-declaration-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:cd-2025-au-export-001"
    },
    "validFrom": {
      "example": "2025-03-09:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2026-03-09:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "name": "Issuer",
      "description": "Identifier of the customs administration responsible for the declaration (e.g., DID)",
      "type": "string",
      "format": "uri",
      "example": "did:web:customs.example.gov"
    },
    "credentialSubject": {
      "name": "CustomsDeclaration",
      "description": "Customs declaration details",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "CustomsDeclaration"
        },
        "declarationNumber": {
          "example": "EXP-2025-AU-123456",
          "type": "string",
          "description": "Reference number, assigned or accepted by Customs, to identify a goods declaration."
        },
        "traderAssignedReference": {
          "example": "SURFPRO-EXP-2025-001",
          "type": "string",
          "description": "Reference assigned by a trader to identify a declaration."
        },
        "issueDate": {
          "example": "2025-03-09T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date that a document was issued."
        },
        "exporter": {
          "description": "Party who makes, or on whose behalf the export declaration is made.",
          "type": "object",
          "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 Inc.",
              "type": "string",
              "description": "Trade party name."
            },
            "eoriNumber": {
              "example": "AU1234567890",
              "type": "string",
              "description": "Economic Operators Registration and Identification number."
            },
            "postalAddress": {
              "description": "The postal address of the party.",
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "default": "Address",
                  "enum": [
                    "Address"
                  ]
                },
                "streetAddress": {
                  "example": "150 Industrial Drive",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Gold Coast",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "QLD",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "4217",
                  "type": "string",
                  "description": "Postal code"
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "importer": {
          "description": "Party who makes - or on whose behalf a Customs clearing agent makes - an import declaration.",
          "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, Inc",
              "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": "210 Ocean Road",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Williamsburg",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "75002",
                  "type": "string",
                  "description": "Postal code"
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "consignee": {
          "description": "Party to which goods are consigned.",
          "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, Inc",
              "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": "210 Ocean Road",
                  "type": "string",
                  "description": "The street component of the address"
                },
                "addressLocality": {
                  "example": "Williamsburg",
                  "type": "string",
                  "description": "The city component of the address"
                },
                "addressRegion": {
                  "example": "NSW",
                  "type": "string",
                  "description": "The state component of the address"
                },
                "postalCode": {
                  "example": "75002",
                  "type": "string",
                  "description": "Postal code"
                },
                "addressCountry": {
                  "example": "AU",
                  "type": "string",
                  "description": "Country."
                }
              }
            }
          }
        },
        "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."
                }
              }
            }
          }
        },
        "exportationCountry": {
          "description": "Country from which goods are exported.",
          "type": "object",
          "properties": {
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "ISO country code"
            },
            "name": {
              "example": "Australia",
              "type": "string",
              "description": "Country name"
            }
          }
        },
        "destinationCountry": {
          "description": "Country to which goods are destined.",
          "type": "object",
          "properties": {
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "ISO country code"
            },
            "name": {
              "example": "Australia",
              "type": "string",
              "description": "Country name"
            }
          }
        },
        "consignmentDestinationCountry": {
          "description": "Name of the country to which the goods are to be delivered.",
          "type": "object",
          "properties": {
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "ISO country code"
            },
            "name": {
              "example": "Australia",
              "type": "string",
              "description": "Country name"
            }
          }
        },
        "exitCustomsOffice": {
          "description": "Customs office at which the goods leave the customs territory.",
          "type": "object",
          "properties": {
            "code": {
              "example": "AUGOL",
              "type": "string",
              "description": "Office code"
            },
            "name": {
              "example": "Gold Coast Customs Office",
              "type": "string",
              "description": "Office name"
            },
            "location": {
              "example": "Gold Coast Airport",
              "type": "string",
              "description": "Office location"
            }
          }
        },
        "entryCustomsOffice": {
          "description": "Customs office at which the goods enter the customs territory.",
          "type": "object",
          "properties": {
            "code": {
              "example": "AUSYD",
              "type": "string",
              "description": "Office code"
            },
            "name": {
              "example": "Sydney Customs Office",
              "type": "string",
              "description": "Office name"
            },
            "location": {
              "example": "Sydney International Airport",
              "type": "string",
              "description": "Office location"
            }
          }
        },
        "transportContractNumber": {
          "example": "BKG123456789",
          "type": "string",
          "description": "Reference number to identify a document evidencing a transport contract."
        },
        "invoiceNumber": {
          "example": "INV-2025-031-001",
          "type": "string",
          "description": "Reference number to identify an invoice."
        },
        "invoiceDate": {
          "example": "2025-03-10T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date of issue of an invoice."
        },
        "tradeTermsConditionsCode": {
          "example": "FOB",
          "type": "string",
          "description": "Code specifying the delivery or transport terms (Incoterms)."
        },
        "tradeTermsConditionsDescription": {
          "example": "FOB Port of Gold Coast",
          "type": "string",
          "description": "Free form description of delivery or transport terms."
        },
        "paymentMethod": {
          "example": "Wire Transfer",
          "type": "string",
          "description": "Code specifying a method of payment."
        },
        "modeOfTransport": {
          "example": "1",
          "type": "string",
          "description": "Code specifying a mode of transport (1=Maritime, 3=Road, 4=Air, etc.)."
        },
        "transportMeansIdentifier": {
          "example": "PACIFIC VOYAGER",
          "type": "string",
          "description": "Name of a specific means of transport such as the vessel name."
        },
        "transportMeansRegistration": {
          "example": "IMO9876543",
          "type": "string",
          "description": "Identifier of a specific means of transport."
        },
        "transportMeansAtBorder": {
          "example": "PACIFIC VOYAGER",
          "type": "string",
          "description": "Identifier of the means of transport used in crossing the border."
        },
        "natureOfTransaction": {
          "example": "Sale",
          "type": "string",
          "description": "Textual representation of a type of contract."
        },
        "declarationGoods": {
          "name": "Declaration Goods",
          "description": "Goods declared to customs",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sequenceIdentifier": {
                "example": 1,
                "type": "number",
                "description": "Sequence number differentiating a specific goods item."
              },
              "description": {
                "example": "Professional Longboard - Ocean Series, 9'6\" length",
                "type": "string",
                "description": "Plain language description of the goods."
              },
              "hsCode": {
                "example": "950630",
                "type": "string",
                "description": "Code specifying a type of goods for Customs purposes."
              },
              "originCountry": {
                "example": "AU",
                "type": "string",
                "description": "Country where the goods were produced or manufactured."
              },
              "quantity": {
                "description": "Number of units",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Quantity",
                    "enum": [
                      "Quantity"
                    ]
                  },
                  "amount": {
                    "example": 25,
                    "type": "number",
                    "description": "Quantity amount"
                  },
                  "unit": {
                    "example": "Units",
                    "type": "string",
                    "description": "Unit of measure"
                  }
                }
              },
              "netWeight": {
                "description": "Total net weight of the goods.",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Quantity",
                    "enum": [
                      "Quantity"
                    ]
                  },
                  "amount": {
                    "example": 187.5,
                    "type": "number",
                    "format": "float",
                    "description": "Weight amount"
                  },
                  "unit": {
                    "example": "KGS",
                    "type": "string",
                    "description": "Weight unit"
                  }
                }
              },
              "grossWeight": {
                "description": "Total gross weight including packaging.",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "Quantity",
                    "enum": [
                      "Quantity"
                    ]
                  },
                  "amount": {
                    "example": 200,
                    "type": "number",
                    "format": "float",
                    "description": "Weight amount"
                  },
                  "unit": {
                    "example": "KGS",
                    "type": "string",
                    "description": "Weight unit"
                  }
                }
              },
              "numberOfPackages": {
                "example": 5,
                "type": "number",
                "description": "Number of packages per goods item."
              },
              "packagingType": {
                "example": "CT",
                "type": "string",
                "description": "Code specifying the type of packaging (CT=Carton, etc.)."
              },
              "shippingMarks": {
                "example": "SURFPRO/WRS/001-005",
                "type": "string",
                "description": "Free form description of the marks and numbers on packages."
              },
              "customsValue": {
                "description": "Value declared for customs purposes",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "MonetaryAmount",
                    "enum": [
                      "MonetaryAmount"
                    ]
                  },
                  "amount": {
                    "example": 18750,
                    "type": "number",
                    "format": "float",
                    "description": "Monetary amount"
                  },
                  "currency": {
                    "example": "USD",
                    "type": "string",
                    "description": "Currency code"
                  }
                }
              },
              "statisticalValue": {
                "description": "Value declared for statistical purposes",
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "MonetaryAmount",
                    "enum": [
                      "MonetaryAmount"
                    ]
                  },
                  "amount": {
                    "example": 18750,
                    "type": "number",
                    "format": "float",
                    "description": "Monetary amount"
                  },
                  "currency": {
                    "example": "USD",
                    "type": "string",
                    "description": "Currency code"
                  }
                }
              },
              "taxRegimeType": {
                "example": "STANDARD",
                "type": "string",
                "description": "Code specifying a regime according to which tax is assessed."
              }
            },
            "description": "A specific goods item in the declaration."
          }
        },
        "totalInvoiceAmount": {
          "description": "Total monetary amount charged.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "MonetaryAmount",
              "enum": [
                "MonetaryAmount"
              ]
            },
            "amount": {
              "example": 73250,
              "type": "number",
              "format": "float",
              "description": "Monetary amount"
            },
            "currency": {
              "example": "USD",
              "type": "string",
              "description": "Currency code"
            }
          }
        },
        "totalGrossWeight": {
          "description": "Total gross weight of all goods.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Quantity",
              "enum": [
                "Quantity"
              ]
            },
            "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 goods.",
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Quantity",
              "enum": [
                "Quantity"
              ]
            },
            "amount": {
              "example": 475,
              "type": "number",
              "format": "float",
              "description": "Weight amount"
            },
            "unit": {
              "example": "KGS",
              "type": "string",
              "description": "Weight unit"
            }
          }
        },
        "totalNumberOfPackages": {
          "example": 18,
          "type": "number",
          "description": "Total number of packages."
        },
        "ucr": {
          "example": "AU2025SURF001234",
          "type": "string",
          "description": "Unique Consignment Reference identifying a particular consignment."
        }
      },
      "required": [
        "type",
        "declarationNumber",
        "issueDate",
        "exporter",
        "declarationGoods"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
