Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jon-dixon/2d0188975f2c50c9d480c59972208363 to your computer and use it in GitHub Desktop.

Select an option

Save jon-dixon/2d0188975f2c50c9d480c59972208363 to your computer and use it in GitHub Desktop.
APEX AI Agent - PO to JSON - JSON Schema
{
"title": "Sales Order",
"type": "object",
"required": [
"customerName",
"orderDate",
"purchaseOrderNumber",
"orderCurrency",
"orderTotal",
"shipTo",
"billTo",
"customerNotes",
"shippingInstructions",
"freightAmount",
"lines",
"extractionConfidence"
],
"properties": {
"customerName": {
"type": "string",
"description": "Buyer or ordering company that issued the PO. Never use vendor, supplier, seller, remit-to, pay-to, or the company listed under Purchase Order For."
},
"orderDate": {
"type": "string",
"description": "PO/order/purchase date in YYYY-MM-DD format. Do not use ship date, due date, invoice date, print date, footer timestamp, extraction date, or current date unless clearly labeled as the PO date."
},
"purchaseOrderNumber": {
"type": "string",
"description": "Customer PO number. Do not use vendor order number, invoice number, quote number, sales order number, shipment number, or tracking number."
},
"orderCurrency": {
"type": "string",
"description": "Three-letter ISO 4217 currency code. Use explicit currency when shown. If not shown, infer only when strongly supported by geography, address, tax terms, or business context."
},
"orderTotal": {
"type": "number",
"description": "Final payable PO total, including tax, freight, shipping, and fees when present. Do not use subtotal if a final total exists."
},
"shipTo": {
"type": "object",
"required": [
"companyName",
"contactName",
"phone",
"email",
"address1",
"city",
"stateProvince",
"postalCode",
"country"
],
"properties": {
"companyName": {
"type": [
"string",
"null"
],
"description": "Ship-to company or organization name. If not shown but billTo.companyName can be determined from customer/buyer information, use billTo.companyName. Use null only if neither shipTo.companyName nor billTo.companyName can be determined. Never use vendor, supplier, remit-to, or pay-to company names."
},
"contactName": {
"type": [
"string",
"null"
],
"description": "Ship-to contact, recipient, attention-to, or requester name if shown. Use null if not shown."
},
"phone": {
"type": [
"string",
"null"
],
"description": "Ship-to phone number if shown. Use null if not shown."
},
"email": {
"type": [
"string",
"null"
],
"description": "Ship-to email address if shown. Use null if not shown."
},
"address1": {
"type": [
"string",
"null"
],
"description": "Ship-to street address, including suite, unit, building, department, dock, or floor if present. Use null if not shown."
},
"city": {
"type": [
"string",
"null"
],
"description": "Ship-to city. Use null if not shown."
},
"stateProvince": {
"type": [
"string",
"null"
],
"description": "Ship-to state, province, region, or territory. Use null if not shown."
},
"postalCode": {
"type": [
"string",
"null"
],
"description": "Ship-to postal or ZIP code. Use null if not shown."
},
"country": {
"type": [
"string",
"null"
],
"description": "Ship-to country name or ISO country code if shown or strongly inferable. Use null if unknown."
}
},
"additionalProperties": false
},
"billTo": {
"type": "object",
"required": [
"companyName",
"contactName",
"phone",
"email",
"address1",
"city",
"stateProvince",
"postalCode",
"country"
],
"properties": {
"companyName": {
"type": [
"string",
"null"
],
"description": "Bill-to company or organization name. If not shown but shipTo.companyName can be determined from customer/buyer information, use shipTo.companyName. Use null only if neither billTo.companyName nor shipTo.companyName can be determined. Never use vendor, supplier, remit-to, or pay-to company names."
},
"contactName": {
"type": [
"string",
"null"
],
"description": "Bill-to contact, accounts payable contact, or attention-to name if shown. Use null if not shown."
},
"phone": {
"type": [
"string",
"null"
],
"description": "Bill-to phone number if shown. Use null if not shown."
},
"email": {
"type": [
"string",
"null"
],
"description": "Bill-to email address if shown. Use null if not shown."
},
"address1": {
"type": [
"string",
"null"
],
"description": "Bill-to street address, including suite, unit, building, department, dock, or floor if present. Use null if not shown."
},
"city": {
"type": [
"string",
"null"
],
"description": "Bill-to city. Use null if not shown."
},
"stateProvince": {
"type": [
"string",
"null"
],
"description": "Bill-to state, province, region, or territory. Use null if not shown."
},
"postalCode": {
"type": [
"string",
"null"
],
"description": "Bill-to postal or ZIP code. Use null if not shown."
},
"country": {
"type": [
"string",
"null"
],
"description": "Bill-to country name or ISO country code if shown or strongly inferable. Use null if unknown."
}
},
"additionalProperties": false
},
"customerNotes": {
"type": [
"string",
"null"
],
"description": "General notes, comments, special instructions, internal customer references, or free-text messages from the customer. Use null if not shown."
},
"shippingInstructions": {
"type": [
"string",
"null"
],
"description": "Customer-provided delivery, shipping, routing, packaging, carrier, dock, attention, drop-ship, or packaging instructions. Use null if not shown."
},
"freightAmount": {
"type": [
"number",
"null"
],
"description": "Freight, shipping, or delivery charge amount if separately shown. Use null if not shown."
},
"lines": {
"type": "array",
"description": "Product/item table lines only. Do not include subtotal, tax, freight, shipping, discount, fee, or summary rows unless they are true order lines.",
"items": {
"type": "object",
"required": [
"lineNumber",
"quantity",
"itemNumber",
"customerItemNumber",
"vendorItemNumber",
"manufacturerItemNumber",
"itemDescription",
"uom",
"unitPrice",
"lineTotal",
"requestedDate",
"lineNotes"
],
"properties": {
"lineNumber": {
"type": [
"number",
"null"
],
"description": "Line number from the PO if shown. Otherwise use the visual order of the product lines."
},
"quantity": {
"type": "number",
"description": "Ordered quantity."
},
"itemNumber": {
"type": "string",
"description": "Best item identifier for fulfillment. Prefer vendor SKU or seller item number. If no vendor SKU exists, use manufacturer SKU, customer item number, product ID, or part number."
},
"customerItemNumber": {
"type": [
"string",
"null"
],
"description": "Customer item number, customer SKU, customer part number, or buyer item identifier if shown. Use null if not shown."
},
"vendorItemNumber": {
"type": [
"string",
"null"
],
"description": "Vendor SKU, seller item number, supplier item number, or fulfillment item identifier if shown. Use null if not shown."
},
"manufacturerItemNumber": {
"type": [
"string",
"null"
],
"description": "Manufacturer part number, MPN, manufacturer SKU, or OEM item number if shown. Use null if not shown."
},
"itemDescription": {
"type": "string",
"description": "Purchased item description. Combine wrapped description lines into one meaningful description."
},
"uom": {
"type": [
"string",
"null"
],
"description": "Unit of measure exactly as shown on the PO, such as Each, EA, Unit, Box, Meter, or FT. Do not map to EBS UOM code. Use null if not shown."
},
"unitPrice": {
"type": "number",
"description": "Per-unit price or cost as a JSON number."
},
"lineTotal": {
"type": "number",
"description": "Extended line amount. Should approximately equal quantity multiplied by unitPrice."
},
"requestedDate": {
"type": [
"string",
"null"
],
"description": "Customer requested delivery, need-by, due, or requested ship date for this line if shown. Format as YYYY-MM-DD. Use null if not shown."
},
"lineNotes": {
"type": [
"string",
"null"
],
"description": "Line-specific notes, instructions, comments, or special handling text if shown. Use null if not shown."
}
},
"additionalProperties": false
}
},
"extractionConfidence": {
"type": "object",
"required": [
"overall",
"fields",
"warnings"
],
"properties": {
"overall": {
"type": "number",
"description": "Overall confidence score from 0 to 1."
},
"fields": {
"type": "object",
"required": [
"customerName",
"orderDate",
"purchaseOrderNumber",
"orderCurrency",
"orderTotal",
"shipTo",
"billTo",
"customerNotes",
"shippingInstructions",
"freightAmount",
"lines"
],
"properties": {
"customerName": {
"type": "number"
},
"orderDate": {
"type": "number"
},
"purchaseOrderNumber": {
"type": "number"
},
"orderCurrency": {
"type": "number"
},
"orderTotal": {
"type": "number"
},
"shipTo": {
"type": "number"
},
"billTo": {
"type": "number"
},
"customerNotes": {
"type": "number"
},
"shippingInstructions": {
"type": "number"
},
"freightAmount": {
"type": "number"
},
"lines": {
"type": "number"
}
},
"additionalProperties": false
},
"warnings": {
"type": "array",
"description": "Short warnings explaining uncertainty, inference, ambiguity, missing data, or potential extraction issues.",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment