Skip to content

staff.mailTemplates ​

5 methods on staff.mailTemplates. Each returns the answer's data and throws NoviqaError on a failed answer.

list ​

GET/admin/v1/mail-templates

List mail templates

Every template: notification templates (kinds deal, order, balance, code, statement — the texts platform e-mails and notices are written from, per templates folder and language) first, then the compose templates (kind message), each part by name. Not scope-limited.

More details

Rights: the staff member needs at least one of: config.mail, mailbox.

Returns
Promise<MailTemplate[]>
The answer's data.
Errors
401auth.session_expired: session expired, sign in again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailTemplates.list()
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-templates" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": [
    {
      "body": "string",
      "created_at": "2026-09-25T10:15:00Z",
      "folder": "string",
      "id": 1,
      "kind": "string",
      "language": "string",
      "name": "Ann Smith",
      "subject": "string",
      "updated_at": "2026-09-25T10:15:00Z",
      "version": 1
    }
  ],
  "request_id": "5b7f2c1e"
}
ts
staff.mailTemplates.list(options?: RequestOptions): Promise<models.MailTemplate[]>

create ​

POST/admin/v1/mail-templates

Add a mail template

Adds a compose template (kind message, the default), or a deal/order/balance/statement notification text for a company's templates folder or in another language than the default. The standard notification templates exist from the start and are only edited. name 1-64 characters, folder up to 64 without leading or trailing spaces, language one of en, de (default en), subject up to 256 characters on one line, body up to 64 KiB; {{placeholders}} are filled per recipient. id, version and the times are set by the server. The name must be unused and a folder holds one template per kind and language. Writes a journal line.

More details

Rights: the staff member needs every one of: config.mail.

Request body
bodystring
created_atstring
UTC time, RFC 3339.
folderstring
a company's templates folder; empty = the standard templates
idinteger
kindstring
languagestring
the language it is written in; notifications pick the account's
namestring
subjectstring
updated_atstring
UTC time, RFC 3339.
versioninteger
Returns
Promise<MailTemplate>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailTemplates.create({
  body: "Your account {{login}} in {{currency}} is ready.",
  kind: "message",
  name: "Welcome",
  subject: "Welcome, {{name}}"
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/mail-templates" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "body": "Your account {{login}} in {{currency}} is ready.",
  "kind": "message",
  "name": "Welcome",
  "subject": "Welcome, {{name}}"
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "body": "string",
    "created_at": "2026-09-25T10:15:00Z",
    "folder": "string",
    "id": 1,
    "kind": "string",
    "language": "string",
    "name": "Ann Smith",
    "subject": "string",
    "updated_at": "2026-09-25T10:15:00Z",
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailTemplates.create(body: models.MailTemplate, options?: RequestOptions): Promise<models.MailTemplate>

retrieve ​

GET/admin/v1/mail-templates/{id}

Read a mail template

One template.

More details

Rights: the staff member needs at least one of: config.mail, mailbox.

Parameters
idinteger · pathrequired
Numeric id.
Returns
Promise<MailTemplate>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailTemplates.retrieve(1)
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-templates/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "body": "string",
    "created_at": "2026-09-25T10:15:00Z",
    "folder": "string",
    "id": 1,
    "kind": "string",
    "language": "string",
    "name": "Ann Smith",
    "subject": "string",
    "updated_at": "2026-09-25T10:15:00Z",
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailTemplates.retrieve(id: number, options?: RequestOptions): Promise<models.MailTemplate>

update ​

PATCH/admin/v1/mail-templates/{id}

Change a mail template

Changes name, subject or body only (any other field is refused; kind, folder and language are fixed). Same limits as creating. version is required and must be the one last read, else conflict; a body that changes nothing answers the template unchanged. Writes a journal line with the changed fields.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Request body
bodystring
created_atstring
UTC time, RFC 3339.
folderstring
a company's templates folder; empty = the standard templates
idinteger
kindstring
languagestring
the language it is written in; notifications pick the account's
namestring
subjectstring
updated_atstring
UTC time, RFC 3339.
versioninteger
Returns
Promise<MailTemplate>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailTemplates.update(1, {
  subject: "Welcome aboard, {{name}}",
  version: 3
})
bash
curl -X PATCH "$NOVIQA_API_URL/admin/v1/mail-templates/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "subject": "Welcome aboard, {{name}}",
  "version": 3
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "body": "string",
    "created_at": "2026-09-25T10:15:00Z",
    "folder": "string",
    "id": 1,
    "kind": "string",
    "language": "string",
    "name": "Ann Smith",
    "subject": "string",
    "updated_at": "2026-09-25T10:15:00Z",
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailTemplates.update(id: number, body: models.MailTemplate, options?: RequestOptions): Promise<models.MailTemplate>

delete ​

DELETE/admin/v1/mail-templates/{id}

Delete a mail template

Removes a compose template or a folder/language notification text. A standard notification template (no folder, default language) cannot be deleted. Writes a journal line.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Returns
Promise<null>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailTemplates.delete(1)
bash
curl -X DELETE "$NOVIQA_API_URL/admin/v1/mail-templates/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": null,
  "request_id": "5b7f2c1e"
}
ts
staff.mailTemplates.delete(id: number, options?: RequestOptions): Promise<null>