Source: https://leadping.ai/docs/api-reference/notifications/get-unread-notifications-for-current-user

# Get unread notifications for current user

Returns the current user’s unread notification count for badge updates and notification center state.

## Endpoint

**GET** `/notifications/unread-count`

## Request examples

### cURL

```bash
curl --request GET \
  --url https://api.leadping.ai/notifications/unread-count \
  --header 'Authorization: Bearer <token>'
```

### Python

```python
import requests

url = "https://api.leadping.ai/notifications/unread-count"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://api.leadping.ai/notifications/unread-count");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);
```

### Java

```java
HttpResponse<String> response = Unirest.get("https://api.leadping.ai/notifications/unread-count")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### JavaScript

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.leadping.ai/notifications/unread-count', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.leadping.ai/notifications/unread-count"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.leadping.ai/notifications/unread-count",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

## Authorizations

### Authorization

- **Type:** `string`
- **Location:** `header`
- **Required**

Authorization header using the Bearer scheme. Accepted values are Leadping user JWT access tokens and WorkOS organization API keys beginning with `sk_`.

## Response

Returns the `int`.

**Content type:** `application/json`

The response is of type `integer<int32>`.

### 200

```text
123
```

### 400

```json
{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request could not be completed."
}
```

### 401

```json
{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "detail": "The request could not be completed."
}
```

### 429

```json
{
  "type": "about:blank",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "The request could not be completed."
}
```

### 500

```json
{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "The request could not be completed."
}
```

[Previous: List notifications for current user](https://leadping.ai/docs/api-reference/notifications/list-notifications-for-current-user)

[Next: Mark a current-user notification as read](https://leadping.ai/docs/api-reference/notifications/mark-a-current-user-notification-as-read)
