TypeScript definitions and generator for Schema.org vocabulary with strongly-typed JSON-LD support
—
Schema.org types for products, offers, orders, payments, and e-commerce functionality.
The root type for all products and commercial items.
/**
* Any offered product or service. For example: a pair of shoes; a concert ticket;
* the rental of a car; a haircut; or an episode of a TV show streamed online
*/
type Product = ProductLeaf | DietarySupplement | Drug | IndividualProduct |
ProductCollection | ProductGroup | ProductModel | SomeProducts | Vehicle;
interface ProductBase extends ThingBase {
/** A property-value pair representing an additional characteristic of the entity */
additionalProperty?: SchemaValue<PropertyValue, "additionalProperty">;
/** The overall rating, based on a collection of reviews or ratings, of the item */
aggregateRating?: SchemaValue<AggregateRating, "aggregateRating">;
/** An intended audience, i.e. a group for whom something was created */
audience?: SchemaValue<Audience, "audience">;
/** An award won by or for this item */
award?: SchemaValue<Text, "award">;
/** The brand(s) associated with the product */
brand?: SchemaValue<Brand | Organization, "brand">;
/** A category for the item */
category?: SchemaValue<CategoryCode | PhysicalActivityCategory | Text | Thing | URL, "category">;
/** The color of the product */
color?: SchemaValue<Text, "color">;
/** The depth of the item */
depth?: SchemaValue<Distance | QuantitativeValue, "depth">;
/** A Global Trade Item Number (GTIN) */
gtin?: SchemaValue<Text, "gtin">;
/** The GTIN-12 code of the product, or the product to which the offer refers */
gtin12?: SchemaValue<Text, "gtin12">;
/** The GTIN-13 code of the product, or the product to which the offer refers */
gtin13?: SchemaValue<Text, "gtin13">;
/** The GTIN-14 code of the product, or the product to which the offer refers */
gtin14?: SchemaValue<Text, "gtin14">;
/** The GTIN-8 code of the product, or the product to which the offer refers */
gtin8?: SchemaValue<Text, "gtin8">;
/** Indicates whether this content is family friendly */
isFamilyFriendly?: SchemaValue<Boolean, "isFamilyFriendly">;
/** A predefined value from the OfferItemCondition enumeration */
itemCondition?: SchemaValue<OfferItemCondition, "itemCondition">;
/** Keywords or tags used to describe this content */
keywords?: SchemaValue<DefinedTerm | Text | URL, "keywords">;
/** A logo associated with an organization or product */
logo?: SchemaValue<ImageObject | URL, "logo">;
/** The manufacturer of the product */
manufacturer?: SchemaValue<Organization, "manufacturer">;
/** A material that something is made from */
material?: SchemaValue<Product | Text | URL, "material">;
/** The model of the product */
model?: SchemaValue<ProductModel | Text, "model">;
/** The Manufacturer Part Number (MPN) of the product */
mpn?: SchemaValue<Text, "mpn">;
/** An offer to provide this item */
offers?: SchemaValue<Demand | Offer, "offers">;
/** The product identifier, such as ISBN */
productID?: SchemaValue<Text, "productID">;
/** The date of production of the item */
productionDate?: SchemaValue<Date, "productionDate">;
/** The date the item was purchased */
purchaseDate?: SchemaValue<Date, "purchaseDate">;
/** The release date of a product or product model */
releaseDate?: SchemaValue<Date, "releaseDate">;
/** A review of the item */
review?: SchemaValue<Review, "review">;
/** The Stock Keeping Unit (SKU) */
sku?: SchemaValue<Text, "sku">;
/** A slogan or motto associated with the item */
slogan?: SchemaValue<Text, "slogan">;
/** The weight of the product or person */
weight?: SchemaValue<QuantitativeValue, "weight">;
/** The width of the item */
width?: SchemaValue<Distance | QuantitativeValue, "width">;
/** The height of the item */
height?: SchemaValue<Distance | QuantitativeValue, "height">;
}Types for product variations, groupings, and collections.
/**
* A specific product, either a unique instance of a more generic product or
* a product offered for sale by specific sellers
*/
type IndividualProduct = IndividualProductLeaf;
interface IndividualProductBase extends ProductBase {
/** The serial number or any alphanumeric identifier of a particular product */
serialNumber?: SchemaValue<Text, "serialNumber">;
}
/**
* A ProductCollection is a set of products in e-commerce
*/
type ProductCollection = ProductCollectionLeaf;
/**
* A ProductGroup represents a group of Products that vary only in certain attributes
*/
type ProductGroup = ProductGroupLeaf;
interface ProductGroupBase extends ProductBase {
/** Indicates a textual identifier for a ProductGroup */
productGroupID?: SchemaValue<Text, "productGroupID">;
/** Indicates the property or properties by which the products in the group vary */
variesBy?: SchemaValue<DefinedTerm | Text, "variesBy">;
}
/**
* A datasheet or vendor specification of a product
*/
type ProductModel = ProductModelLeaf;
interface ProductModelBase extends ProductBase {
/** A pointer to a base product from which this product is a variant */
isVariantOf?: SchemaValue<ProductGroup | ProductModel, "isVariantOf">;
/** A pointer from a previous, often discontinued variant of the product to its newer variant */
predecessorOf?: SchemaValue<ProductModel, "predecessorOf">;
/** A pointer from a newer variant of a product to its previous, often discontinued predecessor */
successorOf?: SchemaValue<ProductModel, "successorOf">;
}Usage Examples:
import type { Product, IndividualProduct, ProductGroup, ProductModel } from "schema-dts";
// Basic product
const smartphone: Product = {
"@type": "Product",
name: "Galaxy S24",
description: "Latest flagship smartphone",
brand: {
"@type": "Brand",
name: "Samsung"
},
manufacturer: {
"@type": "Organization",
name: "Samsung Electronics"
},
model: "SM-S921U",
category: "Electronics",
color: ["Black", "White", "Purple"],
gtin13: "1234567890123",
mpn: "SM-S921U-256GB",
offers: {
"@type": "Offer",
price: "999.99",
priceCurrency: "USD",
availability: "InStock",
seller: {
"@type": "Organization",
name: "Electronics Store"
}
}
};
// Individual product instance
const specificPhone: IndividualProduct = {
"@type": "IndividualProduct",
name: "Galaxy S24 - Serial ABC123",
model: "SM-S921U",
serialNumber: "ABC123456789",
color: "Black",
productionDate: "2024-02-15",
itemCondition: "NewCondition"
};
// Product group with variants
const phoneGroup: ProductGroup = {
"@type": "ProductGroup",
name: "Galaxy S24 Series",
productGroupID: "GALAXY-S24-GROUP",
variesBy: ["color", "storage capacity"],
hasVariant: [
{
"@type": "Product",
name: "Galaxy S24 128GB Black",
color: "Black"
},
{
"@type": "Product",
name: "Galaxy S24 256GB White",
color: "White"
}
]
};Types for pricing, availability, and commercial offers.
/**
* An offer to transfer some rights to an item or to provide a service
*/
type Offer = OfferLeaf | AggregateOffer;
interface OfferBase extends IntangibleBase {
/** The payment method(s) accepted by seller or merchant */
acceptedPaymentMethod?: SchemaValue<LoanOrCredit | PaymentMethod, "acceptedPaymentMethod">;
/** An additional offer that can only be obtained in combination with the first base offer */
addOn?: SchemaValue<Offer, "addOn">;
/** The amount of time that is required between accepting the offer and the actual usage of the resource or service */
advanceBookingRequirement?: SchemaValue<QuantitativeValue, "advanceBookingRequirement">;
/** The overall rating, based on a collection of reviews or ratings, of the item */
aggregateRating?: SchemaValue<AggregateRating, "aggregateRating">;
/** The geographic area where a service or offered item is provided */
areaServed?: SchemaValue<AdministrativeArea | GeoShape | Place | Text, "areaServed">;
/** The availability of this item */
availability?: SchemaValue<ItemAvailability, "availability">;
/** The end of the availability of the product or service included in the offer */
availabilityEnds?: SchemaValue<Date | DateTime | Time, "availabilityEnds">;
/** The beginning of the availability of the product or service included in the offer */
availabilityStarts?: SchemaValue<Date | DateTime | Time, "availabilityStarts">;
/** The place(s) from which the offer can be obtained */
availableAtOrFrom?: SchemaValue<Place, "availableAtOrFrom">;
/** The delivery method(s) available for this offer */
availableDeliveryMethod?: SchemaValue<DeliveryMethod, "availableDeliveryMethod">;
/** The business function (e.g. sell, lease, repair, dispose) of the offer or component of a bundle */
businessFunction?: SchemaValue<BusinessFunction, "businessFunction">;
/** A category for the item */
category?: SchemaValue<CategoryCode | PhysicalActivityCategory | Text | Thing | URL, "category">;
/** The typical delay between the receipt of the order and the goods either leaving the warehouse or being prepared for pickup */
deliveryLeadTime?: SchemaValue<QuantitativeValue, "deliveryLeadTime">;
/** The type(s) of customers for which the given offer is valid */
eligibleCustomerType?: SchemaValue<BusinessEntityType, "eligibleCustomerType">;
/** The duration for which the given offer is valid */
eligibleDuration?: SchemaValue<QuantitativeValue, "eligibleDuration">;
/** The interval and unit of measurement of ordering quantities for which the offer or price specification is valid */
eligibleQuantity?: SchemaValue<QuantitativeValue, "eligibleQuantity">;
/** The ISO 3166-1 (ISO 3166-1 alpha-2) or ISO 3166-2 code, the place, or the GeoShape for the geo-political region(s) for which the offer or delivery charge specification is valid */
eligibleRegion?: SchemaValue<GeoShape | Place | Text, "eligibleRegion">;
/** The transaction volume, in a monetary unit, for which the offer or price specification is valid */
eligibleTransactionVolume?: SchemaValue<PriceSpecification, "eligibleTransactionVolume">;
/** A Global Trade Item Number (GTIN) */
gtin?: SchemaValue<Text, "gtin">;
/** The GTIN-12 code of the product, or the product to which the offer refers */
gtin12?: SchemaValue<Text, "gtin12">;
/** The GTIN-13 code of the product, or the product to which the offer refers */
gtin13?: SchemaValue<Text, "gtin13">;
/** The GTIN-14 code of the product, or the product to which the offer refers */
gtin14?: SchemaValue<Text, "gtin14">;
/** The GTIN-8 code of the product, or the product to which the offer refers */
gtin8?: SchemaValue<Text, "gtin8">;
/** This links to a node or nodes indicating the exact quantity of the products included in an Offer or ProductCollection */
includesObject?: SchemaValue<TypeAndQuantityNode, "includesObject">;
/** The current approximate inventory level for the item or items */
inventoryLevel?: SchemaValue<QuantitativeValue, "inventoryLevel">;
/** A predefined value from the OfferItemCondition enumeration */
itemCondition?: SchemaValue<OfferItemCondition, "itemCondition">;
/** An item being offered (or demanded) */
itemOffered?: SchemaValue<AggregateOffer | CreativeWork | Event | MenuItem | Product | Service | Trip, "itemOffered">;
/** Length of the lease for some Accommodation, either particular to some Offer or in some cases intrinsic to the property */
leaseLength?: SchemaValue<Duration | QuantitativeValue, "leaseLength">;
/** The Manufacturer Part Number (MPN) of the product, or the product to which the offer refers */
mpn?: SchemaValue<Text, "mpn">;
/** The offer price of a product, or of a price component when attached to PriceSpecification and its subtypes */
price?: SchemaValue<Number | Text, "price">;
/** The currency of the price, or a price component when attached to PriceSpecification and its subtypes */
priceCurrency?: SchemaValue<Text, "priceCurrency">;
/** One or more detailed price specifications, indicating the unit price and delivery or payment charges */
priceSpecification?: SchemaValue<PriceSpecification, "priceSpecification">;
/** The date after which the price is no longer available */
priceValidUntil?: SchemaValue<Date, "priceValidUntil">;
/** A review of the item */
review?: SchemaValue<Review, "review">;
/** An entity which offers (sells / leases / lends / loans) the services or goods */
seller?: SchemaValue<Organization | Person, "seller">;
/** The serial number or any alphanumeric identifier of a particular product */
serialNumber?: SchemaValue<Text, "serialNumber">;
/** Indicates information about the shipping policies and options associated with an Offer */
shippingDetails?: SchemaValue<OfferShippingDetails, "shippingDetails">;
/** The Stock Keeping Unit (SKU), i.e. a merchant-specific identifier for a product or service, or the product to which the offer refers */
sku?: SchemaValue<Text, "sku">;
/** The date when the item becomes valid */
validFrom?: SchemaValue<Date | DateTime, "validFrom">;
/** The date after when the item is not valid */
validThrough?: SchemaValue<Date | DateTime, "validThrough">;
/** The warranty promise(s) included in the offer */
warranty?: SchemaValue<WarrantyPromise, "warranty">;
}
/**
* When a single product is associated with multiple offers (for example, the same pair of shoes offered by different merchants), then AggregateOffer can be used
*/
type AggregateOffer = AggregateOfferLeaf;
interface AggregateOfferBase extends OfferBase {
/** The highest price of all offers available */
highPrice?: SchemaValue<Number | Text, "highPrice">;
/** The lowest price of all offers available */
lowPrice?: SchemaValue<Number | Text, "lowPrice">;
/** The number of offers for the product */
offerCount?: SchemaValue<Integer, "offerCount">;
/** An offer to provide this item */
offers?: SchemaValue<Offer, "offers">;
}Usage Examples:
import type { Offer, AggregateOffer } from "schema-dts";
// Single offer
const laptopOffer: Offer = {
"@type": "Offer",
itemOffered: {
"@type": "Product",
name: "MacBook Pro 14-inch",
brand: "Apple"
},
price: "1999.00",
priceCurrency: "USD",
availability: "InStock",
seller: {
"@type": "Organization",
name: "Apple Store"
},
validFrom: "2024-01-01",
validThrough: "2024-12-31",
acceptedPaymentMethod: ["CreditCard", "Cash", "PayPal"],
availableDeliveryMethod: "OnSitePickup",
warranty: {
"@type": "WarrantyPromise",
durationOfWarranty: {
"@type": "QuantitativeValue",
value: 1,
unitCode: "ANN"
}
}
};
// Multiple offers aggregated
const phoneOffers: AggregateOffer = {
"@type": "AggregateOffer",
itemOffered: {
"@type": "Product",
name: "iPhone 15",
brand: "Apple"
},
lowPrice: "799.00",
highPrice: "899.00",
priceCurrency: "USD",
offerCount: 5,
offers: [
{
"@type": "Offer",
price: "799.00",
seller: {
"@type": "Organization",
name: "Store A"
}
},
{
"@type": "Offer",
price: "829.00",
seller: {
"@type": "Organization",
name: "Store B"
}
}
]
};Types for orders, purchases, and transaction management.
/**
* An order is a confirmation of a transaction (a receipt), which can contain multiple line items, each represented by an Offer that has been accepted by the customer
*/
type Order = OrderLeaf;
interface OrderBase extends IntangibleBase {
/** The offer(s) -- e.g., product, quantity and price combinations -- included in the order */
acceptedOffer?: SchemaValue<Offer, "acceptedOffer">;
/** The billing address for the order */
billingAddress?: SchemaValue<PostalAddress, "billingAddress">;
/** An entity that arranges for an exchange between a buyer and a seller */
broker?: SchemaValue<Organization | Person, "broker">;
/** A number that confirms the given order or payment has been received */
confirmationNumber?: SchemaValue<Text, "confirmationNumber">;
/** Party placing the order or paying the invoice */
customer?: SchemaValue<Organization | Person, "customer">;
/** Any discount applied (to an Order) */
discount?: SchemaValue<Number | Text, "discount">;
/** Code used to redeem a discount */
discountCode?: SchemaValue<Text, "discountCode">;
/** The currency of the discount */
discountCurrency?: SchemaValue<Text, "discountCurrency">;
/** Was the offer accepted as a gift for someone other than the buyer */
isGift?: SchemaValue<Boolean, "isGift">;
/** Date order was placed */
orderDate?: SchemaValue<Date | DateTime, "orderDate">;
/** The delivery of the parcel related to this order or order item */
orderDelivery?: SchemaValue<ParcelDelivery, "orderDelivery">;
/** The identifier of the transaction */
orderNumber?: SchemaValue<Text, "orderNumber">;
/** The current status of the order */
orderStatus?: SchemaValue<OrderStatus, "orderStatus">;
/** The item ordered */
orderedItem?: SchemaValue<OrderItem | Product | Service, "orderedItem">;
/** The organization or person from which the product was purchased */
seller?: SchemaValue<Organization | Person, "seller">;
/** The date payment is due */
paymentDue?: SchemaValue<DateTime, "paymentDue">;
/** The date that payment is due */
paymentDueDate?: SchemaValue<Date | DateTime, "paymentDueDate">;
/** The name of the credit card or other method of payment for the order */
paymentMethod?: SchemaValue<PaymentMethod, "paymentMethod">;
/** An identifier for the method of payment used */
paymentMethodId?: SchemaValue<Text, "paymentMethodId">;
/** The URL for sending a payment */
paymentUrl?: SchemaValue<URL, "paymentUrl">;
}
/**
* An order item is a line of an order. It includes the quantity and shipping details of a bought offer
*/
type OrderItem = OrderItemLeaf;
interface OrderItemBase extends IntangibleBase {
/** The delivery of the parcel related to this order or order item */
orderDelivery?: SchemaValue<ParcelDelivery, "orderDelivery">;
/** The identifier of the order item */
orderItemNumber?: SchemaValue<Text, "orderItemNumber">;
/** The current status of the order item */
orderItemStatus?: SchemaValue<OrderStatus, "orderItemStatus">;
/** The number of the item ordered */
orderQuantity?: SchemaValue<Number, "orderQuantity">;
/** The item ordered */
orderedItem?: SchemaValue<OrderItem | Product | Service, "orderedItem">;
}Usage Examples:
import type { Order, OrderItem } from "schema-dts";
// Complete order
const purchaseOrder: Order = {
"@type": "Order",
orderNumber: "ORD-2024-001234",
orderDate: "2024-03-15T10:30:00",
orderStatus: "OrderProcessing",
customer: {
"@type": "Person",
name: "John Customer",
email: "john@example.com"
},
seller: {
"@type": "Organization",
name: "Online Electronics Store"
},
acceptedOffer: [
{
"@type": "Offer",
itemOffered: {
"@type": "Product",
name: "Wireless Headphones",
sku: "WH-1000XM5"
},
price: "299.99",
priceCurrency: "USD",
quantity: 1
}
],
billingAddress: {
"@type": "PostalAddress",
streetAddress: "123 Main St",
addressLocality: "Anytown",
addressRegion: "CA",
postalCode: "90210",
addressCountry: "US"
},
paymentMethod: "CreditCard",
paymentDue: "2024-03-15T10:30:00",
discount: "50.00",
discountCode: "SAVE50",
discountCurrency: "USD"
};
// Individual order item
const orderItem: OrderItem = {
"@type": "OrderItem",
orderItemNumber: "ITEM-001",
orderQuantity: 2,
orderedItem: {
"@type": "Product",
name: "USB Cable",
sku: "USB-C-001"
},
orderItemStatus: "OrderInTransit",
orderDelivery: {
"@type": "ParcelDelivery",
expectedArrivalFrom: "2024-03-20",
expectedArrivalUntil: "2024-03-22",
hasDeliveryMethod: "ParcelService"
}
};Types for payment methods, invoices, and financial transactions.
/**
* A payment method is a standardized procedure for transferring the monetary amount for a purchase
*/
type PaymentMethod = PaymentMethodLeaf | CreditCard | DigitalWallet | PaymentCard;
/**
* A credit or debit card type as a standardized procedure for transferring the monetary amount for a purchase
*/
type CreditCard = CreditCardLeaf;
type PaymentCard = PaymentCardLeaf;
/**
* A statement of the money due for goods or services; a bill
*/
type Invoice = InvoiceLeaf;
interface InvoiceBase extends IntangibleBase {
/** The identifier for the account the payment will be applied to */
accountId?: SchemaValue<Text, "accountId">;
/** The time interval used to compute the invoice */
billingPeriod?: SchemaValue<Duration, "billingPeriod">;
/** An entity that arranges for an exchange between a buyer and a seller */
broker?: SchemaValue<Organization | Person, "broker">;
/** A category for the item */
category?: SchemaValue<CategoryCode | PhysicalActivityCategory | Text | Thing | URL, "category">;
/** A number that confirms the given order or payment has been received */
confirmationNumber?: SchemaValue<Text, "confirmationNumber">;
/** Party placing the order or paying the invoice */
customer?: SchemaValue<Organization | Person, "customer">;
/** The minimum payment required at this time */
minimumPaymentDue?: SchemaValue<MonetaryAmount | PriceSpecification, "minimumPaymentDue">;
/** The date that payment is due */
paymentDue?: SchemaValue<DateTime, "paymentDue">;
/** The date that payment is due */
paymentDueDate?: SchemaValue<Date | DateTime, "paymentDueDate">;
/** The name of the credit card or other method of payment for the order */
paymentMethod?: SchemaValue<PaymentMethod, "paymentMethod">;
/** An identifier for the method of payment used */
paymentMethodId?: SchemaValue<Text, "paymentMethodId">;
/** The status of payment; whether the invoice has been paid or not */
paymentStatus?: SchemaValue<PaymentStatusType | Text, "paymentStatus">;
/** The service provider, service operator, or service performer; the goods producer */
provider?: SchemaValue<Organization | Person, "provider">;
/** The Order(s) related to this Invoice */
referencesOrder?: SchemaValue<Order, "referencesOrder">;
/** The date the invoice is scheduled to be paid */
scheduledPaymentDate?: SchemaValue<Date, "scheduledPaymentDate">;
/** The total amount due */
totalPaymentDue?: SchemaValue<MonetaryAmount | PriceSpecification, "totalPaymentDue">;
}Usage Examples:
import type { PaymentMethod, CreditCard, Invoice } from "schema-dts";
// Credit card payment method
const creditCard: CreditCard = {
"@type": "CreditCard",
name: "Visa ending in 1234",
paymentMethodId: "card_1234567890"
};
// Invoice
const serviceInvoice: Invoice = {
"@type": "Invoice",
confirmationNumber: "INV-2024-5678",
customer: {
"@type": "Organization",
name: "ABC Company"
},
provider: {
"@type": "Organization",
name: "Consulting Services LLC"
},
paymentDueDate: "2024-04-15",
paymentStatus: "PaymentDue",
totalPaymentDue: {
"@type": "MonetaryAmount",
currency: "USD",
value: "2500.00"
},
minimumPaymentDue: {
"@type": "MonetaryAmount",
currency: "USD",
value: "500.00"
},
billingPeriod: {
"@type": "Duration",
startDate: "2024-03-01",
endDate: "2024-03-31"
}
};Install with Tessl CLI
npx tessl i tessl/npm-schema-dts