Appearance
staff.mailServers
6 methods on staff.mailServers. Each returns the answer's data and throws NoviqaError on a failed answer.
list
GET
/admin/v1/mail-serversList mail servers
Every outgoing e-mail (SMTP) server, by name. Passwords are never returned: has_password says whether one is stored. stats is computed from the e-mail outbox: sent, errors (given up after every retry), queued (waiting or being sent now) and avg_send_seconds (0 with no sent e-mail yet); the enabled default server's stats also count e-mails queued for "the default server" without a server of their own.
More details
Rights: the staff member needs every one of: config.mail.
Returns
Promise<MailServer[]>The answer's
data.Errors
401
auth.session_expired: session expired, sign in again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.list()bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-servers" \
-H "Authorization: Bearer $NOVIQA_TOKEN"json
{
"success": true,
"code": "ok",
"message": "done",
"data": [
{
"created_at": "2026-09-25T10:15:00Z",
"enabled": true,
"has_password": true,
"id": 1,
"is_default": true,
"login": 1001,
"name": "Ann Smith",
"password": "string",
"security": "string",
"sender_email": "string",
"sender_name": "string",
"server": "string"
}
],
"request_id": "5b7f2c1e"
}ts
staff.mailServers.list(options?: RequestOptions): Promise<models.MailServer[]>create
POST
/admin/v1/mail-serversAdd a mail server
Adds an outgoing e-mail server. Required: name (1-64 letters, digits, spaces or . _ & # -, unique), sender_email (one bare address), server (host:port, port 1-65535). security is none, starttls (default; the upgrade is required) or tls; enabled defaults to true. sender_name up to 128 characters without line breaks or quotes; login and password up to 255 each; the password is stored sealed and never returned. is_default true makes it the server platform e-mails go through and takes the mark from the previous default. id, version, has_password and the times are set by the server. Writes a journal line.
More details
Rights: the staff member needs every one of: config.mail.
Request body
created_atstringUTC time, RFC 3339.
enabledbooleanhas_passwordbooleanread-only
idintegeris_defaultbooleanthe server used when none is named
loginstringnamestringpasswordstringwrite-only: never returned, stored sealed
securitystringnone, starttls (upgrade required) or tls (from the start)
sender_emailstringsender_namestringserverstringhost:port
statsanyread-only: computed from the e-mail outbox
updated_atstringUTC time, RFC 3339.
versionintegerReturns
Promise<MailServer>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action409
conflict: already exists500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.create({
enabled: true,
is_default: true,
login: "noreply@broker.example",
name: "Main SMTP",
password: "app-password",
security: "starttls",
sender_email: "noreply@broker.example",
sender_name: "Broker Support",
server: "smtp.broker.example:587"
})bash
curl -X POST "$NOVIQA_API_URL/admin/v1/mail-servers" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"enabled": true,
"is_default": true,
"login": "noreply@broker.example",
"name": "Main SMTP",
"password": "app-password",
"security": "starttls",
"sender_email": "noreply@broker.example",
"sender_name": "Broker Support",
"server": "smtp.broker.example:587"
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": {
"created_at": "2026-09-25T10:15:00Z",
"enabled": true,
"has_password": true,
"id": 1,
"is_default": true,
"login": 1001,
"name": "Ann Smith",
"password": "string",
"security": "string",
"sender_email": "string",
"sender_name": "string",
"server": "string"
},
"request_id": "5b7f2c1e"
}ts
staff.mailServers.create(body: models.MailServer, options?: RequestOptions): Promise<models.MailServer>retrieve
GET
/admin/v1/mail-servers/{id}Read a mail server
One mail server, without its password.
More details
Rights: the staff member needs every one of: config.mail.
Parameters
idinteger · pathrequiredNumeric id.
Returns
Promise<MailServer>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.retrieve(1)bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
-H "Authorization: Bearer $NOVIQA_TOKEN"json
{
"success": true,
"code": "ok",
"message": "done",
"data": {
"created_at": "2026-09-25T10:15:00Z",
"enabled": true,
"has_password": true,
"id": 1,
"is_default": true,
"login": 1001,
"name": "Ann Smith",
"password": "string",
"security": "string",
"sender_email": "string",
"sender_name": "string",
"server": "string"
},
"request_id": "5b7f2c1e"
}ts
staff.mailServers.retrieve(id: number, options?: RequestOptions): Promise<models.MailServer>update
PATCH
/admin/v1/mail-servers/{id}Change a mail server
Changes the fields sent; id, has_password, created_at and updated_at are refused. password "" removes the stored password, leaving it out keeps it. Same rules as creating. version is required and must be the one last read, else conflict; setting is_default true takes the mark from the previous default. A body that changes nothing answers the server unchanged. Writes a journal line with the changed fields.
More details
Rights: the staff member needs every one of: config.mail.
Parameters
idinteger · pathrequiredNumeric id.
Request body
created_atstringUTC time, RFC 3339.
enabledbooleanhas_passwordbooleanread-only
idintegeris_defaultbooleanthe server used when none is named
loginstringnamestringpasswordstringwrite-only: never returned, stored sealed
securitystringnone, starttls (upgrade required) or tls (from the start)
sender_emailstringsender_namestringserverstringhost:port
statsanyread-only: computed from the e-mail outbox
updated_atstringUTC time, RFC 3339.
versionintegerReturns
Promise<MailServer>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found409
conflict: already exists500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.update(1, {
security: "tls",
server: "smtp.broker.example:465",
version: 2
})bash
curl -X PATCH "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"security": "tls",
"server": "smtp.broker.example:465",
"version": 2
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": {
"created_at": "2026-09-25T10:15:00Z",
"enabled": true,
"has_password": true,
"id": 1,
"is_default": true,
"login": 1001,
"name": "Ann Smith",
"password": "string",
"security": "string",
"sender_email": "string",
"sender_name": "string",
"server": "string"
},
"request_id": "5b7f2c1e"
}ts
staff.mailServers.update(id: number, body: models.MailServer, options?: RequestOptions): Promise<models.MailServer>delete
DELETE
/admin/v1/mail-servers/{id}Delete a mail server
Removes a mail server. Writes a journal line.
More details
Rights: the staff member needs every one of: config.mail.
Parameters
idinteger · pathrequiredNumeric id.
Returns
Promise<null>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.delete(1)bash
curl -X DELETE "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
-H "Authorization: Bearer $NOVIQA_TOKEN"json
{
"success": true,
"code": "ok",
"message": "done",
"data": null,
"request_id": "5b7f2c1e"
}ts
staff.mailServers.delete(id: number, options?: RequestOptions): Promise<null>test
POST
/admin/v1/mail-servers/{id}/testSend a test e-mail
Sends one test e-mail to to (one bare address) through this server right now, even if it is disabled, and waits for the server's answer. A failure answers invalid_input whose message carries the server's first error line; a stored password that can no longer be opened must be entered again. Every attempt writes a journal line.
More details
Rights: the staff member needs every one of: config.mail.
Parameters
idinteger · pathrequiredNumeric id.
Request body
tostringthe one address the test e-mail goes to
Returns
Promise<null>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.mailServers.test(1, {
to: "ops@broker.example"
})bash
curl -X POST "$NOVIQA_API_URL/admin/v1/mail-servers/1/test" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"to": "ops@broker.example"
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": null,
"request_id": "5b7f2c1e"
}ts
staff.mailServers.test(id: number, body: http.docMailServerTest, options?: RequestOptions): Promise<null>