{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/karbonhq/json-schema/karbonhq-expense-response-schema.json",
  "title": "ExpenseResponse",
  "description": "A single Expense",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/karbonhq-billing-api-openapi.yml#/components/schemas/ExpenseResponse",
  "type": "object",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "ExpenseKey": {
          "type": "string",
          "description": "The unique identifier of the Expense"
        }
      }
    },
    {
      "$ref": "#/$defs/ExpenseRequest"
    }
  ],
  "$defs": {
    "ExpenseRequest": {
      "description": "A single Expense",
      "required": [
        "Timeline",
        "ExpenseDate",
        "Value",
        "BillableValue",
        "Description"
      ],
      "type": "object",
      "properties": {
        "Timeline": {
          "type": "object",
          "description": "The entity the Expense is recorded against",
          "properties": {
            "EntityType": {
              "type": "string",
              "description": "The type of entity this Expense will be linked to",
              "enum": [
                "WorkItem",
                "Contact",
                "Organization"
              ]
            },
            "EntityKey": {
              "type": "string",
              "description": "A Karbon-generated value to indicate the entity"
            }
          }
        },
        "ExpenseDate": {
          "type": "string",
          "format": "date-time",
          "description": "The date the Expense was incurred"
        },
        "Value": {
          "type": "number",
          "format": "double",
          "description": "The cost of the Expense. Cannot be negative."
        },
        "BillableValue": {
          "type": "number",
          "format": "double",
          "description": "The portion of the Expense that is billable to the client. Cannot be negative. Use 0 for an Expense that will not be billed on."
        },
        "Description": {
          "type": "string",
          "description": "A description of the Expense. Limited to 250 characters."
        }
      }
    }
  }
}