# Get next message

## Service description

This service returns the oldest message not processed by customer. To set the messages as processed use in combination with [mark-message-as-processed](https://docs.lhv.com/home/connect/services/messages/mark-message-as-processed "mention")service.

Use additional filters where needed.

See [response-compression](https://docs.lhv.com/home/connect/fundamentals/response-compression "mention") for details on how to compress responses from this service.

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

<mark style="color:green;">`GET`</mark> <https://connect.lhv.com/messages/next>

#### **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><tr><td>Filter-Service-Provider</td><td>true / false or 1/0</td><td>Add this optional header to select service provider messages only when using Service Provider own value for Client-Code. Values: 1/true (filter is on) or 0/false (filter is off). This can be used by service providers to select only their own company messages in the queue. By default when Client-Code is the service provider itself, it returns the messages of all customers. Has no effect when Client-Code is not service provider.</td></tr><tr><td>Filter-Response-Type</td><td>CREDIT_DEBIT_NOTIFICATION, PAYMENT etc.</td><td>Add this optional header to filter specific service messages. The value can be any Message-Response-Type (e.g., ACCOUNT_STATEMENT, CREDIT_DEBIT_NOTIFICATION, PAYMENT). Using this parameter enables parallel processing of payment responses and debit-credit notifications separately. This allows immediate consumption of payment responses, even if there are thousands of pending notifications in the queue.</td></tr></tbody></table>

#### **Body**

\-

### **Response**

**Headers**

<table><thead><tr><th width="241">Name</th><th width="186">Value</th><th>Description</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/xml</code> or <code>application/json</code></td><td>Format of the message body</td></tr><tr><td>X-Bank-Code</td><td><code>LHVUK</code>, <code>LHVEE</code></td><td>LHV Bank entity</td></tr><tr><td>Client-Code</td><td><code>customer value</code></td><td>When using service provider model - customer entity related to the message</td></tr><tr><td>Client-Country</td><td><code>customer value</code></td><td>When using service provider model - customer entity related to the message</td></tr><tr><td>Message-Request-Id</td><td>random string</td><td>Message-Request-Id from the the original request. There are cases where request id can be missing, for example the Debit Credit Notification.</td></tr><tr><td>Message-Response-Id</td><td>random string</td><td>Unique response id</td></tr><tr><td>Message-Response-Type</td><td>CREDIT_DEBIT_NOTIFICATION, PAYMENT etc.</td><td>Type of the response depending on the service.</td></tr></tbody></table>

#### Body

{% tabs %}
{% tab title="200 - next message" %}
{% hint style="success" %}
OK
{% endhint %}

```
Content depends on the service - see specifications of different services.
```

{% endtab %}

{% tab title="204 - no more messages" %}
{% hint style="info" %}
No content
{% endhint %}

{% 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/get-next-message.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.
