{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asap-cool/json-schema/asap-cool-create-expense-request-schema.json",
  "title": "CreateExpenseRequest",
  "description": "Body of `POST /v1/expenses`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asap-cool-expenses-api-openapi.yml#/components/schemas/CreateExpenseRequest",
  "type": "object",
  "properties": {
    "category": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/CategoryView",
          "description": "Advisory category; defaults to `other`."
        }
      ]
    },
    "currency": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO currency code; defaults to `eur`."
    },
    "file_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "A file of the library to attach as the receipt."
    },
    "incurred_on": {
      "type": [
        "string",
        "null"
      ],
      "description": "Day the expense was incurred, `YYYY-MM-DD`."
    },
    "reference": {
      "type": [
        "string",
        "null"
      ],
      "description": "The supplier's invoice or ticket number."
    },
    "supplier_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Who was paid."
    },
    "total_ttc": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Total paid, in cents."
    },
    "vat_lines": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/VatLineInput"
      },
      "description": "VAT per rate (10 lines at most)."
    }
  },
  "$defs": {
    "CategoryView": {
      "type": "string",
      "description": "Advisory expense category.",
      "enum": [
        "software",
        "hardware",
        "telecom",
        "travel",
        "meals",
        "fees",
        "insurance",
        "marketing",
        "rent",
        "training",
        "other"
      ]
    },
    "VatLineInput": {
      "type": "object",
      "description": "One VAT rate of an expense, as sent by the client.",
      "required": [
        "rate",
        "base_cents",
        "vat_cents"
      ],
      "properties": {
        "base_cents": {
          "type": "integer",
          "format": "int64",
          "description": "Amount before VAT, in cents."
        },
        "deductible_cents": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Recoverable part of the VAT, in cents; defaults to the whole VAT."
        },
        "rate": {
          "type": "string",
          "description": "Rate in percent as a decimal token (`\"20\"`, `\"5.5\"`)."
        },
        "vat_cents": {
          "type": "integer",
          "format": "int64",
          "description": "VAT amount, in cents."
        }
      }
    }
  }
}