border.bot
Esc
  • Loading…
↑ ↓ to move↵ to openEsc to close
Docs menu

Generate a commercial invoice PDF

POST https://api.border.bot/v1/documents/invoice

Requires an access token from an API client (Authorization: Bearer <access_token>).

A commercial invoice (kind: commercial) or pro forma invoice (kind: proforma) as a PDF: the exporter, consignee and, when they differ, buyer and importer of record with their tax references; the reason for export, Incoterms, currency and transport details; the goods table (description, HS code, origin, quantity, unit price, net weight, amount) over as many pages as it needs; itemised charges and the total; further declarations and the signatory’s statement. A4 or Letter (paper), 1 to 3 copies. Validated before charging: a general description, a malformed HS code or non-Latin text answers 400 without a charge. You make the declaration on it: border.bot doesn’t check, value or file anything, and no carrier or authority has to accept it (Terms, Shipping documents: https://border.bot/legal/terms#shipping-documents). Costs 1 credit.

API client scope: documents.

Headers#

Name Type Required Description
idempotency-key string no Make retries safe: a repeat with the same key returns the original result without charging again (keys are scoped to your workspace).

Request body (JSON)#

Name Type Required Description
kind "commercial" | "proforma" no
number string yes
date string (date) yes
orderReference string no
exporter object yes
consignee object yes
buyer object no
importer object no
reasonForExport "sale" | "gift" | "sample" | "return" | "repair" | "personal" | "other" no
reasonDetail string no
incoterm "EXW" | "FCA" | "CPT" | "CIP" | "DAP" | "DPU" | "DDP" | "FAS" | "FOB" | "CFR" | "CIF" no
incotermPlace string no
currency string yes
paymentTerms string no
carrier string no
trackingNumber string no
packages integer no
weightUnit "kg" | "lb" no
grossWeight number no
netWeight number no
portOfEntry string no
marks string no
lines object[] yes
freight number no
insurance number no
packing number no
otherCharges number no
otherChargesLabel string no
discount number no
declarations string no
signatory object yes
paper "a4" | "letter" no
copies integer no

Responses#

  • 200: The PDF (base64) and the credits charged. (CommercialInvoiceResponse)
  • 400: Invalid input (invalid_input). (Error)
  • 401: Missing, invalid or expired access token, or a revoked or expired API client (unauthorized). (Error)
  • 402: Not enough credits (insufficient_credits). Nothing was charged. (Error)
  • 403: Workspace suspended, action disabled, or the client lacks the scope (org_suspended, action_disabled, forbidden). (Error)
  • 409: A request with this Idempotency-Key is still in progress (conflict). (Error)
  • 429: Rate limited (rate_limited). Retry after Retry-After seconds; RateLimit says which limit was hit (r=0, t seconds until its window ends) and RateLimit-Policy its quota. (Error)
  • 500: Unexpected error (internal). (Error)
  • 502: The engine failed (upstream_error). The credits are refunded automatically. (Error)
  • 504: The engine timed out (upstream_timeout). The credits are refunded automatically. (Error)

Example request#

curl -X POST https://api.border.bot/v1/documents/invoice \
  -H "Authorization: Bearer $BORDERBOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "kind": "commercial",
    "number": "INV-2026-0418",
    "date": "2026-10-26",
    "orderReference": "PO 88213",
    "exporter": {
      "name": "Northwind Apparel Ltd",
      "contact": "Priya Shah",
      "address": "Unit 4, Bath Road Trading Estate",
      "city": "Hounslow",
      "postcode": "TW4 6HG",
      "country": "GB",
      "phone": "+44 20 7946 0000",
      "email": "exports@northwind.example",
      "taxReferences": [
        {
          "label": "EORI",
          "value": "GB123456789000"
        },
        {
          "label": "VAT",
          "value": "GB123456789"
        }
      ]
    },
    "consignee": {
      "name": "Harbor Street Retail Inc",
      "contact": "Receiving dept.",
      "address": "1200 Harbor Street, Suite 300",
      "city": "Los Angeles",
      "region": "CA",
      "postcode": "90021",
      "country": "US",
      "phone": "+1 213 555 0100",
      "taxReferences": [
        {
          "label": "EIN",
          "value": "12-3456789"
        }
      ]
    },
    "reasonForExport": "sale",
    "incoterm": "DAP",
    "incotermPlace": "Los Angeles",
    "currency": "USD",
    "paymentTerms": "Net 30",
    "carrier": "DHL Express",
    "trackingNumber": "1234567890",
    "packages": 4,
    "weightUnit": "kg",
    "grossWeight": 86.4,
    "portOfEntry": "Los Angeles, CA",
    "marks": "HSR / LOS ANGELES / 1-4",
    "lines": [
      {
        "description": "Men'\''s T-shirts, knitted, 100% cotton, short sleeves",
        "sku": "NW-TEE-001",
        "hsCode": "610910",
        "origin": "PT",
        "quantity": 300,
        "unit": "pcs",
        "unitPrice": 6.4,
        "netWeight": 54
      },
      {
        "description": "Women'\''s hooded sweatshirts, knitted, 80% cotton 20% polyester",
        "sku": "NW-HOOD-014",
        "hsCode": "611020",
        "origin": "PT",
        "quantity": 180,
        "unit": "pcs",
        "unitPrice": 14.75,
        "netWeight": 27
      },
      {
        "description": "Woven cotton tote bags, printed, with handles",
        "sku": "NW-TOTE-003",
        "hsCode": "420292",
        "origin": "IN",
        "quantity": 60,
        "unit": "pcs",
        "unitPrice": 3.1,
        "netWeight": 3.6
      }
    ],
    "freight": 210,
    "insurance": 18.5,
    "signatory": {
      "name": "Priya Shah",
      "title": "Export manager",
      "place": "Hounslow"
    },
    "paper": "a4",
    "copies": 1
  }'

Example response (200)#

JSON
{
  "data": {
    "number": "INV-2026-0418",
    "filename": "Commercial-invoice-INV-2026-0418.pdf",
    "pages": 1,
    "contentType": "application/pdf",
    "pdf": "string"
  },
  "credits": {
    "charged": 0,
    "remaining": 0,
    "usageId": "string"
  },
  "replayed": false
}