{
 "openapi": "3.1.0",
 "info": {
  "title": "AR Credit / Debit Memos (Accounting)",
  "version": "20261030b",
  "description": "A posted invoice is never edited. A credit memo reduces what is owed, a debit memo increases it, and both net against the invoice they correct."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "ar-memos": {
    "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
     },
     "customer_name": {
      "type": "string",
      "description": "Customer name",
      "readOnly": true
     },
     "related_invoice_no": {
      "type": "string",
      "description": "Related invoice no",
      "readOnly": true
     },
     "cost_center_code": {
      "type": "string",
      "description": "Cost center code",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/ar-memos": {
   "get": {
    "summary": "list ar-memos",
    "operationId": "list_ar_memos_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post ar credit / debit memos",
    "operationId": "action_ar_memos_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ar-memos/{id}": {
   "get": {
    "summary": "get ar-memos",
    "operationId": "get_ar_memos_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put ar credit / debit memos",
    "operationId": "action_ar_memos_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete ar credit / debit memos",
    "operationId": "action_ar_memos_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ar-memos/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_ar_memos_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/ar-memos/create": {
   "post": {
    "summary": "Create",
    "operationId": "action_ar_memos_0_5",
    "description": "Body keys: documentType, relatedInvoiceId, partyId, invoiceDate, reason, currency, exchangeRate, lines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/ar-memos/{id}/post": {
   "post": {
    "summary": "Post",
    "operationId": "action_ar_memos_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}