# Count number of messages

## Service description

Use this service to get the number of pending messages. The same header values are accepted as for  [get-next-message](https://docs.lhv.com/home/connect/services/messages/get-next-message "mention") - including Filter-Response-Type and Service Provider options.

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

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

#### **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 with count of messages as Integer.

### **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/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></tbody></table>

#### Body

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

```json
{
  "count": 10
}
```

{% 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 %}
