# Mark batch of messages as processed V2

## Service description

The V2 version of this endpoint allows you to manage the processed state of each message, enabling "undeleting." To **delete** a message, set `messageProcessed` to **true.**

Successful call returns a `204 NO CONTENT` status.

{% hint style="info" %}
Messages older than a week marked as processed may be permanently archived. In such cases, undeleting is not possible.
{% endhint %}

## Request <a href="#virtual-iban-open" id="virtual-iban-open"></a>

<mark style="color:purple;">`PATCH`</mark> <https://connect.lhv.com/v2/messages/processed>

#### **Headers**

<table><thead><tr><th width="165">Name</th><th width="181">Value</th><th>Description</th></tr></thead><tbody><tr><td>Client-Code</td><td><code>customer value</code></td><td>For Service Providers only. Company registration code of the Service Provider or its customer. When using the Service Provider own value also related customers messages are returned by default - see also Filter-Service-Provider for more options.</td></tr><tr><td>Client-Country</td><td><code>customer value</code></td><td>For Service Providers only. Should match the value of Client-Code</td></tr></tbody></table>

#### **Body**

JSon array

{% tabs %}
{% tab title="Undelete messages" %}
{% hint style="info" %}
List of message Id's and new statuses
{% endhint %}

```json
{
	"messages": [
		{
			"messageProcessed": false,
			"messageResponseId": "RES8ab5c77b6dc64dcb8adcf345bcb7284c"
		},
        {
			"messageProcessed": false,
			"messageResponseId": "RES16052c3eecc147a2b4a64043b45cd0da"
		},
        {
			"messageProcessed": false,
			"messageResponseId": "RESad774a99f69e4509a1227013fa372851"
		}
	]
}
```

{% endtab %}

{% tab title="Delete messages" %}
{% hint style="info" %}
List of message Id's and new statuses
{% endhint %}

```json
{
	"messages": [
		{
			"messageProcessed": true,
			"messageResponseId": "RES8ab5c77b6dc64dcb8adcf345bcb7284c"
		},
        {
			"messageProcessed": true,
			"messageResponseId": "RES16052c3eecc147a2b4a64043b45cd0da"
		},
        {
			"messageProcessed": true,
			"messageResponseId": "RESad774a99f69e4509a1227013fa372851"
		}
	]
}
```

{% endtab %}
{% endtabs %}

### **Response**

**Headers**

<table><thead><tr><th width="241">Name</th><th width="186">Value</th><th>Description</th></tr></thead><tbody><tr><td>X-Bank-Code</td><td><code>LHVUK</code>, <code>LHVEE</code></td><td>LHV Bank entity</td></tr></tbody></table>

#### Body

{% tabs %}
{% tab title="204 - updated" %}
{% hint style="success" %}
OK

Statuses updated
{% endhint %}

```json
No body
```

{% endtab %}

{% tab title="400 - not updated" %}
{% hint style="danger" %}
Bad request

No messages updated
{% endhint %}

```json
{
    "errors": [
        {
            "errorCode": "BAD_REQUEST",
            "description": "Invalid Message-Request-Id: RES8ab5c77b6dc64dcb8adcf345bcb7284cx"
        }
    ]
}
```

{% endtab %}

{% tab title="403 - error" %}
{% hint style="danger" %}
Error code and description
{% endhint %}

<pre><code>&#x3C;Errors>
<strong>    &#x3C;Error>
</strong>        &#x3C;ErrorCode>FORBIDDEN&#x3C;/ErrorCode>
        &#x3C;Description>User doesn't exist&#x3C;/Description>
    &#x3C;/Error>
&#x3C;/Errors>
</code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lhv.com/home/connect/services/messages/mark-batch-of-messages-as-processed-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
