Remove an email template mapping
- Sandbox: available
- Staging: available
- Production: unknown
Removes one email template mapping of your current project.
Auth: bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. Scope: the caller's project (from the token).
Behaviour
:namemust be one of the template names. An unknown one returns 400UNKNOWN_TEMPLATEwith the accepted names.languageanddomainchoose which mapping of the template. Both are matched exactly, and leaving one out removes the mapping that has none. A malformedlanguageordomainreturns 422.- Only the project's own mappings can be removed. A template that is not mapped there returns 404, even when the parent project or the platform maps it.
- After it is removed, sending uses the next mapping that applies, in the order
GET /v1/projects/me/email-templatesdescribes. That can be a parent project's or the platform's mapping, including one for a more specific language or domain than the one you removed. With none, the mail is not sent, except that a patient template (PATIENT_RESET_PASSWORD,PATIENT_ACCOUNT_DELETION,PATIENT_ORGANIZATION_CODES,PATIENT_INVITE) is sent as its shared template when the same mapping maps that one. - When it was the last mapping of its language and domain, that ConceptMap is deleted with it. If the project has an older ConceptMap for the same language and domain, only the newest is read, so removing it brings the older one back.
- A 409 means another write to the project's mappings is running, or they changed while the server wrote. Read them again and retry.
- The answer is 204 with no body.
Example
curl -X DELETE 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/INVITE_TO_PROJECT?language=en-US' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'bearerAuthorizationBearer <JWT>name*stringThe template name.
language?string"Cy-az-AZ""Cy-sr-SP""Cy-uz-UZ""Lt-az-AZ""Lt-sr-SP""Lt-uz-UZ""aa""ab""ae""af""af-ZA""ak""am""an""ar""ar-AE""ar-BH""ar-DZ""ar-EG""ar-IQ""ar-JO""ar-KW""ar-LB""ar-LY""ar-MA""ar-OM""ar-QA""ar-SA""ar-SY""ar-TN""ar-YE""as""av""ay""az""ba""be""be-BY""bg""bg-BG""bh""bi""bm""bn""bo""br""bs""ca""ca-ES""ce""ch""co""cr""cs""cs-CZ""cu""cv""cy""da""da-DK""de""de-AT""de-CH""de-DE""de-LI""de-LU""div-MV""dv""dz""ee""el""el-GR""en""en-AU""en-BZ""en-CA""en-CB""en-GB""en-IE""en-JM""en-NZ""en-PH""en-TT""en-US""en-ZA""en-ZW""eo""es""es-AR""es-BO""es-CL""es-CO""es-CR""es-DO""es-EC""es-ES""es-GT""es-HN""es-MX""es-NI""es-PA""es-PE""es-PR""es-PY""es-SV""es-UY""es-VE""et""et-EE""eu""eu-ES""fa""fa-IR""ff""fi""fi-FI""fj""fo""fo-FO""fr""fr-BE""fr-CA""fr-CH""fr-FR""fr-LU""fr-MC""fy""ga""gd""gl""gl-ES""gn""gu""gu-IN""gv""ha""he""he-IL""hi""hi-IN""ho""hr""hr-HR""ht""hu""hu-HU""hy""hy-AM""hz""ia""id""id-ID""ie""ig""ii""ik""io""is""is-IS""it""it-CH""it-IT""iu""ja""ja-JP""jv""ka""ka-GE""kg""ki""kj""kk""kk-KZ""kl""km""kn""kn-IN""ko""ko-KR""kr""ks""ku""kv""kw""ky""ky-KZ""la""lb""lg""li""ln""lo""lt""lt-LT""lu""lv""lv-LV""mg""mh""mi""mk""mk-MK""ml""mn""mn-MN""mr""mr-IN""ms""ms-BN""ms-MY""mt""my""na""nb""nb-NO""nd""ne""ng""nl""nl-BE""nl-NL""nn""nn-NO""no""nr""nv""ny""oc""oj""om""or""os""pa""pa-IN""pi""pl""pl-PL""ps""pt""pt-BR""pt-PT""qu""rm""rn""ro""ro-RO""ru""ru-RU""rw""sa""sa-IN""sc""sd""se""sg""si""sk""sk-SK""sl""sl-SI""sm""sn""so""sq""sq-AL""sr""ss""st""su""sv""sv-FI""sv-SE""sw""sw-KE""ta""ta-IN""te""te-IN""tg""th""th-TH""ti""tk""tl""tn""to""tr""tr-TR""ts""tt""tt-RU""tw""ty""ug""uk""uk-UA""ur""ur-PK""uz""ve""vi""vi-VN""vo""wa""wo""xh""yi""yo""za""zh""zh-CHS""zh-CHT""zh-CN""zh-HK""zh-MO""zh-SG""zh-TW""zu"domain?string^(?:\[[0-9a-f:.]+\]|[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?(?:\.[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?)*)$length <= 253The mapping is removed. No body.
curl -X DELETE 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/string'Get an email template mapping GET
Returns one email template mapping of your current project, with its HTML when it is an SMTP one. **Auth:** bearer token. The caller must be a Practitioner, a project admin, or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `:name` must be one of the template names. An unknown one returns 400 `UNKNOWN_TEMPLATE` with the accepted names. - `language` and `domain` choose which mapping of the template. Both are matched exactly, and leaving one out asks for the mapping that has none. `language` is one of Ovok's locale codes, such as `en-US` or `de-DE`; a bare `en` is read as `en-US`, and any other value returns 422. `domain` is a host name such as `app.example.com`, lower-cased, without scheme or port. - Only the project's own mappings are found. A template that is mapped in the parent project or the platform, but not here, returns 404. - `subject` and `html` are set for SMTP only. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/INVITE_TO_PROJECT?language=en-US' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Map an email template PUT
Maps an Ovok email template to a template of your email provider, for one language and domain. It replaces what the template was mapped to there, or adds the mapping when there is none. **Auth:** bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `:name` must be one of the template names. An unknown one returns 400 `UNKNOWN_TEMPLATE` with the accepted names. - `language` and `domain` in the query say where the mapping applies; leave one out for none. `language` is one of Ovok's locale codes, such as `en-US` or `de-DE`, because that is what a mail's language is matched on; a bare `en` is stored as `en-US`, and any other value returns 422. `domain` is a host name, lower-cased, without scheme or port. See `GET /v1/projects/me/email-templates` for how sending picks between mappings. - `provider` is `brevo`, `sendgrid`, `resend` or `smtp`. `templateId` is up to 200 characters and must be valid for the provider: digits only for Brevo, `d-` followed by lower-case hex for SendGrid, and no whitespace for Resend and SMTP. Otherwise 422 `INVALID_TEMPLATE_ID`. - SMTP has no hosted templates: send the `subject` (up to 998 characters) and the `html` (up to 200,000 characters) with it, and nothing else may carry them. A missing or blank one for SMTP, or either for another provider, returns 422 `INVALID_TEMPLATE_CONTENT`. - An SMTP subject and html are test-rendered with the template's example params before they are stored, the way sending renders them: a param the template does not have, or a block that is not closed, returns 422 `INVALID_TEMPLATE_CONTENT`. `GET /v1/email/templates` lists every template's params and how each provider writes a param. - One language and domain use one provider. Mapping with another one than the one already there returns 409 `PROVIDER_MISMATCH`: remove that language and domain's mappings first. - This does not set up the provider. Its credential and `EMAIL_FROM` are project secrets; until they exist the mapping is stored with `ready: false` and nothing is sent through it. - Writes to a project's mappings are one at a time. A second write that arrives while another is running is refused with 409 and not queued: retry it. A 409 also means the mappings changed while the server wrote; read them again and retry. ## Example ```bash curl -X PUT 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/INVITE_TO_PROJECT?language=en-US' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "provider": "brevo", "templateId": "12" }' ```