Get email defaults

Retrieves pre-filled email content for an invoice based on your company's email template settings. Use this endpoint to populate the email form before sending.

GET /api/v1/invoices/{uuid}/email-defaults

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
X-CompanystringYesCompany UUID to scope the request

Path parameters

NameTypeRequiredDescription
uuidstringYesInvoice UUID

Query parameters

NameTypeDefaultDescription
languagestringroEmail language: ro or en

Request

curl https://api.storno.ro/api/v1/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7/email-defaults \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: 550e8400-e29b-41d4-a716-446655440000"

Response

Returns pre-filled email data with template variables replaced.

{
  "to": "[email protected]",
  "cc": "[email protected]",
  "bcc": null,
  "subject": "Factura FAC-2024-001 de la Your Company SRL",
  "body": "Buna ziua,\n\nGasiti atasat factura FAC-2024-001 in valoare de 1,190.00 RON.\n\nDetalii factura:\n- Numar: FAC-2024-001\n- Data emiterii: 15.02.2024\n- Scadenta: 15.03.2024\n- Total: 1,190.00 RON\n\nPuteti efectua plata aici: https://pay.storno.ro/inv_abc123\n\nMultumim!\n\nYour Company SRL\n[email protected]\n+40 123 456 789",
  "attachPdf": true,
  "attachXml": false,
  "from": {
    "email": "[email protected]",
    "name": "Your Company SRL"
  },
  "replyTo": "[email protected]"
}

Response fields

FieldTypeDescription
tostringClient billing email (from client record)
ccstring|nullCC address (from company settings)
bccstring|nullBCC address (from company settings)
subjectstringPre-filled subject with variables replaced
bodystringPre-filled body with variables replaced
attachPdfbooleanDefault PDF attachment setting
attachXmlbooleanDefault XML attachment setting
fromobjectSender email and name
replyTostringReply-to email address

Template variables

The following variables are automatically replaced in subject and body:

VariableExample valueDescription
{invoice_number}FAC-2024-001Invoice number
{invoice_total}1,190.00 RONFormatted total with currency
{invoice_subtotal}1,000.00 RONSubtotal before VAT
{invoice_vat}190.00 RONTotal VAT amount
{client_name}Acme Corporation SRLClient company name
{client_contact}John SmithClient contact person
{company_name}Your Company SRLYour company name
{company_cif}RO12345678Your company CIF
{company_email}[email protected]Company email
{company_phone}+40 123 456 789Company phone
{due_date}15.03.2024Payment due date
{issue_date}15.02.2024Invoice issue date
{payment_link}https://pay.storno.ro/inv_abc123Payment link (if enabled)
{days_until_due}28Days until payment is due
{series_name}Facturi 2024Invoice series name

Customizing email templates

Email templates can be customized in company settings:

Subject template

Factura {invoice_number} de la {company_name} - Scadenta: {due_date}

Body template

Stimate {client_name},

Va transmitem factura {invoice_number} in valoare totala de {invoice_total}.

Detalii:
- Data emiterii: {issue_date}
- Termen de plata: {due_date} ({days_until_due} zile)
- Subtotal: {invoice_subtotal}
- TVA: {invoice_vat}
- TOTAL: {invoice_total}

Puteti efectua plata online: {payment_link}

Cu stima,
{company_name}

Conditional sections

Templates support basic conditional logic:

{if payment_link}
Plata online: {payment_link}
{endif}

{if overdue}
ATENTIE: Aceasta factura este restanta!
{endif}

Client email resolution

The to field is automatically populated from:

  1. Client billing email (if set)
  2. Client primary email
  3. Client contact person email
  4. Empty (user must fill manually)

Error codes

CodeDescription
401Missing or invalid authentication token
403No access to the specified company
404Invoice not found
422Invalid language parameter

Use cases

  • Pre-fill email form - Load defaults when user clicks "Send Email"
  • Bulk email preview - Show what will be sent before batch sending
  • Template testing - Preview how templates look with real data
  • API integration - Get consistent email content in external systems