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

# Messages

> Envoie des e-mails et des SMS, et enregistre des messages de journal.

Chaque service est une requête `POST` avec ton token. Consulte [Appeler Total API depuis Total.js](../../guides/call-from-totaljs/) et [Appeler Total API en HTTP](../../guides/call-over-http/).

## API

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

Type: `rest`

Envoie un e-mail.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `to` | `Array` | yes |  | Les adresses e-mail des destinataires. |
| `subject` | `String` | yes |  | L’objet. |
| `body` | `String` | yes |  | Le message en HTML. |
| `from` | `String` | no |  | Le nom de l’expéditeur (un nom, pas une adresse e-mail). |
| `cc` | `Array` | no |  | Des adresses e-mail pour une copie. |
| `bcc` | `Array` | no |  | Des adresses e-mail pour une copie cachée. |
| `reply` | `Array` | no |  | Des adresses e-mail pour les réponses. |
| `priority` | `Number` | no | `3` | `1` haute, `3` normale, `5` basse. |
| `confidential` | `Boolean` | no |  | Marque l’e-mail comme confidentiel. |
| `unsubscribe` | `String` | no |  | L’adresse d’une page de désinscription. |

Returns: `Object` `{ "success": true }` quand l’e-mail est envoyé.

Les e-mails sont envoyés depuis `noreply@totaljs.com`. Une application Total.js peut envoyer tous ses e-mails via ce service : consulte [Appeler Total API depuis 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: Réponse
```json
{ "success": true }
```

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

Type: `rest`

Envoie un SMS.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `from` | `String` | yes |  | Le nom de l’expéditeur. |
| `to` | `String` | yes |  | Le numéro de téléphone avec son indicatif pays, par exemple `+421900000000`. |
| `body` | `String` | yes |  | Le message. |

Returns: `Object` `{ "success": true }` quand le message est envoyé.

Le prix d’un message peut varier.

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: Réponse
```json
{ "success": true }
```

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

Type: `rest`

Enregistre un message de journal dans la Total.js Platform.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `app` | `String` | yes |  | Le nom de l’application, jusqu’à 40 caractères. |
| `message` | `String` | yes |  | Le message, jusqu’à 500 caractères. |
| `type` | `String` | no | `info` | `info`, `warning`, `error` ou `success`. |
| `url` | `String` | no |  | Une adresse, jusqu’à 100 caractères. |
| `reference` | `String` | no |  | Une référence à toi, jusqu’à 50 caractères. |
| `data` | `String` | no |  | Des données à toi sous forme de texte JSON. |
| `ua` | `String` | no |  | Le user agent, jusqu’à 30 caractères. |
| `ip` | `String` | no |  | L’adresse IP, jusqu’à 60 caractères. |
| `userid` | `String` | no |  | L’identifiant de l’utilisateur, jusqu’à 25 caractères. |
| `username` | `String` | no |  | Le nom de l’utilisateur, jusqu’à 50 caractères. |

Returns: `Object` La réponse du service.

Une requête peut faire jusqu’à 50 Ko. Une application Total.js peut envoyer tous ses journaux d’audit à ce service : consulte [Appeler Total API depuis 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." }'
```
