{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "data/itinerary",
"title": "Itinerary",
"description": "A Versa itinerary",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"header",
"itemization",
"footer"
],
"properties": {
"schema_version": {
"title": "SchemaVersion",
"type": "string",
"minLength": 5,
"maxLength": 14,
"pattern": "^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$"
},
"header": {
"$ref": "#/$defs/header"
},
"itemization": {
"$ref": "#/$defs/itemization"
},
"footer": {
"$ref": "#/$defs/footer"
}
},
"$defs": {
"car_rental": {
"title": "CarRental",
"type": "object",
"additionalProperties": false,
"required": [
"rental_at",
"return_at",
"rental_location",
"return_location",
"driver_name",
"odometer_reading_in",
"odometer_reading_out",
"items",
"metadata"
],
"properties": {
"rental_at": {
"type": "integer"
},
"return_at": {
"type": "integer"
},
"rental_location": {
"$ref": "#/$defs/place"
},
"return_location": {
"$ref": "#/$defs/place"
},
"vehicle": {
"type": [
"object",
"null"
],
"required": [
"description",
"image"
],
"properties": {
"description": {
"type": "string"
},
"image": {
"type": [
"string",
"null"
],
"format": "uri"
}
}
},
"driver_name": {
"type": "string"
},
"odometer_reading_in": {
"type": "integer"
},
"odometer_reading_out": {
"type": "integer"
},
"items": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/item"
}
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
}
}
},
"customer": {
"title": "Customer",
"type": "object",
"additionalProperties": false,
"required": [
"name",
"metadata"
],
"properties": {
"name": {
"type": "string"
},
"email": {
"type": [
"string",
"null"
],
"format": "email",
"minLength": 6,
"maxLength": 127
},
"address": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/address"
}
]
},
"phone": {
"type": [
"string",
"null"
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
}
}
},
"flight": {
"title": "Flight",
"type": "object",
"additionalProperties": false,
"required": [
"tickets"
],
"properties": {
"tickets": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/flight_ticket"
}
},
"itinerary_locator": {
"type": [
"null",
"string"
]
}
}
},
"flight_segment": {
"title": "FlightSegment",
"type": "object",
"additionalProperties": false,
"required": [
"departure_airport_code",
"arrival_airport_code",
"metadata"
],
"properties": {
"departure_airport_code": {
"type": "string"
},
"arrival_airport_code": {
"type": "string"
},
"aircraft_type": {
"type": [
"null",
"string"
]
},
"departure_at": {
"type": [
"null",
"integer"
]
},
"arrival_at": {
"type": [
"null",
"integer"
]
},
"departure_tz": {
"type": [
"null",
"string"
]
},
"arrival_tz": {
"type": [
"null",
"string"
]
},
"flight_number": {
"type": [
"null",
"string"
]
},
"seat": {
"type": [
"null",
"string"
]
},
"class_of_service": {
"type": [
"null",
"string"
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
}
}
},
"flight_ticket": {
"title": "FlightTicket",
"type": "object",
"additionalProperties": false,
"required": [
"segments",
"metadata"
],
"properties": {
"segments": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/flight_segment"
}
},
"number": {
"type": [
"null",
"string"
]
},
"record_locator": {
"type": [
"null",
"string"
]
},
"passenger": {
"type": [
"null",
"string"
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
}
}
},
"header": {
"title": "Header",
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"third_party": {
"type": ["object", "null"],
"additionalProperties": false,
"required": ["relation", "make_primary"],
"properties": {
"relation": {
"type": "string",
"enum": [
"bnpl",
"delivery_service",
"marketplace",
"payment_processor",
"platform",
"point_of_sale"
]
},
"make_primary": {
"description": "Determines whether the merchant or third party gets top billing on the receipt",
"type": "boolean"
},
"merchant": {
"oneOf": [
{
"$ref": "#/$defs/org"
},
{
"type": "null"
}
]
}
}
},
"customer": {
"oneOf": [
{
"$ref": "#/$defs/customer"
},
{
"type": "null"
}
]
}
}
},
"itemization": {
"title": "Itemization",
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"lodging": {
"oneOf": [
{
"$ref": "#/$defs/lodging"
},
{
"type": "null"
}
]
},
"car_rental": {
"oneOf": [
{
"$ref": "#/$defs/car_rental"
},
{
"type": "null"
}
]
},
"transit_route": {
"oneOf": [
{
"$ref": "#/$defs/transit_route"
},
{
"type": "null"
}
]
},
"flight": {
"oneOf": [
{
"$ref": "#/$defs/flight"
},
{
"type": "null"
}
]
}
}
},
"lodging": {
"title": "Lodging",
"type": "object",
"additionalProperties": false,
"required": [
"check_in",
"check_out",
"items",
"location"
],
"properties": {
"check_in": {
"type": "integer"
},
"check_out": {
"type": "integer"
},
"location": {
"$ref": "#/$defs/place"
},
"items": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/item"
}
},
"room": {
"type": [
"null",
"string"
]
},
"guests": {
"type": [
"null",
"string"
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
}
}
},
"org": {
"title": "Org",
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"brand_color": {
"oneOf": [
{
"description": "Hex color",
"type": "string",
"pattern": "^#?([a-f0-9]{6}|[a-f0-9]{3})$"
},
{
"type": "null"
}
]
},
"legal_name": {
"type": [
"string",
"null"
]
},
"logo": {
"type": [
"string",
"null"
],
"format": "uri"
},
"website": {
"type": [
"string",
"null"
],
"format": "hostname"
},
"vat_number": {
"type": [
"string",
"null"
]
},
"address": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/address"
}
]
}
}
},
"address": {
"title": "Address",
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"street_address": {
"type": [
"string",
"null"
]
},
"city": {
"type": [
"string",
"null"
]
},
"region": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"minLength": 2,
"maxLength": 2
}
]
},
"country": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"minLength": 2,
"maxLength": 2
}
]
},
"postal_code": {
"type": [
"string",
"null"
]
},
"lat": {
"oneOf": [
{
"type": "number",
"minimum": -90,
"maximum": 90
},
{
"type": "null"
}
]
},
"lon": {
"oneOf": [
{
"type": "number",
"minimum": -180,
"maximum": 180
},
{
"type": "null"
}
]
},
"tz": {
"type": [
"string",
"null"
]
}
}
},
"place": {
"title": "Place",
"description": "The physical or online location where a transaction occurred",
"type": "object",
"required": [
"name",
"address",
"phone",
"url",
"google_place_id",
"image"
],
"properties": {
"name": {
"type": [
"string",
"null"
]
},
"address": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/address"
}
]
},
"phone": {
"type": [
"string",
"null"
]
},
"url": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"format": "uri"
}
]
},
"google_place_id": {
"type": [
"string",
"null"
]
},
"image": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"format": "uri"
}
]
}
}
},
"metadatum": {
"title": "Metadatum",
"type": "object",
"additionalProperties": false,
"required": [
"key",
"value"
],
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"transit_route": {
"title": "TransitRoute",
"type": "object",
"additionalProperties": false,
"required": [
"transit_route_items"
],
"properties": {
"transit_route_items": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/transit_route_item"
}
}
}
},
"transit_route_item": {
"title": "TransitRouteItem",
"type": "object",
"additionalProperties": false,
"required": [
"metadata"
],
"properties": {
"departure_location": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/place"
}
]
},
"arrival_location": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/place"
}
]
},
"departure_at": {
"type": [
"integer",
"null"
]
},
"arrival_at": {
"type": [
"integer",
"null"
]
},
"polyline": {
"oneOf": [
{
"type": "null"
},
{
"type": "string"
}
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
},
"passenger": {
"type": [
"string",
"null"
]
},
"mode": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"enum": ["car", "taxi", "rail", "bus", "ferry", "other"]
}
]
}
}
},
"item": {
"title": "Item",
"type": "object",
"additionalProperties": false,
"required": [
"description"
],
"properties": {
"date": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"format": "date"
}
]
},
"description": {
"type": "string"
},
"quantity": {
"type": [
"null",
"number"
]
},
"unit": {
"type": [
"null",
"string"
]
},
"unspsc": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"pattern": "^\\d{8}$"
}
]
},
"metadata": {
"type": "array",
"items": {
"$ref": "#/$defs/metadatum"
}
},
"product_image_asset_id": {
"oneOf": [
{
"type": "null"
},
{
"type": "string"
}
]
},
"group": {
"type": [
"null",
"string"
]
},
"url": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"format": "uri"
}
]
}
}
},
"doc": {
"title": "Doc",
"type": "object",
"additionalProperties": false,
"required": [
"title",
"body"
],
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
}
}
},
"footer": {
"title": "Footer",
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"supplemental_text": {
"type": [
"string",
"null"
]
}
}
}
}
}