{
 "openapi": "3.1.0",
 "info": {
  "title": "AP Invoices (Accounting)",
  "version": "20261030b",
  "description": "Read and maintain ap invoices records (acct.ap_invoices)."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "ap-invoices": {
    "type": "object",
    "required": [
     "supplier_invoice_no",
     "supplier_id",
     "invoice_date",
     "due_date"
    ],
    "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
     },
     "supplier_invoice_no": {
      "type": "string",
      "description": "Supplier invoice no"
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier id"
     },
     "po_id": {
      "type": "string",
      "format": "uuid",
      "description": "Po id"
     },
     "invoice_date": {
      "type": "string",
      "format": "date",
      "description": "Invoice date"
     },
     "due_date": {
      "type": "string",
      "format": "date",
      "description": "Due date"
     },
     "currency": {
      "type": "string",
      "description": "Currency",
      "readOnly": true
     },
     "subtotal": {
      "type": "string",
      "format": "decimal",
      "description": "Subtotal"
     },
     "tax": {
      "type": "string",
      "format": "decimal",
      "description": "Tax"
     },
     "total": {
      "type": "string",
      "format": "decimal",
      "description": "Total"
     },
     "status": {
      "type": "string",
      "description": "Status"
     },
     "match_result": {
      "type": "object",
      "description": "Match result",
      "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"
     },
     "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
     },
     "supplier_gstin": {
      "type": "string",
      "description": "Supplier gstin",
      "readOnly": true
     },
     "buyer_gstin": {
      "type": "string",
      "description": "Buyer gstin",
      "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
     },
     "itc_eligibility": {
      "type": "string",
      "description": "Itc eligibility",
      "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
     },
     "edi_interchange_id": {
      "type": "string",
      "format": "uuid",
      "description": "Edi interchange id",
      "readOnly": true
     },
     "submitted_via": {
      "type": "string",
      "description": "Submitted via",
      "readOnly": true
     },
     "portal_user_id": {
      "type": "string",
      "format": "uuid",
      "description": "Portal user id",
      "readOnly": true
     },
     "receipt_id": {
      "type": "string",
      "format": "uuid",
      "description": "Receipt id",
      "readOnly": true
     },
     "project_id": {
      "type": "string",
      "format": "uuid",
      "description": "Project id",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/ap-invoices": {
   "get": {
    "summary": "list ap-invoices",
    "operationId": "list_ap_invoices_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create ap-invoices",
    "operationId": "create_ap_invoices_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{id}": {
   "get": {
    "summary": "get ap-invoices",
    "operationId": "get_ap_invoices_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change ap-invoices",
    "operationId": "change_ap_invoices_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete ap-invoices",
    "operationId": "delete_ap_invoices_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "patch": {
    "summary": "Patch ap invoices",
    "operationId": "action_ap_invoices_3_5",
    "description": "Body keys: total",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/rematch": {
   "post": {
    "summary": "Rematch",
    "operationId": "action_ap_invoices_0_5",
    "description": "Body keys: poId",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_ap_invoices_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"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{parentId}/lines": {
   "get": {
    "summary": "Lines",
    "operationId": "action_ap_invoices_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Lines",
    "operationId": "action_ap_invoices_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{parentId}/lines/{lineId}": {
   "put": {
    "summary": "Lines",
    "operationId": "action_ap_invoices_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Lines",
    "operationId": "action_ap_invoices_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/create": {
   "post": {
    "summary": "Create",
    "operationId": "action_ap_invoices_0_5",
    "description": "Body keys: costCenterId, costCenterCode, profitCenterId, profitCenterCode, documentNo, exchangeRate, supplierInvoiceNo*, supplierId, supplierNo, supplierName, poId, invoiceDate, dueDate, currency, subtotal, tax; lines: [{ quantity, unitPrice, taxAmount, itemId, uom, currency, exchangeRate, glAccountId, accountId, accountNo, accountCode, costCenterId, costCenterCode, profitCenterId, profitCenterCode, description, poLineId }]",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{id}/match-and-post": {
   "post": {
    "summary": "Match and post",
    "operationId": "action_ap_invoices_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ap-invoices/{id}/pay": {
   "post": {
    "summary": "Pay",
    "operationId": "action_ap_invoices_0_6",
    "description": "Body keys: amount, paymentDate, exchangeRate, method",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}