{"openapi":"3.1.0","info":{"title":"SmartDispatch Engine API","version":"1.0.0","description":"Plateforme SaaS Multi-Tenant & Self-Service de Routage Intelligent de Correspondances (MySendingBox, Pingen v2, AR24, Maileva), Expéditions Express & Collecte Siège (Boxtal v3), Règlements Couplés (QR Payout Link, Administrations, EBICS Lettre-Chèque) et Comptabilité Automatisée Dual-ERP (Pennylane API v2 & PGC Andorre / Penny).","contact":{"name":"ANTICA, SLU","email":"maxime.cernot@gmail.com","url":"https://dispatch.antica-industries.com"}},"servers":[{"url":"https://dispatch.antica-industries.com","description":"Production Sovereign Endpoint"}],"components":{"securitySchemes":{"BearerApiKey":{"type":"http","scheme":"bearer","description":"Scoped Tenant API key (`sd_live_...` or `sd_test_...`)"}}},"security":[{"BearerApiKey":[]}],"paths":{"/v1/health":{"get":{"summary":"Service health & operator status","security":[],"responses":{"200":{"description":"Healthy"}}}},"/v1/tenants/self-service/register":{"post":{"summary":"Autonomous Self-Service Tenant Onboarding (external B2B/B2A provider)","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["legal_name","contact_email","password","country_code"],"properties":{"legal_name":{"type":"string"},"tax_id":{"type":"string"},"vat_number":{"type":"string"},"country_code":{"type":"string","minLength":2,"maxLength":2},"contact_email":{"type":"string","format":"email"},"password":{"type":"string","minLength":10},"billing_mode":{"type":"string","enum":["WALLET_PREPAID","MONTHLY_INVOICE"]}}}}}},"responses":{"201":{"description":"Tenant created with initial sandbox & live API keys"}}}},"/v1/dispatches":{"post":{"summary":"Create & route a physical letter, LRAR, eIDAS LRE, Express Pickup parcel, or Coupled Payment","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":4}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["dossier_id","charge_target","channel","recipient","recipient_type"],"properties":{"end_client_id":{"type":"string","format":"uuid"},"dossier_id":{"type":"string","format":"uuid"},"cost_center_code":{"type":"string"},"charge_target":{"type":"string","enum":["REBILL_END_CLIENT_DISBURSEMENT","REBILL_END_CLIENT_MARKUP","BILL_TENANT_PLATFORM","ABSORB_OPERATOR"]},"channel":{"type":"string","enum":["SIMPLE_MAIL","REGISTERED_PAPER_LRAR","REGISTERED_ELECTRONIC_LRE","REGISTERED_ELECTRONIC_ERE","EXPRESS_PICKUP_PARCEL"]},"urgency":{"type":"string","enum":["ECONOMY","STANDARD","URGENT","EXPRESS_J1"]},"recipient_type":{"type":"string","enum":["INDIVIDUAL","COMPANY","PUBLIC_ADMIN"]},"recipient_eidas_consent":{"type":"boolean"},"pickup_requested":{"type":"boolean"},"zero_data_retention":{"type":"boolean"},"pdf_base64":{"type":"string"},"text_content":{"type":"string"},"payment_attachment":{"type":"object"}}}}}},"responses":{"201":{"description":"Dispatch routed, reserved in double-entry ledger, and submitted"},"400":{"description":"Validation or missing 4-level imputation error"}}},"get":{"summary":"List dispatches in current Tenant RLS scope","responses":{"200":{"description":"Array of dispatches"}}}},"/v1/dispatches/{id}":{"get":{"summary":"Retrieve dispatch status, tracking, proofs & rebilling breakdown","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Dispatch details"},"404":{"description":"Not found"}}}},"/v1/dossiers/{dossierId}/audit-trail":{"get":{"summary":"Export immutable SHA-256 hash-chained probative audit trail for a Dossier","parameters":[{"name":"dossierId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Probative audit trail + chain verification proof"}}}},"/v1/dossiers/{dossierId}/rebilling":{"get":{"summary":"Get exact-centime rebilling items & ERP sync status for a Dossier","parameters":[{"name":"dossierId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Rebilling items and totals"}}}},"/v1/tenants/credentials/{provider}":{"put":{"summary":"Configure BYOK (AES-256-GCM encrypted) or MANAGED mode for a provider","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Provider credentials saved encrypted"}}}},"/v1/tenants/api-keys":{"post":{"summary":"Mint a new scoped live or sandbox API key","responses":{"201":{"description":"API key created (shown once)"}}}},"/v1/wallets/topup":{"post":{"summary":"Create a Stripe top-up / configure prepaid Wallet auto-recharge threshold","responses":{"200":{"description":"Wallet updated"}}}},"/v1/webhooks/{provider}":{"post":{"summary":"Inbound normalized carrier/mail webhook receiver (HMAC verified)","security":[],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook reconciled"}}}},"/v1/admin/payments/{id}/approve-human":{"post":{"summary":"KZ-076.4 Mandatory Human-in-the-Loop approval gate before live wire disbursement","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Payment approved for execution by founder"}}}}}}