{
 "openapi": "3.1.0",
 "info": {
  "title": "Triplicate API",
  "version": "1.4.0",
  "description": "Create matching export documents (proforma invoice, commercial invoice, packing list, shipping instruction; also purchase order, sales contract and certificate of origin) from order data. Also: search HS codes and UN/LOCODE port codes, check container numbers, calculate CBM and export prices, check a B/L or AWB draft and read a letter of credit. Free, no key; nothing is stored. The documents endpoint returns a link that opens Triplicate's generator filled in, where the user reviews and saves the PDF. MCP server with the same tools: https://api.triplicatedocs.com/mcp",
  "contact": {
   "url": "https://triplicatedocs.com/developers/"
  }
 },
 "servers": [
  {
   "url": "https://api.triplicatedocs.com"
  }
 ],
 "paths": {
  "/api/v1/documents": {
   "post": {
    "operationId": "createTradeDocuments",
    "summary": "Create export documents from order data",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "language": {
          "type": "string",
          "enum": [
           "en",
           "zh",
           "ar",
           "fr",
           "es",
           "pt",
           "ru",
           "tr",
           "hi",
           "ur",
           "bn",
           "id",
           "vi",
           "ja",
           "ko"
          ],
          "description": "Language of the generator page the link opens (documents are in English)",
          "default": "en"
         },
         "imperial_units": {
          "type": "boolean",
          "description": "Also show weights in pounds and volume in cubic feet on the packing list and shipping instruction (for US buyers)",
          "default": false
         },
         "hs_totals": {
          "type": "boolean",
          "description": "Also print totals by HS code (quantity, value, cartons, weights) on the invoice and packing list, for the customs broker's entry lines",
          "default": false
         },
         "destination_country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 code of the importing country (optional; otherwise taken from the port of discharge): adds that country's invoice rules to the checks"
         },
         "open_form": {
          "type": "string",
          "enum": [
           "vgm_declaration",
           "isf_data",
           "usmca_certification",
           "packing_declaration_australia",
           "bill_of_exchange",
           "beneficiary_certificate",
           "credit_note",
           "shipping_advice",
           "return_invoice"
          ],
          "description": "Also open one of the generator's extra forms with this data: VGM declaration (SOLAS, needs shipment.containers), ISF (10+2) data for a US buyer, USMCA/CUSMA certification of origin, packing declaration for sea containers to Australia, draft (bill of exchange), beneficiary's certificate, credit/debit note, shipping advice e-mail, or a return/repair invoice made from this invoice (the original invoice number, date and waybill as reference; the buyer as shipper when goods come back). Each has 3 free uses (the shipping advice has no limit)."
         },
         "open_document": {
          "type": "string",
          "enum": [
           "pi",
           "ci",
           "pl",
           "si",
           "po",
           "sc",
           "co"
          ],
          "description": "pi proforma invoice, ci commercial invoice, pl packing list, si shipping instruction, sc sales contract (seller and buyer sign; the remarks become its other terms), co certificate of origin (non-preferential: the exporter's declaration, with space for a chamber of commerce to certify it), po purchase order (the buyer's order to the supplier: buyer = issuer, seller = supplier)",
          "default": "ci"
         },
         "document": {
          "type": "object",
          "properties": {
           "number": {
            "type": "string",
            "description": "Invoice number"
           },
           "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "po": {
            "type": "string",
            "description": "Buyer's PO / contract number"
           },
           "valid_days": {
            "type": "number",
            "description": "Proforma validity in days"
           }
          }
         },
         "seller": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Seller / shipper / exporter"
         },
         "buyer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Buyer / consignee / importer"
         },
         "manufacturer": {
          "type": "object",
          "description": "Who made the goods, printed on the commercial invoice with its MID code (US shipments: carriers and CBP ask for it; textile and apparel entries must show it). The generator suggests the MID from 19 CFR Part 102 if mid is empty",
          "properties": {
           "same_as_seller": {
            "type": "boolean"
           },
           "name": {
            "type": "string"
           },
           "street": {
            "type": "string",
            "description": "Street address line with the building number"
           },
           "city": {
            "type": "string"
           },
           "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2"
           },
           "province": {
            "type": "string",
            "description": "Canada only, e.g. ON"
           },
           "mid": {
            "type": "string"
           }
          }
         },
         "sold_to": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Only if the buyer (sold to) is a different company from the consignee in 'buyer', e.g. a trading company buying for a factory: printed as BUYER (SOLD TO) on the invoice, the buyer on the proforma and sales contract"
         },
         "notify": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string"
           }
          },
          "description": "Notify party, if different from the buyer"
         },
         "terms": {
          "type": "object",
          "properties": {
           "incoterm": {
            "type": "string",
            "enum": [
             "EXW",
             "FCA",
             "FAS",
             "FOB",
             "CFR",
             "CIF",
             "CPT",
             "CIP",
             "DAP",
             "DPU",
             "DDP"
            ]
           },
           "place": {
            "type": "string",
            "description": "Named place, e.g. 'Busan' for FOB Busan"
           },
           "payment": {
            "type": "string",
            "description": "e.g. 'T/T 30% deposit, 70% before shipment'"
           },
           "currency": {
            "type": "string",
            "enum": [
             "USD",
             "EUR",
             "GBP",
             "JPY",
             "CNY",
             "KRW",
             "VND",
             "AUD",
             "CAD",
             "CHF",
             "HKD",
             "SGD",
             "INR",
             "PKR",
             "BDT",
             "IDR",
             "THB",
             "MYR",
             "PHP",
             "AED",
             "SAR",
             "TRY",
             "BRL",
             "MXN",
             "ZAR",
             "NGN",
             "KES",
             "EGP"
            ]
           }
          }
         },
         "shipment": {
          "type": "object",
          "properties": {
           "port_of_loading": {
            "type": "string"
           },
           "port_of_discharge": {
            "type": "string"
           },
           "vessel_or_flight": {
            "type": "string"
           },
           "etd": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "country_of_origin": {
            "type": "string"
           },
           "reason_for_export": {
            "type": "string",
            "enum": [
             "sale",
             "sample",
             "gift",
             "repair_and_return",
             "returned_goods",
             "temporary_export"
            ],
            "description": "Printed on courier invoices (box 10)"
           },
           "waybill_number": {
            "type": "string",
            "description": "Air waybill or courier tracking number, printed in box 6"
           },
           "export_declaration_number": {
            "type": "string",
            "description": "Export declaration, shipping bill or AES ITN number, printed in the remarks box"
           },
           "original_invoice_number": {
            "type": "string",
            "description": "Goods going back (reason_for_export repair_and_return, returned_goods or temporary_export): the original shipment's invoice number, printed as ORIGINAL SHIPMENT"
           },
           "original_invoice_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "original_waybill_number": {
            "type": "string",
            "description": "The original shipment's AWB or B/L number"
           },
           "containers": {
            "type": "array",
            "maxItems": 40,
            "description": "Sea containers (FCL): printed as CONTAINER / SEAL NO. on the invoice, packing list and shipping instruction; the numbers are checked against their ISO 6346 check digit. In the generator, More > VGM declaration (3 free uses) makes the SOLAS VGM form from them",
            "items": {
             "type": "object",
             "properties": {
              "number": {
               "type": "string",
               "description": "e.g. MSKU1234565"
              },
              "seal": {
               "type": "string"
              },
              "size_type": {
               "type": "string",
               "description": "e.g. 20GP, 40HC, 45G1"
              },
              "tare_kg": {
               "type": "number"
              },
              "carton_numbers": {
               "type": "string",
               "description": "Cartons in this container, e.g. '1-500': the packing list then shows each container's cartons, weights and CBM"
              }
             }
            }
           },
           "duties_paid_by": {
            "type": "string",
            "enum": [
             "receiver",
             "sender",
             "third_party"
            ],
            "description": "Courier invoices: who pays the import duties and taxes (DDP: sender)"
           },
           "pallets": {
            "type": "object",
            "description": "If the cartons are palletized: the documents then show e.g. 4 PLTS (101 CTNS), gross weight with the empty pallets and the loaded pallets' volume",
            "properties": {
             "count": {
              "type": "number"
             },
             "length_cm": {
              "type": "number"
             },
             "width_cm": {
              "type": "number"
             },
             "height_cm": {
              "type": "number",
              "description": "Loaded height"
             },
             "empty_pallet_weight_kg": {
              "type": "number"
             }
            }
           }
          }
         },
         "charges": {
          "type": "object",
          "properties": {
           "freight": {
            "type": "number"
           },
           "insurance": {
            "type": "number"
           },
           "discount": {
            "type": "number"
           }
          }
         },
         "items": {
          "type": "array",
          "maxItems": 100,
          "items": {
           "type": "object",
           "properties": {
            "description": {
             "type": "string"
            },
            "hs_code": {
             "type": "string"
            },
            "quantity": {
             "type": "number"
            },
            "unit": {
             "type": "string",
             "enum": [
              "PCS",
              "SETS",
              "BOXES",
              "PAIRS",
              "DOZ",
              "KG",
              "MT",
              "M",
              "SQM",
              "CBM",
              "L",
              "ROLLS",
              "BAGS"
             ]
            },
            "unit_price": {
             "type": "number"
            },
            "pieces_per_carton": {
             "type": "number"
            },
            "net_weight_per_carton_kg": {
             "type": "number"
            },
            "gross_weight_per_carton_kg": {
             "type": "number"
            },
            "carton_length_cm": {
             "type": "number"
            },
            "carton_width_cm": {
             "type": "number"
            },
            "carton_height_cm": {
             "type": "number"
            },
            "country_of_origin": {
             "type": "string",
             "description": "Only if this item's origin differs from shipment.country_of_origin; the documents then show the origin per item"
            },
            "free_of_charge": {
             "type": "boolean",
             "description": "Sent free (samples, gifts): the value stays on the documents for customs and is taken off the amount payable"
            },
            "not_originating": {
             "type": "boolean",
             "description": "With origin_statement: this item does not qualify and is marked as not covered by the statement"
            },
            "sku": {
             "type": "string",
             "description": "Seller's product code, printed under the description (EU import declarations for distance sales need it from 1 November 2026)"
            },
            "manufacturer_product_code": {
             "type": "string",
             "description": "Manufacturer's own product code (part number)"
            },
            "gtin": {
             "type": "string",
             "description": "GTIN / EAN / UPC barcode number, if the product has one"
            },
            "section_232_metal_origin": {
             "type": "string",
             "description": "US shipments of steel or aluminium articles: the countries where the steel was melted and poured or the aluminium smelted and cast, e.g. 'STEEL MELT AND POUR: KR'; printed under the description"
            },
            "packed_with_previous": {
             "type": "boolean",
             "description": "Assorted cartons: packed in the same cartons as the item before it, whose carton weights include this item; leave its carton fields empty"
            }
           },
           "required": [
            "description",
            "quantity"
           ]
          }
         },
         "shipping_marks": {
          "type": "string",
          "description": "Optional; generated from buyer, destination and carton count if empty"
         },
         "remarks": {
          "type": "string",
          "description": "Optional remarks printed on the documents, e.g. 'SAMPLES OF NO COMMERCIAL VALUE, NOT FOR RESALE. VALUE FOR CUSTOMS PURPOSES ONLY.'"
         },
         "bank": {
          "type": "object",
          "properties": {
           "bank_name": {
            "type": "string"
           },
           "swift": {
            "type": "string"
           },
           "account": {
            "type": "string"
           },
           "beneficiary": {
            "type": "string"
           },
           "bank_address": {
            "type": "string"
           }
          }
         },
         "signer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "title": {
            "type": "string"
           }
          }
         },
         "letter_of_credit": {
          "type": "object",
          "description": "Terms of the letter of credit (from MT700: 20, 31C, 32B, 39A, 44C, 31D, 48, 43P, 45A); the generator checks the documents against them (not among the free features)",
          "properties": {
           "number": {
            "type": "string"
           },
           "issue_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "amount": {
            "type": "number"
           },
           "tolerance_percent": {
            "type": "number"
           },
           "latest_shipment_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "expiry_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "presentation_days": {
            "type": "number"
           },
           "partial_shipments": {
            "type": "string",
            "enum": [
             "allowed",
             "not_allowed"
            ]
           },
           "goods_description": {
            "type": "string"
           },
           "show_on_documents": {
            "type": "boolean",
            "description": "Print the L/C number and date on the documents"
           }
          },
          "required": [
           "number"
          ]
         },
         "origin_statement": {
          "type": "object",
          "description": "Preferential origin statement printed on the commercial invoice in the agreement's exact wording (3 free uses). Only for goods that meet the agreement's rules of origin.",
          "properties": {
           "agreement": {
            "type": "string",
            "enum": [
             "eu_korea",
             "uk_korea",
             "eu_vietnam",
             "eu_singapore",
             "eu_japan",
             "uk_japan",
             "eu_uk",
             "eu_canada",
             "korea_efta",
             "eu_gsp",
             "uk_dcts"
            ]
           },
           "number": {
            "type": "string",
            "description": "Approved exporter's authorisation number (EU-Korea, UK-Korea, EU-Vietnam; may be empty up to EUR 6,000 per consignment), REX number (EU GSP, EU-Canada, EU-Singapore; EU exporters), UEN (Singapore exporters, EU-Singapore), Exporter Reference No. (EU-Japan, UK-Japan, EU-UK: REX or GB EORI), Business Number (Canadian exporters) or customs identification number (UK DCTS)"
           },
           "origin": {
            "type": "string",
            "description": "Origin as written in the statement, e.g. Korea, EU, Japan, European Union"
           },
           "place": {
            "type": "string",
            "description": "Place printed with the date, e.g. Seoul (default: the port of loading's city)"
           },
           "period_from": {
            "type": "string",
            "description": "YYYY-MM-DD; EU-Japan, UK-Japan, EU-UK, CETA: one statement for several shipments of identical products (12 months at most)"
           },
           "period_to": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "origin_criterion": {
            "type": "string",
            "description": "EU-Japan and UK-Japan: A, B, C1-C4, D or E. EU GSP and UK DCTS: P, or W followed by the HS heading (e.g. W 9618). Not used by the other agreements"
           }
          },
          "required": [
           "agreement"
          ]
         }
        },
        "required": [
         "seller",
         "buyer",
         "items"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Link to the filled-in documents, totals and checks",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "url": {
           "type": "string",
           "description": "Open this link to review the documents and save the PDF"
          },
          "opens": {
           "type": "string"
          },
          "totals": {
           "type": "object"
          },
          "checks": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "severity": {
              "type": "string",
              "enum": [
               "error",
               "warning",
               "note"
              ]
             },
             "message": {
              "type": "string"
             }
            }
           }
          },
          "notes": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "next": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Use when a user needs a proforma invoice, commercial invoice, packing list, shipping instruction, PO, sales contract or certificate of origin. Send the order data. Returns a link that opens the generator filled in, with totals and checks; the user reviews and saves the PDF. Nothing is stored."
   }
  },
  "/api/v1/shipment-plan": {
   "post": {
    "operationId": "prepareShipment",
    "summary": "Order data plus destination country: filled documents link with checks, Triplicate guides for the destination and the products' HS chapters, landed cost calculator link and HS lookups",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "language": {
          "type": "string",
          "enum": [
           "en",
           "zh",
           "ar",
           "fr",
           "es",
           "pt",
           "ru",
           "tr",
           "hi",
           "ur",
           "bn",
           "id",
           "vi",
           "ja",
           "ko"
          ],
          "description": "Language of the generator page the link opens (documents are in English)",
          "default": "en"
         },
         "imperial_units": {
          "type": "boolean",
          "description": "Also show weights in pounds and volume in cubic feet on the packing list and shipping instruction (for US buyers)",
          "default": false
         },
         "hs_totals": {
          "type": "boolean",
          "description": "Also print totals by HS code (quantity, value, cartons, weights) on the invoice and packing list, for the customs broker's entry lines",
          "default": false
         },
         "destination_country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 code of the importing country, e.g. SE, US, VN; picks the guides and presets the landed cost calculator"
         },
         "open_form": {
          "type": "string",
          "enum": [
           "vgm_declaration",
           "isf_data",
           "usmca_certification",
           "packing_declaration_australia",
           "bill_of_exchange",
           "beneficiary_certificate",
           "credit_note",
           "shipping_advice",
           "return_invoice"
          ],
          "description": "Also open one of the generator's extra forms with this data: VGM declaration (SOLAS, needs shipment.containers), ISF (10+2) data for a US buyer, USMCA/CUSMA certification of origin, packing declaration for sea containers to Australia, draft (bill of exchange), beneficiary's certificate, credit/debit note, shipping advice e-mail, or a return/repair invoice made from this invoice (the original invoice number, date and waybill as reference; the buyer as shipper when goods come back). Each has 3 free uses (the shipping advice has no limit)."
         },
         "open_document": {
          "type": "string",
          "enum": [
           "pi",
           "ci",
           "pl",
           "si",
           "po",
           "sc",
           "co"
          ],
          "description": "pi proforma invoice, ci commercial invoice, pl packing list, si shipping instruction, sc sales contract (seller and buyer sign; the remarks become its other terms), co certificate of origin (non-preferential: the exporter's declaration, with space for a chamber of commerce to certify it), po purchase order (the buyer's order to the supplier: buyer = issuer, seller = supplier)",
          "default": "ci"
         },
         "document": {
          "type": "object",
          "properties": {
           "number": {
            "type": "string",
            "description": "Invoice number"
           },
           "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "po": {
            "type": "string",
            "description": "Buyer's PO / contract number"
           },
           "valid_days": {
            "type": "number",
            "description": "Proforma validity in days"
           }
          }
         },
         "seller": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Seller / shipper / exporter"
         },
         "buyer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Buyer / consignee / importer"
         },
         "manufacturer": {
          "type": "object",
          "description": "Who made the goods, printed on the commercial invoice with its MID code (US shipments: carriers and CBP ask for it; textile and apparel entries must show it). The generator suggests the MID from 19 CFR Part 102 if mid is empty",
          "properties": {
           "same_as_seller": {
            "type": "boolean"
           },
           "name": {
            "type": "string"
           },
           "street": {
            "type": "string",
            "description": "Street address line with the building number"
           },
           "city": {
            "type": "string"
           },
           "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2"
           },
           "province": {
            "type": "string",
            "description": "Canada only, e.g. ON"
           },
           "mid": {
            "type": "string"
           }
          }
         },
         "sold_to": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Only if the buyer (sold to) is a different company from the consignee in 'buyer', e.g. a trading company buying for a factory: printed as BUYER (SOLD TO) on the invoice, the buyer on the proforma and sales contract"
         },
         "notify": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string"
           }
          },
          "description": "Notify party, if different from the buyer"
         },
         "terms": {
          "type": "object",
          "properties": {
           "incoterm": {
            "type": "string",
            "enum": [
             "EXW",
             "FCA",
             "FAS",
             "FOB",
             "CFR",
             "CIF",
             "CPT",
             "CIP",
             "DAP",
             "DPU",
             "DDP"
            ]
           },
           "place": {
            "type": "string",
            "description": "Named place, e.g. 'Busan' for FOB Busan"
           },
           "payment": {
            "type": "string",
            "description": "e.g. 'T/T 30% deposit, 70% before shipment'"
           },
           "currency": {
            "type": "string",
            "enum": [
             "USD",
             "EUR",
             "GBP",
             "JPY",
             "CNY",
             "KRW",
             "VND",
             "AUD",
             "CAD",
             "CHF",
             "HKD",
             "SGD",
             "INR",
             "PKR",
             "BDT",
             "IDR",
             "THB",
             "MYR",
             "PHP",
             "AED",
             "SAR",
             "TRY",
             "BRL",
             "MXN",
             "ZAR",
             "NGN",
             "KES",
             "EGP"
            ]
           }
          }
         },
         "shipment": {
          "type": "object",
          "properties": {
           "port_of_loading": {
            "type": "string"
           },
           "port_of_discharge": {
            "type": "string"
           },
           "vessel_or_flight": {
            "type": "string"
           },
           "etd": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "country_of_origin": {
            "type": "string"
           },
           "reason_for_export": {
            "type": "string",
            "enum": [
             "sale",
             "sample",
             "gift",
             "repair_and_return",
             "returned_goods",
             "temporary_export"
            ],
            "description": "Printed on courier invoices (box 10)"
           },
           "waybill_number": {
            "type": "string",
            "description": "Air waybill or courier tracking number, printed in box 6"
           },
           "export_declaration_number": {
            "type": "string",
            "description": "Export declaration, shipping bill or AES ITN number, printed in the remarks box"
           },
           "original_invoice_number": {
            "type": "string",
            "description": "Goods going back (reason_for_export repair_and_return, returned_goods or temporary_export): the original shipment's invoice number, printed as ORIGINAL SHIPMENT"
           },
           "original_invoice_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "original_waybill_number": {
            "type": "string",
            "description": "The original shipment's AWB or B/L number"
           },
           "containers": {
            "type": "array",
            "maxItems": 40,
            "description": "Sea containers (FCL): printed as CONTAINER / SEAL NO. on the invoice, packing list and shipping instruction; the numbers are checked against their ISO 6346 check digit. In the generator, More > VGM declaration (3 free uses) makes the SOLAS VGM form from them",
            "items": {
             "type": "object",
             "properties": {
              "number": {
               "type": "string",
               "description": "e.g. MSKU1234565"
              },
              "seal": {
               "type": "string"
              },
              "size_type": {
               "type": "string",
               "description": "e.g. 20GP, 40HC, 45G1"
              },
              "tare_kg": {
               "type": "number"
              },
              "carton_numbers": {
               "type": "string",
               "description": "Cartons in this container, e.g. '1-500': the packing list then shows each container's cartons, weights and CBM"
              }
             }
            }
           },
           "duties_paid_by": {
            "type": "string",
            "enum": [
             "receiver",
             "sender",
             "third_party"
            ],
            "description": "Courier invoices: who pays the import duties and taxes (DDP: sender)"
           },
           "pallets": {
            "type": "object",
            "description": "If the cartons are palletized: the documents then show e.g. 4 PLTS (101 CTNS), gross weight with the empty pallets and the loaded pallets' volume",
            "properties": {
             "count": {
              "type": "number"
             },
             "length_cm": {
              "type": "number"
             },
             "width_cm": {
              "type": "number"
             },
             "height_cm": {
              "type": "number",
              "description": "Loaded height"
             },
             "empty_pallet_weight_kg": {
              "type": "number"
             }
            }
           }
          }
         },
         "charges": {
          "type": "object",
          "properties": {
           "freight": {
            "type": "number"
           },
           "insurance": {
            "type": "number"
           },
           "discount": {
            "type": "number"
           }
          }
         },
         "items": {
          "type": "array",
          "maxItems": 100,
          "items": {
           "type": "object",
           "properties": {
            "description": {
             "type": "string"
            },
            "hs_code": {
             "type": "string"
            },
            "quantity": {
             "type": "number"
            },
            "unit": {
             "type": "string",
             "enum": [
              "PCS",
              "SETS",
              "BOXES",
              "PAIRS",
              "DOZ",
              "KG",
              "MT",
              "M",
              "SQM",
              "CBM",
              "L",
              "ROLLS",
              "BAGS"
             ]
            },
            "unit_price": {
             "type": "number"
            },
            "pieces_per_carton": {
             "type": "number"
            },
            "net_weight_per_carton_kg": {
             "type": "number"
            },
            "gross_weight_per_carton_kg": {
             "type": "number"
            },
            "carton_length_cm": {
             "type": "number"
            },
            "carton_width_cm": {
             "type": "number"
            },
            "carton_height_cm": {
             "type": "number"
            },
            "country_of_origin": {
             "type": "string",
             "description": "Only if this item's origin differs from shipment.country_of_origin; the documents then show the origin per item"
            },
            "free_of_charge": {
             "type": "boolean",
             "description": "Sent free (samples, gifts): the value stays on the documents for customs and is taken off the amount payable"
            },
            "not_originating": {
             "type": "boolean",
             "description": "With origin_statement: this item does not qualify and is marked as not covered by the statement"
            },
            "sku": {
             "type": "string",
             "description": "Seller's product code, printed under the description (EU import declarations for distance sales need it from 1 November 2026)"
            },
            "manufacturer_product_code": {
             "type": "string",
             "description": "Manufacturer's own product code (part number)"
            },
            "gtin": {
             "type": "string",
             "description": "GTIN / EAN / UPC barcode number, if the product has one"
            },
            "section_232_metal_origin": {
             "type": "string",
             "description": "US shipments of steel or aluminium articles: the countries where the steel was melted and poured or the aluminium smelted and cast, e.g. 'STEEL MELT AND POUR: KR'; printed under the description"
            },
            "packed_with_previous": {
             "type": "boolean",
             "description": "Assorted cartons: packed in the same cartons as the item before it, whose carton weights include this item; leave its carton fields empty"
            }
           },
           "required": [
            "description",
            "quantity"
           ]
          }
         },
         "shipping_marks": {
          "type": "string",
          "description": "Optional; generated from buyer, destination and carton count if empty"
         },
         "remarks": {
          "type": "string",
          "description": "Optional remarks printed on the documents, e.g. 'SAMPLES OF NO COMMERCIAL VALUE, NOT FOR RESALE. VALUE FOR CUSTOMS PURPOSES ONLY.'"
         },
         "bank": {
          "type": "object",
          "properties": {
           "bank_name": {
            "type": "string"
           },
           "swift": {
            "type": "string"
           },
           "account": {
            "type": "string"
           },
           "beneficiary": {
            "type": "string"
           },
           "bank_address": {
            "type": "string"
           }
          }
         },
         "signer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "title": {
            "type": "string"
           }
          }
         },
         "letter_of_credit": {
          "type": "object",
          "description": "Terms of the letter of credit (from MT700: 20, 31C, 32B, 39A, 44C, 31D, 48, 43P, 45A); the generator checks the documents against them (not among the free features)",
          "properties": {
           "number": {
            "type": "string"
           },
           "issue_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "amount": {
            "type": "number"
           },
           "tolerance_percent": {
            "type": "number"
           },
           "latest_shipment_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "expiry_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "presentation_days": {
            "type": "number"
           },
           "partial_shipments": {
            "type": "string",
            "enum": [
             "allowed",
             "not_allowed"
            ]
           },
           "goods_description": {
            "type": "string"
           },
           "show_on_documents": {
            "type": "boolean",
            "description": "Print the L/C number and date on the documents"
           }
          },
          "required": [
           "number"
          ]
         },
         "origin_statement": {
          "type": "object",
          "description": "Preferential origin statement printed on the commercial invoice in the agreement's exact wording (3 free uses). Only for goods that meet the agreement's rules of origin.",
          "properties": {
           "agreement": {
            "type": "string",
            "enum": [
             "eu_korea",
             "uk_korea",
             "eu_vietnam",
             "eu_singapore",
             "eu_japan",
             "uk_japan",
             "eu_uk",
             "eu_canada",
             "korea_efta",
             "eu_gsp",
             "uk_dcts"
            ]
           },
           "number": {
            "type": "string",
            "description": "Approved exporter's authorisation number (EU-Korea, UK-Korea, EU-Vietnam; may be empty up to EUR 6,000 per consignment), REX number (EU GSP, EU-Canada, EU-Singapore; EU exporters), UEN (Singapore exporters, EU-Singapore), Exporter Reference No. (EU-Japan, UK-Japan, EU-UK: REX or GB EORI), Business Number (Canadian exporters) or customs identification number (UK DCTS)"
           },
           "origin": {
            "type": "string",
            "description": "Origin as written in the statement, e.g. Korea, EU, Japan, European Union"
           },
           "place": {
            "type": "string",
            "description": "Place printed with the date, e.g. Seoul (default: the port of loading's city)"
           },
           "period_from": {
            "type": "string",
            "description": "YYYY-MM-DD; EU-Japan, UK-Japan, EU-UK, CETA: one statement for several shipments of identical products (12 months at most)"
           },
           "period_to": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "origin_criterion": {
            "type": "string",
            "description": "EU-Japan and UK-Japan: A, B, C1-C4, D or E. EU GSP and UK DCTS: P, or W followed by the HS heading (e.g. W 9618). Not used by the other agreements"
           }
          },
          "required": [
           "agreement"
          ]
         }
        },
        "required": [
         "seller",
         "buyer",
         "items"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Documents, guides and links",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "destination_country": {
           "type": [
            "string",
            "null"
           ]
          },
          "documents": {
           "type": "object"
          },
          "guides": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "title": {
              "type": "string"
             },
             "url": {
              "type": "string"
             }
            }
           }
          },
          "landed_cost_calculator": {
           "type": "string"
          },
          "hs_lookups": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "item": {
              "type": "string"
             },
             "url": {
              "type": "string"
             }
            }
           }
          },
          "note": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Use when the destination country is known: the same filled-documents link and checks as createTradeDocuments, plus Triplicate guides for that destination and the products' HS chapters, a landed cost calculator link and HS lookups."
   }
  },
  "/api/v1/hs": {
   "post": {
    "operationId": "lookupHsCode",
    "summary": "Search HS 2022 codes (6 digits) by English description or code prefix",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "query": {
          "type": "string"
         },
         "limit": {
          "type": "integer",
          "default": 8
         }
        },
        "required": [
         "query"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Candidate codes",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Use when a user asks which HS code a product falls under or what a code means. Returns HS 2022 six-digit candidates with their descriptions. National codes (8 to 10 digits) differ by country; the importer or customs broker confirms the classification."
   }
  },
  "/api/v1/shipment": {
   "post": {
    "operationId": "calculateShipment",
    "summary": "CBM, chargeable weight and container fit from carton sizes",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "cartons": {
          "type": "array",
          "items": {
           "type": "object",
           "properties": {
            "length_cm": {
             "type": "number"
            },
            "width_cm": {
             "type": "number"
            },
            "height_cm": {
             "type": "number"
            },
            "quantity": {
             "type": "number"
            },
            "gross_weight_kg": {
             "type": "number"
            }
           },
           "required": [
            "length_cm",
            "width_cm",
            "height_cm",
            "quantity"
           ]
          }
         }
        },
        "required": [
         "cartons"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Totals",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Returns the total CBM and gross weight, the chargeable weight for air and express courier, the sea LCL revenue tons, and how much of a 20ft, 40ft and 40ft high cube container the cartons fill."
   }
  },
  "/api/v1/price": {
   "post": {
    "operationId": "calculateExportPrice",
    "summary": "Quotation price under each Incoterms 2020 rule (EXW to DDP), in total and per unit, with links to a proforma invoice at each price",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "quantity": {
          "type": "number",
          "description": "Units in the shipment"
         },
         "unit_cost": {
          "type": "number",
          "description": "Seller's cost per unit (product cost)"
         },
         "markup_percent": {
          "type": "number",
          "description": "Markup on cost, e.g. 25 for +25%",
          "default": 0
         },
         "currency": {
          "type": "string",
          "enum": [
           "USD",
           "EUR",
           "GBP",
           "JPY",
           "CNY",
           "KRW",
           "VND",
           "AUD",
           "CAD",
           "CHF",
           "HKD",
           "SGD",
           "INR",
           "PKR",
           "BDT",
           "IDR",
           "THB",
           "MYR",
           "PHP",
           "AED",
           "SAR",
           "TRY",
           "BRL",
           "MXN",
           "ZAR",
           "NGN",
           "KES",
           "EGP"
          ],
          "default": "USD"
         },
         "mode": {
          "type": "string",
          "enum": [
           "sea",
           "any"
          ],
          "description": "sea: FOB/CFR/CIF (loaded on board at a port); any: containers handed over at a terminal, air or road: FCA/CPT/CIP",
          "default": "sea"
         },
         "costs": {
          "type": "object",
          "description": "Shipment totals in the same currency (omit what does not apply)",
          "properties": {
           "packing_loading": {
            "type": "number",
            "description": "Export packing and loading at the seller's premises"
           },
           "export_clearance": {
            "type": "number",
            "description": "Export customs clearance and documents"
           },
           "inland_to_port": {
            "type": "number",
            "description": "Transport to the port, airport or terminal"
           },
           "origin_terminal": {
            "type": "number",
            "description": "Terminal handling and loading at origin"
           },
           "main_freight": {
            "type": "number",
            "description": "Sea or air freight to the destination port/airport"
           },
           "insurance_rate_percent": {
            "type": "number",
            "description": "Cargo insurance rate in %; premium = rate x 110% x CIF/CIP value"
           },
           "destination_charges": {
            "type": "number",
            "description": "Destination terminal charges and delivery to the named place"
           },
           "unloading": {
            "type": "number",
            "description": "Unloading at the destination (DPU)"
           },
           "import_clearance": {
            "type": "number",
            "description": "Import customs clearance fees (DDP)"
           },
           "import_duty_percent": {
            "type": "number"
           },
           "import_vat_percent": {
            "type": "number",
            "description": "Import VAT/GST %"
           }
          }
         },
         "duty_basis": {
          "type": "string",
          "enum": [
           "cif",
           "fob"
          ],
          "description": "Customs value basis: cif (EU, UK, most countries) or fob (US, Canada, Australia)",
          "default": "cif"
         },
         "include_vat_in_ddp": {
          "type": "boolean",
          "default": false
         },
         "language": {
          "type": "string",
          "enum": [
           "en",
           "zh",
           "ar",
           "fr",
           "es",
           "pt",
           "ru",
           "tr",
           "hi",
           "ur",
           "bn",
           "id",
           "vi",
           "ja",
           "ko"
          ],
          "default": "en",
          "description": "Language of the generator page the proforma links open"
         }
        },
        "required": [
         "quantity",
         "unit_cost"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Prices by rule",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Use when a user has a unit cost and wants the price to quote under EXW, FCA, FOB, CFR, CIF, DAP, DPU or DDP. Builds the quotation price under each Incoterms 2020 rule from the unit cost, markup and the shipment's costs, in total and per unit, with links that open a proforma invoice at that price."
   }
  },
  "/api/v1/guides": {
   "post": {
    "operationId": "searchTradeGuides",
    "summary": "Search Triplicate's trade guides; returns page links and excerpts",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "query": {
          "type": "string",
          "description": "Question or topic in any of the 15 site languages, e.g. 'EORI number for UK imports', 'sheet mask HS code', 'CIF insurance 110%'"
         },
         "language": {
          "type": "string",
          "enum": [
           "en",
           "zh",
           "ar",
           "fr",
           "es",
           "pt",
           "ru",
           "tr",
           "hi",
           "ur",
           "bn",
           "id",
           "vi",
           "ja",
           "ko"
          ],
          "description": "Optional: language of the guides to search (detected from the query otherwise)"
         },
         "limit": {
          "type": "number",
          "default": 5
         }
        },
        "required": [
         "query"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Matching guide excerpts",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Searches Triplicate's source-checked trade notes and tool pages; returns titles, links and short excerpts to cite."
   }
  },
  "/api/v1/container": {
   "post": {
    "operationId": "checkContainerNumber",
    "summary": "Check a container number (ISO 6346 check digit), the owner of its prefix and the shipping line's tracking page; B/L numbers by SCAC prefix",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "number": {
          "type": "string",
          "description": "Container number (e.g. MSCU1234566) or bill of lading / booking number"
         }
        },
        "required": [
         "number"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Check result, owner and tracking link",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Checks the ISO 6346 check digit of a container number, names the owner of its prefix (shipping line or lessor) and gives that line's tracking page; bill of lading and booking numbers are matched by their SCAC prefix."
   }
  },
  "/api/v1/draft-check": {
   "post": {
    "operationId": "checkTransportDocumentDraft",
    "summary": "Compare a bill of lading or air waybill draft (its text) with the order data: names, ports, vessel, packages, gross weight, CBM, freight prepaid or collect against the Incoterms rule, marks, goods description, L/C number",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "language": {
          "type": "string",
          "enum": [
           "en",
           "zh",
           "ar",
           "fr",
           "es",
           "pt",
           "ru",
           "tr",
           "hi",
           "ur",
           "bn",
           "id",
           "vi",
           "ja",
           "ko"
          ],
          "description": "Language of the generator page the link opens (documents are in English)",
          "default": "en"
         },
         "imperial_units": {
          "type": "boolean",
          "description": "Also show weights in pounds and volume in cubic feet on the packing list and shipping instruction (for US buyers)",
          "default": false
         },
         "hs_totals": {
          "type": "boolean",
          "description": "Also print totals by HS code (quantity, value, cartons, weights) on the invoice and packing list, for the customs broker's entry lines",
          "default": false
         },
         "destination_country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2 code of the importing country (optional; otherwise taken from the port of discharge): adds that country's invoice rules to the checks"
         },
         "open_form": {
          "type": "string",
          "enum": [
           "vgm_declaration",
           "isf_data",
           "usmca_certification",
           "packing_declaration_australia",
           "bill_of_exchange",
           "beneficiary_certificate",
           "credit_note",
           "shipping_advice",
           "return_invoice"
          ],
          "description": "Also open one of the generator's extra forms with this data: VGM declaration (SOLAS, needs shipment.containers), ISF (10+2) data for a US buyer, USMCA/CUSMA certification of origin, packing declaration for sea containers to Australia, draft (bill of exchange), beneficiary's certificate, credit/debit note, shipping advice e-mail, or a return/repair invoice made from this invoice (the original invoice number, date and waybill as reference; the buyer as shipper when goods come back). Each has 3 free uses (the shipping advice has no limit)."
         },
         "open_document": {
          "type": "string",
          "enum": [
           "pi",
           "ci",
           "pl",
           "si",
           "po",
           "sc",
           "co"
          ],
          "description": "pi proforma invoice, ci commercial invoice, pl packing list, si shipping instruction, sc sales contract (seller and buyer sign; the remarks become its other terms), co certificate of origin (non-preferential: the exporter's declaration, with space for a chamber of commerce to certify it), po purchase order (the buyer's order to the supplier: buyer = issuer, seller = supplier)",
          "default": "ci"
         },
         "document": {
          "type": "object",
          "properties": {
           "number": {
            "type": "string",
            "description": "Invoice number"
           },
           "date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "po": {
            "type": "string",
            "description": "Buyer's PO / contract number"
           },
           "valid_days": {
            "type": "number",
            "description": "Proforma validity in days"
           }
          }
         },
         "seller": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Seller / shipper / exporter"
         },
         "buyer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Buyer / consignee / importer"
         },
         "manufacturer": {
          "type": "object",
          "description": "Who made the goods, printed on the commercial invoice with its MID code (US shipments: carriers and CBP ask for it; textile and apparel entries must show it). The generator suggests the MID from 19 CFR Part 102 if mid is empty",
          "properties": {
           "same_as_seller": {
            "type": "boolean"
           },
           "name": {
            "type": "string"
           },
           "street": {
            "type": "string",
            "description": "Street address line with the building number"
           },
           "city": {
            "type": "string"
           },
           "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2"
           },
           "province": {
            "type": "string",
            "description": "Canada only, e.g. ON"
           },
           "mid": {
            "type": "string"
           }
          }
         },
         "sold_to": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string",
            "description": "Full address, lines separated by \\n"
           },
           "tel": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "tax_id": {
            "type": "string",
            "description": "Tax / VAT / business registration number"
           }
          },
          "required": [
           "name"
          ],
          "description": "Only if the buyer (sold to) is a different company from the consignee in 'buyer', e.g. a trading company buying for a factory: printed as BUYER (SOLD TO) on the invoice, the buyer on the proforma and sales contract"
         },
         "notify": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "address": {
            "type": "string"
           }
          },
          "description": "Notify party, if different from the buyer"
         },
         "terms": {
          "type": "object",
          "properties": {
           "incoterm": {
            "type": "string",
            "enum": [
             "EXW",
             "FCA",
             "FAS",
             "FOB",
             "CFR",
             "CIF",
             "CPT",
             "CIP",
             "DAP",
             "DPU",
             "DDP"
            ]
           },
           "place": {
            "type": "string",
            "description": "Named place, e.g. 'Busan' for FOB Busan"
           },
           "payment": {
            "type": "string",
            "description": "e.g. 'T/T 30% deposit, 70% before shipment'"
           },
           "currency": {
            "type": "string",
            "enum": [
             "USD",
             "EUR",
             "GBP",
             "JPY",
             "CNY",
             "KRW",
             "VND",
             "AUD",
             "CAD",
             "CHF",
             "HKD",
             "SGD",
             "INR",
             "PKR",
             "BDT",
             "IDR",
             "THB",
             "MYR",
             "PHP",
             "AED",
             "SAR",
             "TRY",
             "BRL",
             "MXN",
             "ZAR",
             "NGN",
             "KES",
             "EGP"
            ]
           }
          }
         },
         "shipment": {
          "type": "object",
          "properties": {
           "port_of_loading": {
            "type": "string"
           },
           "port_of_discharge": {
            "type": "string"
           },
           "vessel_or_flight": {
            "type": "string"
           },
           "etd": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "country_of_origin": {
            "type": "string"
           },
           "reason_for_export": {
            "type": "string",
            "enum": [
             "sale",
             "sample",
             "gift",
             "repair_and_return",
             "returned_goods",
             "temporary_export"
            ],
            "description": "Printed on courier invoices (box 10)"
           },
           "waybill_number": {
            "type": "string",
            "description": "Air waybill or courier tracking number, printed in box 6"
           },
           "export_declaration_number": {
            "type": "string",
            "description": "Export declaration, shipping bill or AES ITN number, printed in the remarks box"
           },
           "original_invoice_number": {
            "type": "string",
            "description": "Goods going back (reason_for_export repair_and_return, returned_goods or temporary_export): the original shipment's invoice number, printed as ORIGINAL SHIPMENT"
           },
           "original_invoice_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "original_waybill_number": {
            "type": "string",
            "description": "The original shipment's AWB or B/L number"
           },
           "containers": {
            "type": "array",
            "maxItems": 40,
            "description": "Sea containers (FCL): printed as CONTAINER / SEAL NO. on the invoice, packing list and shipping instruction; the numbers are checked against their ISO 6346 check digit. In the generator, More > VGM declaration (3 free uses) makes the SOLAS VGM form from them",
            "items": {
             "type": "object",
             "properties": {
              "number": {
               "type": "string",
               "description": "e.g. MSKU1234565"
              },
              "seal": {
               "type": "string"
              },
              "size_type": {
               "type": "string",
               "description": "e.g. 20GP, 40HC, 45G1"
              },
              "tare_kg": {
               "type": "number"
              },
              "carton_numbers": {
               "type": "string",
               "description": "Cartons in this container, e.g. '1-500': the packing list then shows each container's cartons, weights and CBM"
              }
             }
            }
           },
           "duties_paid_by": {
            "type": "string",
            "enum": [
             "receiver",
             "sender",
             "third_party"
            ],
            "description": "Courier invoices: who pays the import duties and taxes (DDP: sender)"
           },
           "pallets": {
            "type": "object",
            "description": "If the cartons are palletized: the documents then show e.g. 4 PLTS (101 CTNS), gross weight with the empty pallets and the loaded pallets' volume",
            "properties": {
             "count": {
              "type": "number"
             },
             "length_cm": {
              "type": "number"
             },
             "width_cm": {
              "type": "number"
             },
             "height_cm": {
              "type": "number",
              "description": "Loaded height"
             },
             "empty_pallet_weight_kg": {
              "type": "number"
             }
            }
           }
          }
         },
         "charges": {
          "type": "object",
          "properties": {
           "freight": {
            "type": "number"
           },
           "insurance": {
            "type": "number"
           },
           "discount": {
            "type": "number"
           }
          }
         },
         "items": {
          "type": "array",
          "maxItems": 100,
          "items": {
           "type": "object",
           "properties": {
            "description": {
             "type": "string"
            },
            "hs_code": {
             "type": "string"
            },
            "quantity": {
             "type": "number"
            },
            "unit": {
             "type": "string",
             "enum": [
              "PCS",
              "SETS",
              "BOXES",
              "PAIRS",
              "DOZ",
              "KG",
              "MT",
              "M",
              "SQM",
              "CBM",
              "L",
              "ROLLS",
              "BAGS"
             ]
            },
            "unit_price": {
             "type": "number"
            },
            "pieces_per_carton": {
             "type": "number"
            },
            "net_weight_per_carton_kg": {
             "type": "number"
            },
            "gross_weight_per_carton_kg": {
             "type": "number"
            },
            "carton_length_cm": {
             "type": "number"
            },
            "carton_width_cm": {
             "type": "number"
            },
            "carton_height_cm": {
             "type": "number"
            },
            "country_of_origin": {
             "type": "string",
             "description": "Only if this item's origin differs from shipment.country_of_origin; the documents then show the origin per item"
            },
            "free_of_charge": {
             "type": "boolean",
             "description": "Sent free (samples, gifts): the value stays on the documents for customs and is taken off the amount payable"
            },
            "not_originating": {
             "type": "boolean",
             "description": "With origin_statement: this item does not qualify and is marked as not covered by the statement"
            },
            "sku": {
             "type": "string",
             "description": "Seller's product code, printed under the description (EU import declarations for distance sales need it from 1 November 2026)"
            },
            "manufacturer_product_code": {
             "type": "string",
             "description": "Manufacturer's own product code (part number)"
            },
            "gtin": {
             "type": "string",
             "description": "GTIN / EAN / UPC barcode number, if the product has one"
            },
            "section_232_metal_origin": {
             "type": "string",
             "description": "US shipments of steel or aluminium articles: the countries where the steel was melted and poured or the aluminium smelted and cast, e.g. 'STEEL MELT AND POUR: KR'; printed under the description"
            },
            "packed_with_previous": {
             "type": "boolean",
             "description": "Assorted cartons: packed in the same cartons as the item before it, whose carton weights include this item; leave its carton fields empty"
            }
           },
           "required": [
            "description",
            "quantity"
           ]
          }
         },
         "shipping_marks": {
          "type": "string",
          "description": "Optional; generated from buyer, destination and carton count if empty"
         },
         "remarks": {
          "type": "string",
          "description": "Optional remarks printed on the documents, e.g. 'SAMPLES OF NO COMMERCIAL VALUE, NOT FOR RESALE. VALUE FOR CUSTOMS PURPOSES ONLY.'"
         },
         "bank": {
          "type": "object",
          "properties": {
           "bank_name": {
            "type": "string"
           },
           "swift": {
            "type": "string"
           },
           "account": {
            "type": "string"
           },
           "beneficiary": {
            "type": "string"
           },
           "bank_address": {
            "type": "string"
           }
          }
         },
         "signer": {
          "type": "object",
          "properties": {
           "name": {
            "type": "string"
           },
           "title": {
            "type": "string"
           }
          }
         },
         "letter_of_credit": {
          "type": "object",
          "description": "Terms of the letter of credit (from MT700: 20, 31C, 32B, 39A, 44C, 31D, 48, 43P, 45A); the generator checks the documents against them (not among the free features)",
          "properties": {
           "number": {
            "type": "string"
           },
           "issue_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "amount": {
            "type": "number"
           },
           "tolerance_percent": {
            "type": "number"
           },
           "latest_shipment_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "expiry_date": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "presentation_days": {
            "type": "number"
           },
           "partial_shipments": {
            "type": "string",
            "enum": [
             "allowed",
             "not_allowed"
            ]
           },
           "goods_description": {
            "type": "string"
           },
           "show_on_documents": {
            "type": "boolean",
            "description": "Print the L/C number and date on the documents"
           }
          },
          "required": [
           "number"
          ]
         },
         "origin_statement": {
          "type": "object",
          "description": "Preferential origin statement printed on the commercial invoice in the agreement's exact wording (3 free uses). Only for goods that meet the agreement's rules of origin.",
          "properties": {
           "agreement": {
            "type": "string",
            "enum": [
             "eu_korea",
             "uk_korea",
             "eu_vietnam",
             "eu_singapore",
             "eu_japan",
             "uk_japan",
             "eu_uk",
             "eu_canada",
             "korea_efta",
             "eu_gsp",
             "uk_dcts"
            ]
           },
           "number": {
            "type": "string",
            "description": "Approved exporter's authorisation number (EU-Korea, UK-Korea, EU-Vietnam; may be empty up to EUR 6,000 per consignment), REX number (EU GSP, EU-Canada, EU-Singapore; EU exporters), UEN (Singapore exporters, EU-Singapore), Exporter Reference No. (EU-Japan, UK-Japan, EU-UK: REX or GB EORI), Business Number (Canadian exporters) or customs identification number (UK DCTS)"
           },
           "origin": {
            "type": "string",
            "description": "Origin as written in the statement, e.g. Korea, EU, Japan, European Union"
           },
           "place": {
            "type": "string",
            "description": "Place printed with the date, e.g. Seoul (default: the port of loading's city)"
           },
           "period_from": {
            "type": "string",
            "description": "YYYY-MM-DD; EU-Japan, UK-Japan, EU-UK, CETA: one statement for several shipments of identical products (12 months at most)"
           },
           "period_to": {
            "type": "string",
            "description": "YYYY-MM-DD"
           },
           "origin_criterion": {
            "type": "string",
            "description": "EU-Japan and UK-Japan: A, B, C1-C4, D or E. EU GSP and UK DCTS: P, or W followed by the HS heading (e.g. W 9618). Not used by the other agreements"
           }
          },
          "required": [
           "agreement"
          ]
         },
         "draft_text": {
          "type": "string",
          "description": "Text of the bill of lading or air waybill draft from the forwarder or carrier (copied from its PDF or e-mail), up to 20,000 characters"
         },
         "lc_number": {
          "type": "string",
          "description": "Optional letter of credit number that should appear on the draft"
         }
        },
        "required": [
         "draft_text"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Each field as ok, warning, mismatch or info",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "matches": {
           "type": "integer"
          },
          "to_check": {
           "type": "integer"
          },
          "results": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "field": {
              "type": "string"
             },
             "ours": {
              "type": "string"
             },
             "status": {
              "type": "string",
              "enum": [
               "ok",
               "warning",
               "mismatch",
               "info"
              ]
             },
             "message": {
              "type": "string"
             }
            }
           }
          },
          "totals": {
           "type": "object"
          },
          "note": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Compares the forwarder's or carrier's B/L or AWB draft text with the order data and lists each field as ok, warning, mismatch or info, so the draft can be corrected before the original is issued."
   }
  },
  "/api/v1/letter-of-credit": {
   "post": {
    "operationId": "readLetterOfCredit",
    "summary": "Read a documentary credit (SWIFT MT700 text as advised by the bank): number, dates, amount and tolerance, partial shipments, latest shipment, ports, presentation days, goods, documents required (each with how to make it), additional conditions, and a letter_of_credit object for /api/v1/documents",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "text": {
          "type": "string",
          "description": "The credit text with its MT700 field numbers (:20:, :31D:, :32B: ...)"
         }
        },
        "required": [
         "text"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Credit terms read from the text",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Reads the credit's MT700 text: terms, dates, amount and tolerance, the documents required (46A) with how to make each, and a letter_of_credit object to pass to createTradeDocuments. It does not judge whether a bank will accept the documents."
   }
  },
  "/api/v1/ports": {
   "post": {
    "operationId": "lookupPortCode",
    "summary": "UN/LOCODE codes of seaports, airports and inland depots by place name or code",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "query": {
          "type": "string",
          "description": "Port, city or airport name in English (e.g. 'Haiphong', 'Jebel Ali', 'Busan'), or a 5-character UN/LOCODE (e.g. 'NLRTM')"
         },
         "country": {
          "type": "string",
          "description": "Optional 2-letter ISO country code to search in, e.g. 'VN'"
         },
         "type": {
          "type": "string",
          "enum": [
           "port",
           "airport",
           "inland_depot"
          ],
          "description": "Optional: only seaports, airports or inland container depots"
         },
         "limit": {
          "type": "number",
          "default": 8
         }
        },
        "required": [
         "query"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Matching locations",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Error",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "string"
          },
          "detail": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "description": "Use when a user needs the UN/LOCODE of a port, airport or inland depot for a booking, bill of lading or invoice, or wants to check a code they were given. Finds UN/LOCODE codes of seaports, airports and inland depots by place name or code, optionally for one country and type."
   }
  }
 }
}