API
إنشاء قالب
مسوّدة ما لم تطلب نشرها. ويمكن معاينة المسوّدة ولا يمكن الإرسال بها.
POSTapi.openemail.uk/templates
ينفّذ الاستدعاء الحقيقي على مساحة عملك، بمفتاحك أنت.
POST /templates
مسوّدة ما لم تطلب نشرها. ويمكن معاينة المسوّدة ولا يمكن الإرسال بها.
مثال
يتطلب templates:write. ويعيد 201. ويُشتق slug من الاسم حين تغفله، وهو المقبض الذي تثبّته في شيفرتك، لأن الاسم هو ما يغيّره أحدهم.
curl -X POST "$OE/templates" -H "$AUTH" -H "Content-Type: application/json" \ -d '{ "name": "Order shipped", "engine": "html", "subject": "Order {{orderId}} is on its way", "html": "<p>Hello {{customer}}, {{orderId}} left the warehouse.</p>", "props": [ { "key": "orderId", "kind": "text", "required": true }, { "key": "customer", "kind": "text", "default": "there" } ], "publish": true }'{ "object": "template", "id": "tpl_9c1f0a4b7e05d3862c1f0a44", "name": "Order shipped", "slug": "order-shipped", "description": null, "status": "active", "publishedVersion": 1, "latestVersion": 1, "subject": "Order {{orderId}} is on its way", "engine": "html", "slots": [], "props": [ { "key": "orderId", "kind": "text", "required": true, "default": null }, { "key": "customer", "kind": "text", "required": false, "default": "there" } ], "createdAt": "2026-08-30T10:41:02.000Z", "updatedAt": "2026-08-30T10:41:02.000Z"}اضبط publish: true من سكربت النشر. فبدونه تحصل على الإصدار 1 كمسوّدة، وهو الصواب حين يقرأ شخص النص أولاً والخطأ في أي عملية مؤتمتة.
الاسم المكرَّر هو template_name_taken والـ slug المكرَّر هو template_slug_taken، وكلاهما 409 على مستوى الاتصال لا الحساب.
يحمل الاتصال 200 قالب. والقالب رقم 201 هو template_limit_reached، وهو حارس ضد سكربت شارد لا حدّ من حدود الخطة.