Email Delivery
POST/v1/invoicePOST/v1/receiptPOST/v1/quotePOST/v1/credit-notePOST/v1/packing-slipPOST/v1/timesheet
Send generated PDFs directly to your clients via email. Add deliver_to to any API request.
How it works
- 1. Add a
deliver_toobject to any request body. - 2. The PDF is generated and emailed as an attachment to the specified recipients.
- 3. The API still returns the PDF binary — same as without
deliver_to. - 4. A
X-Kagyz-Delivered-Toresponse header confirms delivery.
The deliver_to field
| Field | Type | Required | Description |
|---|---|---|---|
deliver_to.email | string | string[] | Yes | Recipient email(s). Max 5. |
deliver_to.cc | string[] | No | CC recipients. Max 3. |
deliver_to.subject | string | No | Email subject. Auto-generated if omitted (max 200 chars). |
deliver_to.message | string | No | Plain text body. Auto-generated if omitted (max 2000 chars). |
Auto-generated defaults
When subject is omitted, Kagyz generates one based on the document type:
| Document Type | Default Subject |
|---|---|
| Invoice | Invoice {number} from {from.name} |
| Receipt | Receipt {number} from {from.name} |
| Quote | Quote {number} from {from.name} |
| Credit Note | Credit Note {number} from {from.name} |
| Packing Slip | Packing Slip {number} from {from.name} |
| Timesheet | Timesheet {number} from {from.name} |
Default message
When message is omitted:
Hi,
Please find the attached {document_type}.
Best regards,
{from.name}
Please find the attached {document_type}.
Best regards,
{from.name}
Important notes
from.emailis required when usingdeliver_to— replies go to this address.- Emails are sent from
"{from.name} via Kagyz" <noreply@kagyz.com> - Reply-To is set to
from.email.
Rate limits
| Plan | Limit |
|---|---|
| Free | 5 emails/day |
| Starter | 50 emails/day |
| Growth | 100 emails/day |
Example
bash
curl -X POST https://api.kagyz.com/v1/invoice \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"invoice_number": "INV-001","issue_date": "Mar 19, 2026","currency": "USD","from": { "name": "Acme Corp", "email": "billing@acme.com" },"to": { "name": "Client Inc." },"items": [{ "description": "Consulting", "quantity": 10, "unit_price": 150 }],"deliver_to": {"email": "client@example.com","subject": "Invoice INV-001 from Acme Corp","message": "Hi,\n\nPlease find your invoice attached.\n\nThank you,\nAcme Corp"}}' \--output invoice.pdf
Response
Success (200)
- Content-Type:
application/pdf - Body: PDF binary data
- Header:
X-Kagyz-Delivered-To: client@example.com
Errors
| Status | Body |
|---|---|
400 | { "error": "deliver_to.email is required" } |
401 | { "error": "Invalid API key" } |
429 | { "error": "Email rate limit reached. Please upgrade." } |