Email

List email templates and their params

  • Sandbox: available
  • Staging: available
  • Production: unknown
GET
/v1/email/templates

Lists every email template a project can map in its email ConceptMap, with the params each one receives. Use it when you write or review a template.

Auth: bearer token. The caller must be a Practitioner, an admin or a super admin, or hold the "System Owner" access policy. Scope: none. The list is the same for every project.

Behaviour

  • Each entry has the template name, the audience (patient or practitioner), the params, a full example, and the syntax each provider uses to reference a param.
  • audience tells you whose app the baseUrl param points at: the patient app or the practitioner dashboard.
  • Every listed param is always sent. A param marked nullable is null when there is no value.
  • A send whose params do not match its template is refused, so a template can rely on every param listed.
  • Resend accepts text and numbers only. A list param x reaches Resend as xList, with one item per line, and a null reaches it as an empty string.
  • Entries follow the order of the TemplateNames enum.

Example

curl -X GET 'https://api.sandbox.ovok.com/v1/email/templates' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'

Authorization

bearer
headerAuthorizationBearer <JWT>

Response Body

Every template, in the order of the TemplateNames enum.

application/json
  1. response
templates*array<>
Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/email/templates'
Example Response
{  "templates": [    {      "name": "OVOK_ORGANIZATION_CODES",      "audience": "patient",      "params": [        {          "name": "string",          "type": "string",          "nullable": true        }      ],      "example": {        "property1": null,        "property2": null      },      "syntax": {        "sendgrid": "string",        "brevo": "string",        "resend": "string",        "smtp": "string"      }    }  ]}

Get example email template params GET

Returns one example set of params for every email template, keyed by template name. Use it to preview what a template receives. For the types, nullability and audience of each param, use `GET /v1/email/templates` instead. **Auth:** bearer token. Any signed-in user can call it. The response is the same for every project. ## Behaviour - The response is an object with one key per template name. Each value is an example of the params that template receives when it is sent. - The values are fixed sample data, not data from your project. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/email/templates' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```

List the project's email template mappings GET

Lists the email template mappings of your current project: for each Ovok template name, which template of your email provider it sends, in which language and for which domain. It also lists the template names the project has no mapping for. **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 - `mappings` holds the project's **own** mappings. Mappings of the parent project and of the platform are not listed. - `unmapped` holds the template names the project has no mapping for, in any language or domain. It does not say that nothing is sent: a parent project's or the platform's mapping may still apply, and an unmapped patient template (`PATIENT_RESET_PASSWORD`, `PATIENT_ACCOUNT_DELETION`, `PATIENT_ORGANIZATION_CODES`, `PATIENT_INVITE`) is sent as its shared template when the mapping maps that one. - A mapping applies to a mail in its `language` and for its `domain`. A `null` `language` or `domain` means the mapping names none. Sending tries the most specific context first: domain and language, domain and the project's default language, domain alone, language alone, the default language, then no context. Within one level it takes the project's mapping, then its parent's, then the platform's, so a parent's or the platform's mapping at a more specific level is used before the project's own at a less specific one. - `ready` is `false` when the project's secrets lack what the provider needs: its credential (`BREVO_API_KEY`, `SENDGRID_API_KEY`, `RESEND_API_KEY` or `SMTP_URL`), and `EMAIL_FROM` for SendGrid and SMTP. It only checks that they are there, not that they work. A mapping that is not ready cannot send; sending moves on to the next mapping that applies. - One language and domain use one provider. When a project has several ConceptMaps for the same language and domain, only the most recently updated one is read, as sending does. - Mappings are ordered as the template names are, then by language and domain. Their `html` is left out: `GET /v1/projects/me/email-templates/:name` returns it. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/projects/me/email-templates' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```