{
 "openapi": "3.1.0",
 "info": {
  "title": "ZATCA Submissions (Accounting)",
  "version": "20261030b",
  "description": "Every invoice and note stamped under ZATCA Phase 2 and what ZATCA said. A tax invoice (B2B) is cleared when it is posted and may be given to the buyer only once cleared; a simplified invoice (B2C) is reported within 24 hours. One that could not be sent is tried again automatically with the same document. A REJECTED document may not be given to anybody and is never sent again as it is: re-issue it, correct the cause and post the new one."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "zatca-submissions": {
    "type": "object",
    "required": [],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "invoice_no": {
      "type": "string",
      "description": "Invoice no",
      "readOnly": true
     },
     "customer_account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer account id",
      "readOnly": true
     },
     "patient_id": {
      "type": "string",
      "format": "uuid",
      "description": "Patient id",
      "readOnly": true
     },
     "source_module": {
      "type": "string",
      "description": "Source module",
      "readOnly": true
     },
     "source_ref": {
      "type": "string",
      "description": "Source ref",
      "readOnly": true
     },
     "invoice_date": {
      "type": "string",
      "format": "date",
      "description": "Invoice date",
      "readOnly": true
     },
     "due_date": {
      "type": "string",
      "format": "date",
      "description": "Due date",
      "readOnly": true
     },
     "currency": {
      "type": "string",
      "description": "Currency",
      "readOnly": true
     },
     "subtotal": {
      "type": "string",
      "format": "decimal",
      "description": "Subtotal",
      "readOnly": true
     },
     "tax": {
      "type": "string",
      "format": "decimal",
      "description": "Tax",
      "readOnly": true
     },
     "total": {
      "type": "string",
      "format": "decimal",
      "description": "Total",
      "readOnly": true
     },
     "amount_paid": {
      "type": "string",
      "format": "decimal",
      "description": "Amount paid",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "journal_id": {
      "type": "string",
      "format": "uuid",
      "description": "Journal id",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "cost_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost center id",
      "readOnly": true
     },
     "profit_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Profit center id",
      "readOnly": true
     },
     "document_type": {
      "type": "string",
      "description": "Document type",
      "readOnly": true
     },
     "related_invoice_id": {
      "type": "string",
      "format": "uuid",
      "description": "Related invoice id",
      "readOnly": true
     },
     "memo_reason": {
      "type": "string",
      "description": "Memo reason",
      "readOnly": true
     },
     "cancelled_at": {
      "type": "string",
      "format": "date-time",
      "description": "Cancelled at",
      "readOnly": true
     },
     "cancelled_by": {
      "type": "string",
      "format": "uuid",
      "description": "Cancelled by",
      "readOnly": true
     },
     "cancel_reason": {
      "type": "string",
      "description": "Cancel reason",
      "readOnly": true
     },
     "reversed_by_id": {
      "type": "string",
      "format": "uuid",
      "description": "Reversed by id",
      "readOnly": true
     },
     "reverses_id": {
      "type": "string",
      "format": "uuid",
      "description": "Reverses id",
      "readOnly": true
     },
     "exchange_rate": {
      "type": "string",
      "format": "decimal",
      "description": "Exchange rate",
      "readOnly": true
     },
     "base_total": {
      "type": "string",
      "format": "decimal",
      "description": "Base total",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "invoice_subtype": {
      "type": "string",
      "description": "Invoice subtype",
      "readOnly": true
     },
     "issued_at": {
      "type": "string",
      "format": "date-time",
      "description": "Issued at",
      "readOnly": true
     },
     "supply_date": {
      "type": "string",
      "format": "date",
      "description": "Supply date",
      "readOnly": true
     },
     "supply_end_date": {
      "type": "string",
      "format": "date",
      "description": "Supply end date",
      "readOnly": true
     },
     "seller_snapshot": {
      "type": "object",
      "description": "Seller snapshot",
      "readOnly": true
     },
     "buyer_snapshot": {
      "type": "object",
      "description": "Buyer snapshot",
      "readOnly": true
     },
     "zatca_qr": {
      "type": "string",
      "description": "Zatca qr",
      "readOnly": true
     },
     "vat_total_sar": {
      "type": "string",
      "format": "decimal",
      "description": "Vat total sar",
      "readOnly": true
     },
     "zatca_regime": {
      "type": "string",
      "description": "Zatca regime",
      "readOnly": true
     },
     "issued_backfilled": {
      "type": "boolean",
      "description": "Issued backfilled",
      "readOnly": true
     },
     "zatca_uuid": {
      "type": "string",
      "format": "uuid",
      "description": "Zatca uuid",
      "readOnly": true
     },
     "invoice_hash": {
      "type": "string",
      "description": "Invoice hash",
      "readOnly": true
     },
     "previous_invoice_hash": {
      "type": "string",
      "description": "Previous invoice hash",
      "readOnly": true
     },
     "icv": {
      "type": "string",
      "format": "decimal",
      "description": "Icv",
      "readOnly": true
     },
     "subtype_changed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Subtype changed by",
      "readOnly": true
     },
     "subtype_changed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Subtype changed at",
      "readOnly": true
     },
     "backfill_repaired_at": {
      "type": "string",
      "format": "date-time",
      "description": "Backfill repaired at",
      "readOnly": true
     },
     "backfill_repair": {
      "type": "object",
      "description": "Backfill repair",
      "readOnly": true
     },
     "supplier_gstin": {
      "type": "string",
      "description": "Supplier gstin",
      "readOnly": true
     },
     "buyer_gstin": {
      "type": "string",
      "description": "Buyer gstin",
      "readOnly": true
     },
     "supply_state_code": {
      "type": "string",
      "description": "Supply state code",
      "readOnly": true
     },
     "place_of_supply": {
      "type": "string",
      "description": "Place of supply",
      "readOnly": true
     },
     "is_interstate": {
      "type": "boolean",
      "description": "Is interstate",
      "readOnly": true
     },
     "is_reverse_charge": {
      "type": "boolean",
      "description": "Is reverse charge",
      "readOnly": true
     },
     "is_export": {
      "type": "boolean",
      "description": "Is export",
      "readOnly": true
     },
     "export_type": {
      "type": "string",
      "description": "Export type",
      "readOnly": true
     },
     "shipping_bill_no": {
      "type": "string",
      "description": "Shipping bill no",
      "readOnly": true
     },
     "cgst_total": {
      "type": "string",
      "format": "decimal",
      "description": "Cgst total",
      "readOnly": true
     },
     "sgst_total": {
      "type": "string",
      "format": "decimal",
      "description": "Sgst total",
      "readOnly": true
     },
     "igst_total": {
      "type": "string",
      "format": "decimal",
      "description": "Igst total",
      "readOnly": true
     },
     "cess_total": {
      "type": "string",
      "format": "decimal",
      "description": "Cess total",
      "readOnly": true
     },
     "round_off": {
      "type": "string",
      "format": "decimal",
      "description": "Round off",
      "readOnly": true
     },
     "duplicate_reason": {
      "type": "string",
      "description": "Duplicate reason",
      "readOnly": true
     },
     "duplicate_of": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Duplicate of",
      "readOnly": true
     },
     "duplicate_confirmed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Duplicate confirmed by",
      "readOnly": true
     },
     "duplicate_confirmed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Duplicate confirmed at",
      "readOnly": true
     },
     "egs_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Egs unit id",
      "readOnly": true
     },
     "zatca_invoice_type_code": {
      "type": "string",
      "description": "Zatca invoice type code",
      "readOnly": true
     },
     "zatca_transaction_code": {
      "type": "string",
      "description": "Zatca transaction code",
      "readOnly": true
     },
     "zatca_status": {
      "type": "string",
      "description": "Zatca status",
      "readOnly": true
     },
     "signed_xml": {
      "type": "string",
      "description": "Signed xml",
      "readOnly": true
     },
     "zatca_signed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Zatca signed at",
      "readOnly": true
     },
     "cleared_xml": {
      "type": "string",
      "description": "Cleared xml",
      "readOnly": true
     },
     "zatca_response": {
      "type": "object",
      "description": "Zatca response",
      "readOnly": true
     },
     "submitted_at": {
      "type": "string",
      "format": "date-time",
      "description": "Submitted at",
      "readOnly": true
     },
     "cleared_at": {
      "type": "string",
      "format": "date-time",
      "description": "Cleared at",
      "readOnly": true
     },
     "zatca_attempts": {
      "type": "integer",
      "description": "Zatca attempts",
      "readOnly": true
     },
     "zatca_next_attempt_at": {
      "type": "string",
      "format": "date-time",
      "description": "Zatca next attempt at",
      "readOnly": true
     },
     "zatca_last_error": {
      "type": "string",
      "description": "Zatca last error",
      "readOnly": true
     },
     "payment_means_code": {
      "type": "string",
      "description": "Payment means code",
      "readOnly": true
     },
     "eway_bill_required": {
      "type": "boolean",
      "description": "Eway bill required",
      "readOnly": true
     },
     "gst_doc_series_id": {
      "type": "string",
      "format": "uuid",
      "description": "Gst doc series id",
      "readOnly": true
     },
     "gst_financial_year": {
      "type": "string",
      "description": "Gst financial year",
      "readOnly": true
     },
     "draft_invoice_no": {
      "type": "string",
      "description": "Draft invoice no",
      "readOnly": true
     },
     "irn": {
      "type": "string",
      "description": "Irn",
      "readOnly": true
     },
     "irn_ack_no": {
      "type": "string",
      "description": "Irn ack no",
      "readOnly": true
     },
     "irn_ack_date": {
      "type": "string",
      "format": "date-time",
      "description": "Irn ack date",
      "readOnly": true
     },
     "irn_signed_qr": {
      "type": "string",
      "description": "Irn signed qr",
      "readOnly": true
     },
     "irn_status": {
      "type": "string",
      "description": "Irn status",
      "readOnly": true
     },
     "zatca_replaced_by_id": {
      "type": "string",
      "format": "uuid",
      "description": "Zatca replaced by id",
      "readOnly": true
     },
     "receivable_account_no": {
      "type": "string",
      "description": "Receivable account no",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/zatca-submissions": {
   "get": {
    "summary": "list zatca-submissions",
    "operationId": "list_zatca_submissions_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post zatca submissions",
    "operationId": "action_zatca_submissions_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}": {
   "get": {
    "summary": "get zatca-submissions",
    "operationId": "get_zatca_submissions_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put zatca submissions",
    "operationId": "action_zatca_submissions_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete zatca submissions",
    "operationId": "action_zatca_submissions_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/run": {
   "post": {
    "summary": "Run",
    "operationId": "action_zatca_submissions_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/resubmit": {
   "post": {
    "summary": "Resubmit",
    "operationId": "action_zatca_submissions_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/reissue": {
   "post": {
    "summary": "Reissue",
    "operationId": "action_zatca_submissions_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/log": {
   "get": {
    "summary": "Log",
    "operationId": "action_zatca_submissions_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/pdf": {
   "get": {
    "summary": "Pdf",
    "operationId": "action_zatca_submissions_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/xml": {
   "get": {
    "summary": "Xml",
    "operationId": "action_zatca_submissions_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/zatca-submissions/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_zatca_submissions_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}