{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unvtd.unece.org/certificate-of-origin-schema.json",
  "title": "Certificate of Origin",
  "description": "A document certifying the country of origin of specified goods to qualify for preferential treatment under trade agreements or to comply with import regulations.",
  "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/certificate-of-origin-context.jsonld"
      ]
    },
    "type": {
      "type": "array",
      "description": "Credential types.",
      "const": [
        "VerifiableCredential",
        "CertificateOfOriginCredential"
      ]
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the credential, for display.",
      "example": "Certificate of Origin"
    },
    "credentialSchema": {
      "type": "object",
      "description": "Reference to the credential schema for validation",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "const": "https://unvtd.unece.org/certificate-of-origin-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:e9bf65a3-9ff3-4988-8c44-2535b949279f"
    },
    "validFrom": {
      "example": "2025-03-06:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Credential validity start date"
    },
    "validUntil": {
      "example": "2026-03-06:10:00",
      "type": "string",
      "format": "date-time",
      "description": "Date until which this credential is valid."
    },
    "issuer": {
      "name": "Issuer",
      "description": "Identifier of the competent authority issuing the certificate of origin (e.g., DID)",
      "type": "string",
      "format": "uri",
      "example": "did:web:chamberofcommerce.example.com"
    },
    "credentialSubject": {
      "name": "CertificateOfOrigin",
      "description": "Certificate of origin details",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Type of the business document.",
          "const": "CertificateOfOrigin"
        },
        "certificateNumber": {
          "example": "COO-2025-AU-001234",
          "type": "string",
          "description": "Reference number to identify a certificate of origin."
        },
        "issueDate": {
          "example": "2025-03-08T00:00:00Z",
          "type": "string",
          "format": "date-time",
          "description": "Date that a document was issued and when appropriate, signed or otherwise authenticated."
        },
        "exporter": {
          "description": "Party who makes, or on whose behalf the export declaration is made, and who is the owner of the goods or has similar rights of disposal over them at the time when the declaration is accepted.",
          "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."
            },
            "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 or other authorised person 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."
                }
              }
            }
          }
        },
        "seller": {
          "description": "Party selling merchandise or services to a buyer.",
          "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."
            },
            "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."
                }
              }
            }
          }
        },
        "placeOfIssue": {
          "description": "Location where a document was issued and when appropriate, signed or otherwise authenticated.",
          "type": "object",
          "properties": {
            "addressLocality": {
              "example": "Barton",
              "type": "string",
              "description": "City where issued"
            },
            "addressRegion": {
              "example": "ACT",
              "type": "string",
              "description": "State where issued"
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country where issued"
            }
          }
        },
        "originCountry": {
          "description": "Name of the country in which the goods have been produced or manufactured.",
          "type": "object",
          "properties": {
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "ISO country code"
            },
            "name": {
              "example": "Australia",
              "type": "string",
              "description": "Country name"
            }
          }
        },
        "exportationCountry": {
          "description": "Country from which a consignment of goods was initially 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 a consignment of goods is to be or has been delivered.",
          "type": "object",
          "properties": {
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "ISO country code"
            },
            "name": {
              "example": "Australia",
              "type": "string",
              "description": "Country name"
            }
          }
        },
        "originalLoadingLocation": {
          "description": "Location where the goods were first loaded onto the means of transport.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Port of Gold Coast",
              "type": "string",
              "description": "Location name"
            },
            "addressLocality": {
              "example": "Gold Coast",
              "type": "string",
              "description": "City"
            },
            "addressRegion": {
              "example": "QLD",
              "type": "string",
              "description": "State"
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country"
            },
            "unLocode": {
              "example": "https://service.unece.org/trade/locode/au.htm#AUGOL",
              "type": "string",
              "format": "uri",
              "description": "UN/LOCODE identifier"
            }
          }
        },
        "baseportUnloadingLocation": {
          "description": "The place or port at which the cargo is discharged.",
          "type": "object",
          "properties": {
            "name": {
              "example": "Port of Sydney",
              "type": "string",
              "description": "Location name"
            },
            "addressLocality": {
              "example": "Sydney",
              "type": "string",
              "description": "City"
            },
            "addressRegion": {
              "example": "NSW",
              "type": "string",
              "description": "State"
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country"
            },
            "unLocode": {
              "example": "https://service.unece.org/trade/locode/au.htm#AUSYD",
              "type": "string",
              "format": "uri",
              "description": "UN/LOCODE identifier"
            }
          }
        },
        "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."
        },
        "contractNumber": {
          "example": "CTR-2025-SURF-001",
          "type": "string",
          "description": "Identifier of a contract concluded between parties."
        },
        "issuingAuthority": {
          "description": "Name, signature and seal of the party issuing the certificate of origin (UID:3P03).",
          "type": "object",
          "properties": {
            "name": {
              "example": "Australian Chamber of Commerce and Industry",
              "type": "string",
              "description": "Name of the issuing authority."
            },
            "streetAddress": {
              "example": "24 Brisbane Avenue",
              "type": "string",
              "description": "Street address."
            },
            "addressLocality": {
              "example": "Barton",
              "type": "string",
              "description": "City."
            },
            "addressRegion": {
              "example": "ACT",
              "type": "string",
              "description": "State."
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country."
            }
          }
        },
        "competentAuthority": {
          "description": "Name, address, national seal/stamp and country of the management or competent authority overseeing origin certification (UID:3P04).",
          "type": "object",
          "properties": {
            "name": {
              "example": "Department of Foreign Affairs and Trade",
              "type": "string",
              "description": "Name of the competent authority."
            },
            "addressCountry": {
              "example": "AU",
              "type": "string",
              "description": "Country of the competent authority."
            }
          }
        },
        "numberOfPackages": {
          "example": 18,
          "type": "number",
          "description": "Total number of packages in the consignment (UID:7012)."
        },
        "certification": {
          "example": "The undersigned hereby certifies, to the best of our knowledge and belief, that the goods listed in this certificate originate in Australia",
          "type": "string",
          "description": "Text of official certification."
        },
        "authentication": {
          "example": "Certified and stamped by the Australian Chamber of Commerce and Industry",
          "type": "string",
          "description": "Proof that a document has been authenticated."
        },
        "goods": {
          "name": "Goods",
          "description": "Goods covered by the certificate of origin",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "example": "Professional Longboard - Ocean Series, 9'6\" length",
                "type": "string",
                "description": "Plain language description of the nature of a goods item."
              },
              "hsCode": {
                "example": "950630",
                "type": "string",
                "description": "Code specifying a type of goods for Customs purposes."
              },
              "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"
                  }
                }
              },
              "value": {
                "description": "Value of the goods",
                "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"
                  }
                }
              },
              "countryOfOrigin": {
                "example": "AU",
                "type": "string",
                "description": "Country where the goods were produced or manufactured."
              }
            },
            "description": "A specific goods item covered by the certificate."
          }
        }
      },
      "required": [
        "type",
        "certificateNumber",
        "issueDate",
        "exporter",
        "originCountry",
        "issuingAuthority",
        "competentAuthority",
        "numberOfPackages",
        "goods"
      ],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
