openemail templates
كل أمر في مساحة الأسماء هذه، مع وسائطه وخياراته وأمثلته.
الأوامر
Bodies stored once and sent many times, with versions, previews and typed props.
يقبل كل أمر هنا أيضًا الخيارات العامة، مثل --json و--profile و--dry-run. اطّلع على الخيارات العامة
templates listtemplates gettemplates createtemplates updatetemplates duplicatetemplates replace-contenttemplates deletetemplates list-versionstemplates get-versiontemplates publishtemplates restore-versiontemplates delete-versiontemplates list-starterstemplates get-startertemplates list-fontstemplates rendertemplates previewtemplates get-analyticstemplates list-sendstemplates sendtemplates list-imagestemplates upload-imagetemplates designtemplates redesign
openemail templates list
List templates, most recently updated first
lsالاستخدام
openemail templates list [flags]
Returns one page of the workspace's templates, ordered by updatedAt descending. Each row carries the published version's subject, engine, slots and props, so you can see what a send needs without fetching every template. A template with nothing published omits those four fields and reports publishedVersion as null.
Paging is keyset on updatedAt, and the cursor is opaque: it holds the sort and where the last template on the page sat in it, so a template deleted while you page never breaks the walk. Editing a template moves it to the front, so a template changed while you page can show up twice.
--status narrows to one template status. draft is the status of a template created without publish and never published or activated since. It does not mean "has unpublished edits": check latestVersion against publishedVersion for that.
Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.
الخيارات
--status <value>Restricts the page to
draft,activeorarchivedtemplates. Omit it for all of them.--search <value>Matches the name, the slug, the description, the published version's subject and the id, each word loosely, with close spellings when nothing matches exactly, as a substring.
%and_are taken literally.--sort <value>The order:
updated-newest(the default),updated-oldest,created-newest,created-oldest,nameorname-reversed. The cursor follows whichever you asked for.--limit <n>Rows per page, a whole number from 1 to 100. The server defaults to 25.
--cursor <value>The
nextCursorfrom the previous page. Never build one yourself.--allFetch every page and stream the items as they arrive.
--max <n>Stop after this many items. Implies
--all.--ndjsonPrint every item as one JSON object per line. Implies
--all
أمثلة
openemail templates listopenemail templates list --status active --limit 50openemail templates list --all --max 100openemail templates list --all > templates.ndjsonمتاح أيضًا في
openemail templates get
Read a template with its head version in full
showviewالاستخدام
openemail templates get <id-or-slug> [flags]
Fetches one template by tpl_ id or by slug. Every templates method accepts either, and the two cannot collide because ids carry the tpl_ prefix while a slug has no underscores. Pin the slug in code: it is derived once at creation and never changes when the template is renamed.
latest is the head version, meaning the current draft, or the published version when nothing has been edited since. This is the only read that returns the body: document for the blocks engine, and html for the html engine exactly as submitted, before sanitising. The top level subject, engine, slots and props describe the published version, which is what a send uses, so they differ from latest while somebody has unpublished edits.
When nothing has been published yet, publishedVersion is null and the top level subject, engine, slots and props are absent. Read the draft from latest instead. Use list or listVersions to find out whether a template can actually be sent.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
أمثلة
openemail templates get order-shippedopenemail templates get order-shipped --jsonمتاح أيضًا في
openemail templates create
Create a template and its first version
newaddالاستخدام
openemail templates create --name <value> [flags] openemail templates create --data <json|@file|-> [flags]
Creates the template together with version 1. Without publish: true that version is a draft, and a draft cannot be sent: send answers 422 template_not_published until somebody calls publish. With publish: true the body is compiled straight away and the template starts active, so a body that fails to render is refused here instead of later.
The engine follows what you send. Posting html selects the html engine, anything else is blocks. A blocks template stores a document whose body is a tree of @react-email/components nodes (Section, Row, Column, Container, Text, Heading, Button, Link, Img, Hr, Markdown, CodeBlock and CodeInline), validated on the way in with a ceiling of 500 nodes nested 8 deep. An html template stores markup you rendered yourself, for example with @react-email/render in your own build, and it is sanitised when the version is compiled.
{{key}} placeholders are filled from declared slots and props. A slot has a default and belongs to whoever edits the template. A prop is supplied by the sender and can be required. Keys start with a letter and continue with letters, digits or underscores, and one key cannot be both. In a blocks template an undeclared placeholder is a 422 invalid_template naming its path. In html markup, any placeholder used inside an attribute such as href or src must be declared with kind url or image, or compiling fails.
الخيارات
--name <value>Display name, 1 to 100 characters after trimming and unique per workspace. Required, here or in
--data.--slug <value>Stable handle of lowercase letters, digits and hyphens, at most 64 characters. Derived from
namewhen omitted.--description <value>Free text note, at most 500 characters.
--publishCompiles and publishes version 1 immediately. Defaults to false, which leaves a draft.
الافتراضيfalse--starter <value>A starter slug from
listStarters, which seeds the subject and the body. Anything you send yourself wins over the starter, and an unknown slug is a 404.--engine <value>blocksorhtml. Inferred from whetherhtmlis present.--subject <value>Subject line with optional
{{placeholders}}, at most 998 characters and free of line breaks.--document <json|@file|->The
blocksbody:body(the block tree) plus the page settings that travel with it,preview,tailwind,fontsandstyle. Defaults to an empty body. JSON shaped asTemplateDocument, inline or from a file with @path.--html <value>Pre-rendered markup for the
htmlengine. Required for it, at most 1,000,000 characters.--slots <json|@file|->Up to 100 editor filled values, each with
key, optionallabel,kind(defaulttext) anddefault(default empty string). JSON shaped asArray<Partial<TemplateSlot> & { key: string }>, inline or from a file with @path.--props <json|@file|->Up to 100 sender supplied values, each with
key, optionallabel,kind(defaulttext),required(default false) anddefault(default null). JSON shaped asArray<Partial<TemplateProp> & { key: string }>, inline or from a file with @path.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates create --name 'Order shipped'openemail templates create --name 'Order shipped' --slug order-shipped --publish --engine htmlopenemail templates create --data @template.jsonمتاح أيضًا في
openemail templates update
Edit template metadata or its draft body
editالاستخدام
openemail templates update <id-or-slug> [flags]
Changes a template in place. name, description and status are metadata and never create a version. Sending any of subject, document, html, slots, props or engine is a body edit: if the head version is still a draft it is overwritten, and if the head is published a new draft numbered one higher is minted. Body fields you leave out keep the head's values, so a patch carrying only subject keeps the existing document and declarations, while slots or props replace the whole list.
Nothing here changes what a live send resolves to. Sends keep using the published version until you call publish, which is what makes it safe to edit a template in production. The response's latest is the version this call wrote into.
Pass --expected-version with the latestVersion you read before editing. If another writer has moved the head since, the call fails with 409 version_conflict instead of overwriting their change. Without it the last write wins. Setting status: 'archived' is the reversible alternative to delete, but it does not block sends: an archived template with a published version still sends.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--name <value>Replacement name, 1 to 100 characters and unique per workspace. The slug does not follow it.
--slug <value>Replacement slug of lowercase letters, digits and hyphens, at most 64 characters. Anything pinning the old slug starts getting 404s, and taking another template's slug is a 409
template_slug_taken.--description <value>Replacement note of at most 500 characters, or null to clear it.
--status <value>Archives or reactivates the template. It cannot be set back to
draft.--expected-version <n>The head version number you edited from. A mismatch is a 409
version_conflictand nothing is written.--engine <value>Switches between
blocksandhtml. Switching tohtmlneedshtmlsupplied or already stored.--subject <value>Replacement subject, at most 998 characters and free of line breaks.
--document <json|@file|->The
blocksbody:body(the block tree) plus the page settings that travel with it,preview,tailwind,fontsandstyle. It replaces the whole document, so read the current one before rebuilding part of it. Revalidated in full. JSON shaped asTemplateDocument, inline or from a file with @path.--html <value>Replacement markup for the
htmlengine, at most 1,000,000 characters.--slots <json|@file|->Complete replacement slot list. JSON shaped as
Array<Partial<TemplateSlot> & { key: string }>, inline or from a file with @path.--props <json|@file|->Complete replacement prop list. JSON shaped as
Array<Partial<TemplateProp> & { key: string }>, inline or from a file with @path.--data <json|@file|->The whole
patchas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates update order-shipped --subject 'Your order {{orderId}} has shipped'openemail templates update order-shipped --subject 'Your order {{orderId}} has shipped' --jsonمتاح أيضًا في
openemail templates duplicate
Copy a template into a new one
الاستخدام
openemail templates duplicate <id-or-slug> [flags]
Creates a new template from the HEAD version of an existing one: the same subject, body, slots and props, and the source's description. The copy starts at version 1 as a DRAFT, whatever the source had published, so a copy is never sendable by accident. Publish it when you mean to.
The copy is a separate template with its own id and slug. Nothing links it back to the source, so editing either one afterwards leaves the other alone. This is the safe way to try a redesign of a template that is sending in production.
name is optional. Left out, the source name is reused, and because a name is unique per workspace the server appends a number until one is free, up to twenty attempts. Sending a name that is already taken behaves the same way, so a script that copies nightly keeps working.
الوسائط
<id-or-slug>مطلوبThe template to copy, by
tpl_id or slug.
الخيارات
--name <value>The name for the copy, 1 to 100 characters. Omit it to reuse the source name with a number appended.
--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates duplicate order-shippedopenemail templates duplicate order-shipped --name 'Order shipped, new design'متاح أيضًا في
openemail templates replace-content
Swap a template's design for a starter or another template's
الاستخدام
openemail templates replace-content <id-or-slug> [flags]
Replaces the whole body of a template with a starter design or with another template's body, keeping the template's own identity: its id, slug, name, description and status do not move, and neither does what a live send resolves to.
The write lands exactly where an update to the body lands. A draft head is overwritten in place; a published head mints version N+1 as a draft. Sends keep resolving the published version until you publish, so this is safe to call on a template that is sending.
Name exactly one source. starter takes a slug from listStarters; --from-template-id takes another template in the same workspace, whose published version is copied when it has one and whose draft is copied otherwise. Sending both, neither, or the target itself is a 422. A source in another workspace is a 404, like everything else here.
This discards the body it replaces. A version that was published is still in the version list and can be restored, but an unpublished draft body is gone.
الوسائط
<id-or-slug>مطلوبThe template whose design is being replaced, by
tpl_id or slug.
الخيارات
--starter <value>A starter slug from
listStarters. Mutually exclusive with--from-template-id.--from-template-id <value>Another template in this workspace to borrow the design from, by id or slug. Mutually exclusive with
starter.--expected-version <n>The head version you read before replacing. A mismatch is a 409
version_conflictand nothing is written.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates replace-content order-shippedopenemail templates replace-content order-shipped --starter order-shippedopenemail templates replace-content order-shipped --yesمتاح أيضًا في
openemail templates delete
Delete a template and every version
rmdelremoveالاستخدام
openemail templates delete <id-or-slug> [flags]
Permanently removes the template and all of its versions. There is no undo. Mail already accepted is unaffected, because each send stores the body it rendered, but any integration still sending against this id or slug starts receiving 404s.
If you might need the template again, archive it with update(idOrSlug, { status: 'archived' }) instead. The response is a tombstone rather than an empty body, so a log line can record exactly what was removed.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
أمثلة
openemail templates delete order-shippedopenemail templates delete order-shipped --yesمتاح أيضًا في
openemail templates list-versions
List one page of a template's versions, newest first
الاستخدام
openemail templates list-versions <id-or-slug> [flags]
Returns one page of a template's versions, newest first. At most one version is a draft and it is always the highest number. Every version below it has been published, and the highest published version is the one unpinned sends resolve to.
Bodies are left out, so document and html are absent on every row. What each version declares (subject, slots and props) is present, which makes this the call for checking what pinning a version on send would commit you to.
Pages are keyset on the version number, so a version deleted while you walk never breaks the walk: the next page starts at the first version below the cursor.
Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--limit <n>Versions per page, a whole number from 1 to 100. The server defaults to 25.
الافتراضي25--cursor <value>The
nextCursorof the previous page, passed back as it came. It is opaque, so never build one yourself.--allFetch every page and stream the items as they arrive.
--max <n>Stop after this many items. Implies
--all.--ndjsonPrint every item as one JSON object per line. Implies
--all
أمثلة
openemail templates list-versions order-shippedopenemail templates list-versions order-shipped --limit 10openemail templates list-versions order-shipped --all --max 100openemail templates list-versions order-shipped --all > templates.ndjsonمتاح أيضًا في
openemail templates get-version
Read one version of a template, body included
الاستخدام
openemail templates get-version <id-or-slug> <version> [flags]
One frozen revision with its body. document carries the block tree for the blocks engine and html carries the submitted markup for the html engine, alongside the subject, slots and props that were declared at the time.
This is what listVersions leaves out. It is the only way to read an old version without changing anything: restoreVersion also shows you the body, but it moves the head to get there, so reading version 3 used to cost you your draft.
Reach for it to diff a regression against the revision that worked, to lift a block out of a design you have since replaced, or to record what a campaign actually said.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.<version>مطلوبThe version number to read, as
listVersionsreports it. Not atplv_id.
أمثلة
openemail templates get-version order-shipped 1openemail templates get-version order-shipped 1 --jsonمتاح أيضًا في
openemail templates publish
Publish the draft so sends resolve to it
الاستخدام
openemail templates publish <id-or-slug> [flags]
Freezes the head version and makes it the one unpinned sends resolve to. Compiling happens here: a blocks tree is rendered through react-email and html markup is sanitised, so a body that does not render fails with 422 invalid_template for the person publishing rather than for a recipient. Nothing is published when that happens.
The call is idempotent. If the head is already the published version it comes back unchanged, so a deploy script can publish on every run. Publishing also sets the template's status to active, which reactivates an archived template.
Only the head can be published, and there is no call to republish an older version. To keep production on an earlier version while a new one is prepared, pin that version on send. The response is the published version with the updated parent attached as template.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
أمثلة
openemail templates publish order-shippedopenemail templates publish order-shipped --jsonمتاح أيضًا في
openemail templates restore-version
Bring an older version's body back as the draft
الاستخدام
openemail templates restore-version <id-or-slug> <version> [flags]
Copies an older version's subject, body, slots and props forward into the head, which is how you undo a design you regret. Nothing is rolled back in place: the old version stays where it is in the list and the restored copy becomes the current draft.
Where it lands follows the usual rule. A published head mints version N+1 as a draft; a draft head is overwritten, so restoring twice does not pile up versions. Live sends do not move until you publish, so a restore is reversible until then: restore something else, or publish to commit.
Restoring the head itself is a 422, because there is nothing to bring back. An unknown version is a 404. --expected-version makes the call safe against a concurrent editor, the same as on update.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.<version>مطلوبThe version whose body you want back, as
listVersionsreports it.
الخيارات
--expected-version <n>The head version you read before restoring. A mismatch is a 409
version_conflictand nothing is written.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates restore-version order-shipped 1openemail templates restore-version order-shipped 1 --yesمتاح أيضًا في
openemail templates delete-version
Delete one version of a template
الاستخدام
openemail templates delete-version <id-or-slug> <version> [flags]
Removes a single revision and leaves the template itself alone. It is for tidying a long version list, not for changing what sends.
Three versions cannot be deleted, and each refusal is a 422 rather than a silent success: the LIVE version, because sends resolve it; the HEAD, because that is the one being edited, and restoring an older version first is how you move off it; and the only version a template has, because a template with no versions could not be read at all, so delete the template instead.
Everything else is fair game. Mail already sent from a deleted version is untouched, since a send stores the body it rendered, but a send that pins a deleted version starts failing with template_version_not_found.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.<version>مطلوبThe version number to delete, as
listVersionsreports it.
أمثلة
openemail templates delete-version order-shipped 1openemail templates delete-version order-shipped 1 --yesمتاح أيضًا في
openemail templates list-starters
List the built-in starter designs
الاستخدام
openemail templates list-starters [flags]
The starter designs the web editor offers, as a plain array. A starter is a ready-made block document with a subject and its declared slots and props, and it is the same catalogue the console shows, so an integration and a person building a template by hand start from the same place.
Bodies are left out here. slug is the handle to pass as starter to create or replaceContent, and getStarter returns one in full with its block tree and a rendered preview.
Starters are static: they are part of the product rather than workspace data, so this answer is the same for every key and changes only when a release adds one.
أمثلة
openemail templates list-startersopenemail templates list-starters --jsonمتاح أيضًا في
openemail templates get-starter
Retrieve one starter design, body and preview included
الاستخدام
openemail templates get-starter <slug> [flags]
One starter in full: everything the list carries, plus document, the block tree itself, and preview, the starter rendered to HTML with each undefaulted prop left visible as {{key}}.
The preview is what the console shows in its starter picker, so a client can display the same thing without rendering anything itself. The document is there so you can seed a template from a starter and edit the tree before creating it, rather than creating from the starter and patching afterwards.
An unknown slug is a 404. Pass the slug exactly as listStarters reports it.
الوسائط
<slug>مطلوبA starter slug from
listStarters, such aswelcome.
أمثلة
openemail templates get-starter welcomeopenemail templates get-starter welcome --jsonمتاح أيضًا في
openemail templates list-fonts
List the web fonts a template can load
الاستخدام
openemail templates list-fonts [flags]
Every web font a template may load, as a plain array, in the order the web editor offers them. Each row names a family, the full CSS stack to write, the fallback a mail client shows when it cannot load the font, the weight range the file covers, and the url the file is served from.
The list is closed on purpose. A font file is fetched by the reader's mail client the moment the message is opened, so a font loaded from anywhere else would tell whoever runs that host when the message was read, whatever the workspace has open tracking set to. A template whose webFont.url is not the one listed here for its family is refused with 422 invalid_template.
Fonts are static: they are part of the product rather than workspace data, so this answer is the same for every key and changes only when a release adds one.
أمثلة
openemail templates list-fontsopenemail templates list-fonts --jsonمتاح أيضًا في
openemail templates render
Render a body that is not stored anywhere
الاستخدام
openemail templates render [flags]
Compiles and renders content you pass in, without creating a template or touching one. This is what the web editor calls while somebody types, and it is the call for checking a design in CI before it becomes a template.
Everything create accepts as content is accepted here: document for the blocks engine, html for the html engine, plus subject, slots and props. values.props and values.slots fill the placeholders; anything left unfilled is rendered blank and reported in warnings, exactly as preview does for a stored template.
mark: true leaves every placeholder visible as {{key}} instead of substituting it, which is how an editor shows an author what is a variable.
الخيارات
--engine <value>Defaults to
htmlwhenhtmlis sent andblocksotherwise.--subject <value>The subject to render, at most 998 characters.
--document <json|@file|->The
blocksbody for theblocksengine, validated in full:bodypluspreview,tailwind,fontsandstyle. JSON shaped asTemplateDocument, inline or from a file with @path.--html <value>The markup for the
htmlengine, at most 1,000,000 characters.--slots <json|@file|->The slots this body declares. JSON shaped as
Array<Partial<TemplateSlot> & { key: string }>, inline or from a file with @path.--props <json|@file|->The props this body declares. JSON shaped as
Array<Partial<TemplateProp> & { key: string }>, inline or from a file with @path.--values-props <json|@file|->Values for the declared props. A missing one renders blank and is reported. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--values-slots <json|@file|->Values for the declared slots, overriding their defaults. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--markLeaves placeholders as
{{key}}rather than substituting them.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates renderopenemail templates render --subject 'Order {{orderId}} is on its way' --html '<p>Hello {{customer}}, {{orderId}} left the warehouse.</p>'متاح أيضًا في
openemail templates preview
Render a template without sending it
الاستخدام
openemail templates preview <id-or-slug> [flags]
Renders a version with the values you pass and returns the subject, HTML and plain text a send with the same values would produce. Nothing is sent or recorded. Point CI at it so a broken template is caught by a test rather than by a customer.
It renders the published version unless version names another one, and unlike send it can render a draft, which is compiled on the fly. A template with nothing published needs an explicit version, otherwise the call is a 422 template_not_published. Required props are relaxed here: a missing one renders its default or an empty string, and every placeholder that ends up blank is listed in warnings as unfilled_placeholder.
The other value checks still apply. A key the version does not declare is a 422 unknown_template_prop or unknown_template_slot, and a value that is not a string, number or boolean is a 422 invalid_template_prop. Values of kind url or image are parsed, and anything outside http, https, mailto, tel and cid renders as #.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--template-version <n>Version to render, drafts included. Defaults to the published version.
--props <json|@file|->Values for declared props, keyed by prop key. Strings, numbers and booleans only. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--slots <json|@file|->Overrides for slot defaults, keyed by slot key. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates preview order-shippedopenemail templates preview order-shipped --jsonمتاح أيضًا في
openemail templates get-analytics
How one template has performed
الاستخدام
openemail templates get-analytics <id-or-slug> [flags]
The engagement report the console shows on a template: how many messages it rendered in the window, how many of those were tracked, how many were opened and clicked, and the same numbers broken down by day, by source and by version.
Rates are computed against what was TRACKED, not against everything sent, because a message sent with tracking off can never report an open and counting it would quietly lower every rate. trackedForOpens and trackedForClicks are the denominators, and they are in the response so you can recompute anything yourself.
lifetime ignores the window: it is every live send this template has ever made, the test sends counted separately, and the first and last time it sent. recent previews the twelve newest sends in the window with their own open and click counts, which is the fastest way to see whether a template that was just published is behaving. It is a preview, not the list: listSends returns every send in the window, a page at a time.
Only live sends are in the windowed figures. A message sent with a test key counts in lifetime.testSends and nowhere else.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--days <n>How far back to look, 1 to 365. Defaults to 30. The window starts at the beginning of that day and ends now.
--minutes <n>The window in minutes, which wins over
days. For the last hour of a send in flight.--grain <value>How wide one
byDaybucket is:day,hourorminute. The bucket keys change shape with it.--offset-minutes <n>The reader's UTC offset in minutes, -840 to 840, so days are bucketed in their own timezone.
أمثلة
openemail templates get-analytics order-shippedopenemail templates get-analytics order-shipped --days 7 --grain dayopenemail templates get-analytics order-shipped --jsonمتاح أيضًا في
openemail templates list-sends
The individual messages a template sent
الاستخدام
openemail templates list-sends <id-or-slug> [flags]
One row per message this template rendered, newest first, with the subject as it went out, who it went to, and whether it was opened or clicked. It is the list behind the numbers getAnalytics reports, and the place to answer "did this person get it".
Paging here is by page number rather than by cursor, because the console shows a table with a total, and total is the count matching the filters rather than the size of the page. Pages are 25 rows by default and at most 100.
The filters narrow by window (days or minutes), by version, by source, and by engagement: opened, clicked and tracked each take a boolean. search matches the subject and the recipient addresses. A row whose message carried no tracking reports matched: false and zero counts, which is not the same as nobody opening it.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--page <n>Which page, from 1. Defaults to 1.
--page-size <n>Rows per page, 1 to 100. Defaults to 25.
--search <value>Matches the subject that went out and the recipient addresses.
--source <value>Only sends from one source, such as
apiorconsole.--template-version <n>Only sends that rendered this version number.
--openedTrue for sends with at least one counted open, false for none.
--clickedTrue for sends with at least one counted click, false for none.
--trackedTrue for sends that carried tracking at all, false for the ones that could never report.
--days <n>How far back to look, 1 to 365. Defaults to 30.
--minutes <n>The window in minutes, which wins over
days.--grain <value>Only floors the start of the window, so this list can cover the same window as
getAnalytics.--offset-minutes <n>The reader's UTC offset in minutes, -840 to 840.
أمثلة
openemail templates list-sends order-shippedopenemail templates list-sends order-shipped --page-size 50 --no-opened --trackedمتاح أيضًا في
openemail templates send
Send an email rendered from a template
الاستخدام
openemail templates send <id-or-slug> --from <value> --to <a,b> [flags] openemail templates send <id-or-slug> --data <json|@file|-> [flags]
Resolves the published version, or the one version pins, fills its placeholders from props and slots, and queues the message. Values are checked strictly here. An undeclared key is a 422 unknown_template_prop or unknown_template_slot, a missing required prop is a 422 missing_template_prop, and a value that is not a string, number or boolean is a 422 invalid_template_prop, each with param set to template.props.<key>. A template with nothing published, or a pinned version that is still a draft, is a 422 template_not_published. No mail leaves when any of these fail.
Pin version in production code. Without it every send resolves whatever is published at that moment, which changes the morning somebody publishes a rewrite. subject replaces the version's subject for this message only and is used exactly as written, with no placeholder filling. --scheduled-at takes a Date, an ISO 8601 instant or an ISO 8601 duration such as PT30M, up to 365 days out, and cannot be combined with a non zero --cancellable-for-seconds.
The SDK attaches an Idempotency-Key generated once per call and reuses it on that call's retries, so a retry replays the original message instead of sending a second one. Pass --idempotency-key to deduplicate across processes and restarts, and derive it from what caused the send, never from a clock. A replay resolves with replayed: true and the original message, while reusing a key with a different body is a 422 idempotency_key_reuse.
الوسائط
<id-or-slug>مطلوبA
tpl_id or the template's slug.
الخيارات
--from <value>Sender as
address,Name <address>or{ email, name }. The key must be allowed to send as it, otherwise 403from_address_forbidden. Required, here or in--data.--to <a,b>قابل للتكرار1 to 50 recipients. The SDK wraps a single value in an array. Required, here or in
--data.--cc <a,b>قابل للتكرارUp to 50 copied recipients.
الافتراضي[]--bcc <a,b>قابل للتكرارUp to 50 blind copied recipients.
الافتراضي[]--reply-to <value>Sets the Reply-To header.
--template-version <n>Published version to send. Defaults to the currently published one.
--props <json|@file|->Values for the declared props: strings, numbers or booleans, keyed by prop key. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--slots <json|@file|->Overrides for slot defaults, keyed by slot key. JSON shaped as
Record<string, unknown>, inline or from a file with @path.--subject <value>Replaces the version's subject for this message, sent verbatim, at most 998 characters.
--scheduled-at <when>When to send: a
Date, an ISO 8601 instant or a duration likePT2H. Must be in the future and at most 365 days out.--cancellable-for-seconds <n>Holds the message 0 to 900 seconds so it can still be cancelled. Defaults to 0 and is refused alongside
--scheduled-at.الافتراضي0--tracking <json|@file|->Per message
opensandclicksswitches for open and click tracking. JSON shaped asTrackingRequest, inline or from a file with @path.--tags <json|@file|->قابل للتكرارYour own labels for the send, keys up to 64 and values up to 256 characters.
الافتراضي{}--translate <json|@file|->Translates the rendered message into
tobefore sending, with optionalfrom,includeOriginal(default true) andsubject(default true). JSON shaped asSendTranslateOptions, inline or from a file with @path.--idempotency-key <value>Your own key in place of the generated one: 1 to 255 characters of letters, digits,
_,.,:or-.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates send order-shipped --from [email protected] --to [email protected]openemail templates send order-shipped --from [email protected] --to [email protected] --template-version 5 --idempotency-key order-shipped:AC-4192openemail templates send order-shipped --data @template.jsonمتاح أيضًا في
openemail templates list-images
List one page of template images
الاستخدام
openemail templates list-images [flags]
Resolves one page of the images uploaded for templates, newest first: the library the template editor offers when you add an image.
Template images belong to the workspace: every template in it can use them, and they stay at their address after the template that first used them is deleted.
Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.
الخيارات
--limit <n>Page size, from 1 to 120. The server defaults to 24.
الافتراضي24--cursor <value>The
nextCursorof the previous page. Leave it out for the first page.--allFetch every page and stream the items as they arrive.
--max <n>Stop after this many items. Implies
--all.--ndjsonPrint every item as one JSON object per line. Implies
--all
أمثلة
openemail templates list-imagesopenemail templates list-images --limit 10openemail templates list-images --all --max 100openemail templates list-images --all > templates.ndjsonمتاح أيضًا في
openemail templates upload-image
Upload an image for templates
الاستخدام
openemail templates upload-image <data> [flags]
Sends the image bytes as the request body and resolves with its public url, ready to put in a template. It is the upload of the template editor.
PNG, JPEG, WebP, GIF or SVG, up to 5 MB, fitted into 1200 by 1800 pixels and stored in a form every mail client shows. The type is read from --content-type, or from a Blob's own type when that is left out, and without either the server refuses the bytes with 422 invalid_image.
Template images belong to the workspace: every template in it can use them, and they stay at their address after the template that first used them is deleted.
الوسائط
<data>مطلوبThe image: a
Blob,ArrayBufferorUint8Array.
الخيارات
--content-type <value>image/png,image/jpeg,image/webp,image/giforimage/svg+xml. Required unlessdatais aBlobwith a type.
أمثلة
openemail templates upload-image ./photo.jpgopenemail templates upload-image ./photo.jpg --content-type image/pngمتاح أيضًا في
openemail templates design
Design a new template from a brief
الاستخدام
openemail templates design --name <value> --brief <value> [flags] openemail templates design --data <json|@file|-> [flags]
A designer builds a new block template from a written brief, the way the assistant in the app does, and saves it, as a draft unless publish is true. It uses every block the editor has, with a palette, type and spacing, and the result opens in the visual editor fully editable.
Put everything the design must hold in brief: what it is for, the sections in order, the words, the colours and fonts, and which values change per recipient. starter builds on a starter design, and --image-file-ids places up to ten uploaded or received images. It spends one AI action and can take up to a minute.
الخيارات
--name <value>A short name for the template. When the name is taken, a free one is chosen and returned. Required, here or in
--data.--brief <value>Everything the design must hold and look like, up to 8,000 characters. Required, here or in
--data.--description <value>One line about what it is for.
--starter <value>The slug of a starter design to build on, from
listStarters.--image-file-ids <a,b>قابل للتكرارUp to ten file ids of images to place in the design.
--publishPublish it at once so it can be sent. Defaults to false.
--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates design --name 'Spring launch' --brief 'A launch email for our spring collection: a hero image, three product cards and a button to the shop. Green and cream, friendly tone.'openemail templates design --data @template.jsonمتاح أيضًا في
openemail templates redesign
Change a template’s design from instructions
الاستخدام
openemail templates redesign <id-or-slug> --instructions <value> [flags] openemail templates redesign <id-or-slug> --data <json|@file|-> [flags]
A designer applies written instructions to a block template and leaves everything else alone: restyle it, change colours, fonts or spacing, rewrite or translate its copy, add, move or remove sections, swap an image. The change lands in the draft, so live sends keep the published version until you publish.
A raw HTML template cannot be redesigned and is refused with 422 invalid_template. It spends one AI action.
الوسائط
<id-or-slug>مطلوبThe template's id or slug.
الخيارات
--instructions <value>What to change, with every detail: the words, colours and which section. Up to 8,000 characters. Required, here or in
--data.--image-file-ids <a,b>قابل للتكرارUp to ten file ids of images to use.
--expected-version <n>The version you based the change on. A newer one is refused with 409
version_conflict.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
أمثلة
openemail templates redesign spring-launch --instructions 'Make the button orange and translate the copy into Spanish.'openemail templates redesign spring-launch --data @template.json