---
title: Messages
project: Total API
version: 2026
section: reference
language: en
license: 
url: https://totaljs.es/docs/total-api/2026/reference/messages/
updated: 2026-11-20T06:51:47.968Z
---

# Messages

> Send emails and text messages, and store log messages.

Every service is a `POST` request with your token. See [Call Total API from Total.js](../../guides/call-from-totaljs/) and [Call Total API over HTTP](../../guides/call-over-http/).

## API

### POST https://api.totaljs.com/mail/

Type: `rest`

Sends an email.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `to` | `Array` | yes |  | The email addresses of the recipients. |
| `subject` | `String` | yes |  | The subject. |
| `body` | `String` | yes |  | The message as HTML. |
| `from` | `String` | no |  | The name of the sender (a name, not an email address). |
| `cc` | `Array` | no |  | Email addresses for a copy. |
| `bcc` | `Array` | no |  | Email addresses for a hidden copy. |
| `reply` | `Array` | no |  | Email addresses for the answers. |
| `priority` | `Number` | no | `3` | `1` high, `3` normal, `5` low. |
| `confidential` | `Boolean` | no |  | Marks the email as confidential. |
| `unsubscribe` | `String` | no |  | The address of a page to unsubscribe. |

Returns: `Object` `{ "success": true }` when the email is sent.

The emails are sent from `noreply@totaljs.com`. A Total.js application can send all its emails through this service: see [Call Total API from Total.js](../../guides/call-from-totaljs/#send-the-emails-of-the-app-through-total-api).

Example: Total.js
```js
await API('TAPI', 'mail', { from: 'Demo Shop', to: ['jane@example.com'], subject: 'Your order', body: '<p>Thank you for your order.</p>' }).promise();
```

Example: REST
```bash
curl -X POST https://api.totaljs.com/mail/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "from": "Demo Shop", "to": ["jane@example.com"], "subject": "Your order", "body": "<p>Thank you for your order.</p>" }'
```

Example: Response
```json
{ "success": true }
```

### POST https://api.totaljs.com/sms/

Type: `rest`

Sends a text message.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `from` | `String` | yes |  | The name of the sender. |
| `to` | `String` | yes |  | The phone number with its country code, for example `+421900000000`. |
| `body` | `String` | yes |  | The message. |

Returns: `Object` `{ "success": true }` when the message is sent.

The price of a message can vary.

Example: Total.js
```js
await API('TAPI', 'sms', { from: 'Demo Shop', to: '+421900000000', body: 'Your order is on its way.' }).promise();
```

Example: REST
```bash
curl -X POST https://api.totaljs.com/sms/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "from": "Demo Shop", "to": "+421900000000", "body": "Your order is on its way." }'
```

Example: Response
```json
{ "success": true }
```

### POST https://api.totaljs.com/logger/

Type: `rest`

Stores a log message in the Total.js Platform.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `app` | `String` | yes |  | The name of the application, up to 40 characters. |
| `message` | `String` | yes |  | The message, up to 500 characters. |
| `type` | `String` | no | `info` | `info`, `warning`, `error` or `success`. |
| `url` | `String` | no |  | An address, up to 100 characters. |
| `reference` | `String` | no |  | A reference of your own, up to 50 characters. |
| `data` | `String` | no |  | Data of your own as JSON text. |
| `ua` | `String` | no |  | The user agent, up to 30 characters. |
| `ip` | `String` | no |  | The IP address, up to 60 characters. |
| `userid` | `String` | no |  | The id of the user, up to 25 characters. |
| `username` | `String` | no |  | The name of the user, up to 50 characters. |

Returns: `Object` The answer of the service.

A request can have up to 50 kB. A Total.js application can send all its audit logs to this service: see [Call Total API from Total.js](../../guides/call-from-totaljs/#send-the-audit-logs-to-total-api).

Example: Total.js
```js
await API('TAPI', 'logger', { app: 'Demo Shop', type: 'info', message: 'The daily import has finished.' }).promise();
```

Example: REST
```bash
curl -X POST https://api.totaljs.com/logger/ \
	-H "Content-Type: application/json" \
	-H "X-Token: YOUR_TOKEN" \
	-d '{ "app": "Demo Shop", "type": "info", "message": "The daily import has finished." }'
```
