{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orla-finance/json-schema/orla-finance-invoice-out-schema.json",
  "title": "InvoiceOut",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orla-finance-openapi.json#/components/schemas/InvoiceOut",
  "properties": {
    "account_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Account Id"
    },
    "amount_base": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Amount Base"
    },
    "auto_remind": {
      "default": true,
      "title": "Auto Remind",
      "type": "boolean"
    },
    "base_currency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Base Currency"
    },
    "base_rate": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Base Rate"
    },
    "card_payments_enabled": {
      "default": true,
      "title": "Card Payments Enabled",
      "type": "boolean"
    },
    "card_payments_live": {
      "default": false,
      "title": "Card Payments Live",
      "type": "boolean"
    },
    "client_address": {
      "default": "",
      "title": "Client Address",
      "type": "string"
    },
    "client_country": {
      "default": "",
      "title": "Client Country",
      "type": "string"
    },
    "client_country_code": {
      "default": "",
      "title": "Client Country Code",
      "type": "string"
    },
    "client_email": {
      "title": "Client Email",
      "type": "string"
    },
    "client_name": {
      "title": "Client Name",
      "type": "string"
    },
    "client_phone": {
      "default": "",
      "title": "Client Phone",
      "type": "string"
    },
    "client_reg_number": {
      "default": "",
      "title": "Client Reg Number",
      "type": "string"
    },
    "client_tax_id": {
      "default": "",
      "title": "Client Tax Id",
      "type": "string"
    },
    "closed_by": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvoiceClosedBy"
        },
        {
          "type": "null"
        }
      ],
      "readOnly": true
    },
    "contact_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contact Id"
    },
    "contested_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contested At"
    },
    "contested_reason": {
      "default": "",
      "title": "Contested Reason",
      "type": "string"
    },
    "corrects_invoice_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Corrects Invoice Id"
    },
    "credited_amount": {
      "default": "0",
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Credited Amount",
      "type": "string"
    },
    "currency": {
      "title": "Currency",
      "type": "string"
    },
    "delivered_in_app": {
      "default": false,
      "deprecated": true,
      "description": "Always false.",
      "title": "Delivered In App",
      "type": "boolean"
    },
    "delivery": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvoiceDelivery"
        },
        {
          "type": "null"
        }
      ]
    },
    "due_on": {
      "format": "date",
      "title": "Due On",
      "type": "string"
    },
    "early_discount_amount": {
      "anyOf": [
        {
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Early Discount Amount"
    },
    "early_discount_note_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Early Discount Note Id"
    },
    "early_discount_pct": {
      "anyOf": [
        {
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Early Discount Pct"
    },
    "early_discount_until": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Early Discount Until"
    },
    "extra_account_ids": {
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "title": "Extra Account Ids",
      "type": "array"
    },
    "id": {
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "issued_on": {
      "format": "date",
      "title": "Issued On",
      "type": "string"
    },
    "issued_on_chosen": {
      "default": false,
      "title": "Issued On Chosen",
      "type": "boolean"
    },
    "kind": {
      "$ref": "#/$defs/InvoiceDocKind",
      "default": "invoice"
    },
    "last_paid_on": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Paid On"
    },
    "letter_held": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Letter Held"
    },
    "line_items": {
      "items": {},
      "title": "Line Items",
      "type": "array"
    },
    "line_step": {
      "default": "",
      "title": "Line Step",
      "type": "string"
    },
    "notes": {
      "title": "Notes",
      "type": "string"
    },
    "number": {
      "title": "Number",
      "type": "string"
    },
    "number_pending": {
      "default": false,
      "title": "Number Pending",
      "type": "boolean"
    },
    "origin": {
      "default": "orla",
      "title": "Origin",
      "type": "string"
    },
    "overdue": {
      "default": false,
      "title": "Overdue",
      "type": "boolean"
    },
    "paid_amount": {
      "default": "0",
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Paid Amount",
      "type": "string"
    },
    "pay_asset": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pay Asset"
    },
    "pay_details_sent": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pay Details Sent"
    },
    "payer_marked_paid_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Payer Marked Paid At"
    },
    "payment_withdrawn_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Payment Withdrawn At"
    },
    "prices_include_tax": {
      "default": false,
      "title": "Prices Include Tax",
      "type": "boolean"
    },
    "project_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Id"
    },
    "promised_on": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Promised On"
    },
    "purchase_order": {
      "default": "",
      "title": "Purchase Order",
      "type": "string"
    },
    "recorded_payment_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Recorded Payment Id"
    },
    "recorded_tx_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Recorded Tx Id"
    },
    "reminders_paused_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reminders Paused At"
    },
    "reverse_charge_unevidenced": {
      "readOnly": true,
      "title": "Reverse Charge Unevidenced",
      "type": "boolean"
    },
    "seller_address": {
      "default": "",
      "title": "Seller Address",
      "type": "string"
    },
    "seller_country": {
      "default": "",
      "title": "Seller Country",
      "type": "string"
    },
    "seller_email": {
      "default": "",
      "title": "Seller Email",
      "type": "string"
    },
    "seller_name": {
      "default": "",
      "title": "Seller Name",
      "type": "string"
    },
    "seller_phone": {
      "default": "",
      "title": "Seller Phone",
      "type": "string"
    },
    "seller_reg_number": {
      "default": "",
      "title": "Seller Reg Number",
      "type": "string"
    },
    "seller_tax_id": {
      "default": "",
      "title": "Seller Tax Id",
      "type": "string"
    },
    "seller_website": {
      "default": "",
      "title": "Seller Website",
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/InvoiceStatus"
    },
    "subtotal": {
      "default": "0",
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Subtotal",
      "type": "string"
    },
    "tax_authority_number": {
      "default": "",
      "title": "Tax Authority Number",
      "type": "string"
    },
    "tax_breakdown": {
      "items": {},
      "title": "Tax Breakdown",
      "type": "array"
    },
    "tax_label": {
      "default": "",
      "title": "Tax Label",
      "type": "string"
    },
    "tax_total": {
      "default": "0",
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Tax Total",
      "type": "string"
    },
    "token": {
      "title": "Token",
      "type": "string"
    },
    "total": {
      "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      "title": "Total",
      "type": "string"
    },
    "written_off_amount": {
      "default": "0.00",
      "title": "Written Off Amount",
      "type": "string"
    }
  },
  "required": [
    "id",
    "number",
    "client_name",
    "client_email",
    "line_items",
    "total",
    "currency",
    "issued_on",
    "due_on",
    "notes",
    "token",
    "status",
    "closed_by",
    "reverse_charge_unevidenced"
  ],
  "type": "object",
  "$defs": {
    "InvoiceClosedBy": {
      "enum": [
        "payment",
        "credit",
        "write_off"
      ],
      "title": "InvoiceClosedBy",
      "type": "string"
    },
    "InvoiceDelivery": {
      "description": "Where an invoice's first send went (`invoice_delivery.record`).",
      "properties": {
        "chats": {
          "items": {
            "type": "string"
          },
          "title": "Chats",
          "type": "array"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Email"
        },
        "email_skipped": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Email Skipped"
        }
      },
      "title": "InvoiceDelivery",
      "type": "object"
    },
    "InvoiceDocKind": {
      "description": "A document that asks for money, or one that gives it back.",
      "enum": [
        "invoice",
        "credit_note",
        "quote"
      ],
      "title": "InvoiceDocKind",
      "type": "string"
    },
    "InvoiceStatus": {
      "enum": [
        "draft",
        "sent",
        "partial",
        "paid",
        "credited",
        "issued",
        "void",
        "quote_draft",
        "quote_sent",
        "quote_accepted",
        "quote_declined",
        "quote_expired",
        "quote_withdrawn"
      ],
      "title": "InvoiceStatus",
      "type": "string"
    }
  }
}