Email

Map an email template

  • Sandbox: available
  • Staging: available
  • Production: unknown
PUT
/v1/projects/me/email-templates/{name}

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

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" }'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

name*string

The template name.

Query Parameters

language?string
Value in"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
Match^(?:\[[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_])?)*)$
Lengthlength <= 253

Request Body

application/json
  1. body
provider*string
Value in"brevo""sendgrid""resend""smtp"
templateId*string
Length1 <= length <= 200
subject?string
Length1 <= length <= 998
html?string
Length1 <= length <= 200000

Response Body

The mapping as stored.

application/json
  1. response
name*string
Value in"OVOK_ORGANIZATION_CODES""INVITE_TO_PROJECT""RESET_PASSWORD""VIDEO_CALL_APPOINTMENT_INVITE""VIDEO_CALL_APPOINTMENT_UPDATE""VIDEO_CALL_APPOINTMENT_CANCEL""ACCOUNT_DELETION""ACCOUNT_DELETION_IMMEDIATE""TRENDS_PDF_EXPORT""CUSTOMER_SUPPORT_EMAIL""PATIENT_WELCOME""CLINICIAN_SIGNUP_INVITE""PATIENT_RESET_PASSWORD""PATIENT_ACCOUNT_DELETION""PATIENT_ORGANIZATION_CODES""PATIENT_INVITE""PATIENT_ASSIGNMENT_REQUEST""PRACTITIONER_INVITED_BY_PATIENT""PRACTITIONER_PATIENT_SHARED""RELATED_PERSON_INVITED""RELATED_PERSON_RECORD_SHARED""PRACTITIONER_ALERT_DIGEST"
provider*string
Value in"brevo""sendgrid""resend""smtp"
templateId*string
language*string

The language context, or null for a mapping that applies to any language.

domain*string

The domain context, or null for a mapping that applies to any domain.

subject*string

SMTP only: the subject of the stored template.

ready*boolean

Whether the project's secrets hold what this provider needs to send: its credential, and EMAIL_FROM for SendGrid and SMTP.

html*string

SMTP only: the stored HTML body.

Example Request
curl -X PUT 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/string' \  -H 'Content-Type: application/json' \  -d '{  "provider": "brevo",  "templateId": "string"}'
Example Response
{  "name": "OVOK_ORGANIZATION_CODES",  "provider": "brevo",  "templateId": "string",  "language": "string",  "domain": "string",  "subject": "string",  "ready": true,  "html": "string"}

Remove an email template mapping DELETE

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 - `: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 removes the mapping that has none. A malformed `language` or `domain` returns 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-templates` describes. 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 ```bash 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' ```

Get the project's email providers GET

Returns which email providers your current project has set up, whether each can send, and the sender address. It never returns a secret. **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 - `providers` lists `brevo`, `sendgrid`, `resend` and `smtp`, each with `configured` and `ready`. - `configured` is `true` when the project holds a secret for the provider that this server can read: its API key, or the SMTP URL. A secret stored with another key reads as not configured; set it up again with `POST`. - `ready` is `true` when the provider can send: it is configured and, for SendGrid and SMTP, the project has a sender address. - `from` is the sender address (the `EMAIL_FROM` secret), or `null`. - These are the caller's project's own secrets. A mail sent through a parent project's or the platform's template mapping uses that project's secrets, not these. - The project's email template mappings (`GET /v1/projects/me/email-templates`) say which provider each mail is sent through. A mapping sends only when its provider is ready. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/email/templates/provider' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```