Create Store Email Template
POST/api/store-email-templates
Creates a new store email template (always non-system).
settings:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Fields:
- store_id (required): store ID (must exist)
- context (required): bound entity — one of sales_order, purchase_order, sales_credit, vendor_credit, bulk_purchase_order, warehouse_transfer. Determines available variables and attachable documents.
- event (required): trigger within the context (e.g. confirmation, updated, fulfilled, submitted, issued, manual). The legacy
typecolumn is derived from context+event server-side. - name (optional): human label for the template
- subject (required): subject line, max 255
- html_body (required): HTML body (supports {{ }} merge variables)
- enabled (optional): boolean. For automatic events only one template per (store, context, event) stays enabled.
- sent_type (optional): automatically | manually
- cc (optional): array of email addresses
- attachments (optional): array of document keys valid for the context (e.g. po_pdf, po_csv, po_xlsx, invoice_pdf, credit_note_pdf, vendor_credit_pdf)
Requires permission: email_templates.create
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.