# 04-Decrypt



04-Decrypt [#04-decrypt]

This decryption function can be used universally. It decrypts with an algorithm that meets the requirements of CodeVASP travel rule.

`remotePublicKey` is the value of the header's `X-Code-Req-PubKey`.

Endpoint [#endpoint]

`POST` `/api/v1/code/decrypt`

Request Parameters [#request-parameters]

Headers [#headers]

| Name         | Type   | Required | Description        |
| :----------- | :----- | :------- | :----------------- |
| accept       | string | Optional | `application/json` |
| content-type | string | Required | `application/json` |

Body Parameters [#body-parameters]

| Name            | Type   | Required | Description                                 |
| :-------------- | :----- | :------- | :------------------------------------------ |
| allianceName    | string | Required | Travel Rule protocol code (default: `CODE`) |
| data            | string | Required | Any data you want to decrypt                |
| remotePublicKey | string | Required | Counter VASP's public key                   |

Response [#response]

Fields [#fields]

| Name       | Type   | Description              |
| :--------- | :----- | :----------------------- |
| bodyString | string | Decrypted string         |
| body       | object | Decrypted ivms101 object |

Examples [#examples]

Request [#request]

```bash
curl --request POST \
     --url https://your-server-host.com/api/v1/code/decrypt \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "allianceName": "CODE",
  "remotePublicKey": "8DJomhrvr0zD11+m3nwG3ZeO9OsSY8uLHdA7WgoaX0g=",
  "data": "jf6V5hL6VxjYD6+RdMm7NIRKCrFAn4HQ5ZumHgBS7ywcczAB0jK7/hMKHQBFm1RECbKOYGXroA8h+cSvMUABof+dIzqt3intiS9qfXe2bYfq9fdpicrcyhZOHnJT3tOz3HLM1SuxXSFNHrcmrIRE4KL80uV3gRcH7Z6gtbgFhlNDzzL/"
}'
```

Response [#response-1]

```json
{
  "body": {
    "ivms101": {
      "Beneficiary": {
        "beneficiaryPersons": [],
        "accountNumber": [
          "3432fwsf3q4qweqwef"
        ]
      }
    }
  },
  "bodyString": "{\"ivms101\":{\"Beneficiary\":{\"beneficiaryPersons\":[],\"accountNumber\":[\"3432fwsf3q4qweqwef\"]}}}"
}
```
