# How to send encrypted message using API?

**URL:** <https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645>\
**Category:** Ardor and Nxt Wallet Users\
**Created:** [26 January 2022 20:45 UTC](https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645 "2022-01-26T20:45:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suivew](https://talk.jelurida.com/letter_avatar_proxy/v4/letter/s/a587f6/32.png) [@suivew](https://talk.jelurida.com/u/suivew)\
**Post date:** [26 January 2022 20:45 UTC](https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645/1 "2022-01-26T20:45:36Z")

</div>

The JSON response I got show origin message in plain text if I use "messageToEncrypt:true",

```
    "attachment": {
        "version.Message": 1,
        "messageIsText": true,
        "message": "test",
        "encryptedMessage": {
            "data": "724a76811fd543a28d87cb10c9b4b397c036acffe8ebc271759875b7691bcb33810f18e60fbb9a63f24fb80410642c63",
            "nonce": "a92506bb2bb3b108902e4209c109c6374f1b910ef9796f0232595344cbdc1f19",
            "isText": true,
            "isCompressed": true
        },
        "version.ArbitraryMessage": 0,
        "version.EncryptedMessage": 1
    },

```

The encrypted message send by wallet didn't show the plain text. Thanks

---

<div class="post-metadata">

**Author:** ![suivew](https://talk.jelurida.com/letter_avatar_proxy/v4/letter/s/a587f6/32.png) [@suivew](https://talk.jelurida.com/u/suivew)\
**Post date:** [28 January 2022 20:03 UTC](https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645/2 "2022-01-28T20:03:22Z")

</div>

The question should be:  
How to send an encrypted message using API without showing the message in plain text in attachment?

---

<div class="post-metadata">

**Author:** ![petko.petkov](https://talk.jelurida.com/letter_avatar_proxy/v4/letter/p/eb8c5e/32.png) [@petko.petkov](https://talk.jelurida.com/u/petko.petkov)\
**Post date:** [9 February 2022 14:28 UTC](https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645/3 "2022-02-09T14:28:14Z")

</div>

If it's not a problem for you to send the original message to the server, i.e. you problem is only that the server returns the original message after you've send it to it, then you can call the `encryptTo` API first and then provide the result as `encryptedMessageData` and `encryptedMessageNonce` parameters and not use the `message` and `messageToEncrypt` parameters. You won't get the original message in response, e.g.

```
    "attachment": {
        "encryptedMessage": {
            "data": "84a0e755146148050d6efd8f2593df346fa9b9485eb2b68f4efe048f53100280647d76dcea18ae6d8ef497b1889e363c",
            "nonce": "e62d503a4d8c24b73841e0a27f649d844b3c82db8e4bbb0b4363fe6f0d588da2",
            "isText": true,
            "isCompressed": true
        },
        "version.OrdinaryPayment": 0,
        "version.EncryptedMessage": 1
    }

```

If your problem is also that the original message is sent to the server, then you need to calculate locally the data and nonce and again provide them as `encryptedMessageData` and `encryptedMessageNonce`

---

<div class="post-metadata">

**Author:** ![suivew](https://talk.jelurida.com/letter_avatar_proxy/v4/letter/s/a587f6/32.png) [@suivew](https://talk.jelurida.com/u/suivew)\
**Post date:** [10 February 2022 01:20 UTC](https://talk.jelurida.com/t/how-to-send-encrypted-message-using-api/645/4 "2022-02-10T01:20:20Z")

</div>

Thanks!
