{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beel-es/json-schema/beel-es-send-email-request-schema.json",
  "title": "SendEmailRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beel-es-companyinvoicedelivery-api-openapi.yml#/components/schemas/SendEmailRequest",
  "type": "object",
  "properties": {
    "recipients": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Email"
      },
      "description": "Recipients of the email. When omitted, the invoice's `email_config` recipients apply,\nthen the customer's `billing_emails`, then the customer's `email`.\n"
    },
    "cc": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Email"
      },
      "description": "CC recipients. Copied addresses count as recipients of the message: they are subject\nto the same sending restrictions and to the same quota as the addresses in `recipients`.\nWhen omitted, the invoice's `email_config.cc` applies, then the CC addresses in the `defaults` of the\ncompany's email configuration; send an empty array to deliver the message without any copy.\n"
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Email subject. When omitted, the invoice's `email_config.subject` applies, then the `defaults.subject` of the company's email configuration, then the standard subject."
    },
    "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Custom message, added before the standard message. When omitted, the invoice's `email_config.message` applies, then the `defaults.message` of the company's email configuration, then the standard message."
    },
    "attach_pdf": {
      "type": "boolean",
      "default": true
    },
    "attach_source_invoices": {
      "type": "boolean",
      "default": false,
      "description": "Attach a ZIP archive (`suplidos_<invoice-number>.zip`) containing the PDFs of the source invoices referenced by the invoice's SUPLIDO consolidation lines (`source_invoice_ids`). Each PDF inside the ZIP is named `<invoice-number>_<issuer-tax-id>.pdf`. Requires `attach_pdf: true` (the ZIP accompanies the invoice PDF). Access to sources owned by managed accounts is re-checked at send time with the same rules as issuing; the request fails with an actionable error — never a partial ZIP — if the invoice has no consolidation sources (`ATTACH_SOURCE_INVOICES_NO_SOURCES`), a source is not reachable (`ATTACH_SOURCE_INVOICE_UNAVAILABLE`), a source has no generated PDF (`ATTACH_SOURCE_PDF_MISSING`), or the ZIP exceeds the size limit (`ATTACH_SOURCE_ZIP_TOO_LARGE`)."
    },
    "language": {
      "allOf": [
        {
          "$ref": "#/$defs/Language"
        }
      ],
      "description": "Language of the email. When omitted, the issuing company's `email_language` applies, and Spanish (`es`) when the company has none set."
    }
  },
  "$defs": {
    "Email": {
      "type": "string",
      "format": "email",
      "minLength": 5,
      "maxLength": 255,
      "description": "Email address (minimum valid email is 5 chars, e.g. a@b.co)"
    },
    "Language": {
      "type": "string",
      "description": "Supported languages: `es` Spanish, `en` English, `ca` Catalan.\n",
      "enum": [
        "es",
        "en",
        "ca"
      ]
    }
  }
}