{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frihet-io/json-schema/frihet-io-credit-note-result-schema.json",
  "title": "CreditNoteResult",
  "description": "Result of `POST /v1/invoices/{invoiceId}/credit-note`. `status` is always\n`draft` — the endpoint creates, it does not issue.\n",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frihet-io-openapi.json#/components/schemas/CreditNoteResult",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        },
        "creditNote": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "ID of the newly created credit note draft"
            },
            "documentNumber": {
              "type": "string",
              "description": "Provisional reference, not a fiscal number. Numbering happens on issue."
            },
            "originalInvoiceId": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "fullCredit": {
              "type": "boolean"
            },
            "status": {
              "type": "string",
              "enum": [
                "draft"
              ],
              "description": "Always `draft`."
            },
            "rectificationMethod": {
              "type": "string",
              "enum": [
                "I"
              ],
              "description": "Always `I` (por diferencias). `S` is not offered over the API."
            },
            "totalCredited": {
              "type": "number",
              "description": "Tax-inclusive amount credited, as a positive number."
            },
            "replayed": {
              "type": "boolean",
              "deprecated": true,
              "description": "DEPRECATED and no longer emitted. A replay is now signalled by the\n`X-Idempotent-Replayed: true` response header, and the replayed\nbody is byte-identical to the original — which a body-level flag\nwould contradict. Documented only so existing clients know the\nfield is absent rather than false.\n"
            }
          }
        }
      }
    }
  }
}