---
source_url: https://www.pubnub.com/docs/sdks/rest-api/announce-heartbeat
title: Announce heartbeat
---

# Announce heartbeat

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

Inform Presence that a user is still active. If the user has not been seen before, they will join the channel and send a join event.

* Heartbeat has no functional effect on the performance or integrity of the client itself. It's only provided for Presence functionality. * Heartbeat is the mechanism used to "ping" back from the client to the server that the client is still online. The heartbeat is only germane to the Presence service.

It affects Presence in the following ways:

* Subscribe calls and Heartbeat calls count as heartbeat signals to Presence, but only on the server RESPONSE does the heartbeat signal register. * Since a subscribe call can long poll, the server RESPONSE to the subscribe REQUEST may not be immediate (could be many minutes), so it's not always beneficial to rely on only the subscribe call as the heartbeat.
* Since the server will RESPOND immediately to the client HP REST API call REQUEST, using the heartbeat call alongside subscribe calls is the perfect method for registering heartbeats with the Presence system.

| Path Parameters |
| --- |
| `sub_key`string—**REQUIRED**Your app's subscribe key from Admin Portal.Example: sub-c-50264475-1902-558x-d213-7p19052012n2 |
| `channel`string—**REQUIRED**The channel ID to perform the operation on. In the context of Presence, this parameter relates to a channel for which the new state will be applied or the existing state will be returned. Verify that channels are comprised of valid characters. You can use a single channel or multiple channels separated by a comma.Example: myChannel |

| Query Parameters |
| --- |
| `channel-group`stringComma-separated list of channel group names to perform the operation on. In the context of Presence, this parameter relates to channel group name(s) to which you subscribe. You may subscribe to channels, channels and channel groups, or just channel groups.Note: Wildcard patterns (e.g., group.*) are not supported for channel groups. Use exact channel group names only.Example: myChannelGroup |
| `auth`stringString which is either the auth key (Access Manager legacy) or a valid token (Access Manager) used to authorize the operation if access control is enabled.Example: myAuthKey |
| `callback`stringThe JSONP callback name to wrap the function in.Example: myCallback |
| `heartbeat`integerUsed to set the presence timeout period. It overrides the default value of 300 for Presence timeout.Example: 120 |
| `state`stringWhen state is set, this value is an object with root keys associated with each channel you are setting state for. Each channel's state is an object. You must be present in a channel to set state for it.Example (SingleChannel): %7B%22channel%22%3A%7B%22text%22%3A%22hey%22%7D%7DExample (MultipleChannel): %7B%22firstchannel%22%3A%7B%22text%22%3A%22hello%22%7D%2C%22secondchannel%22%3A%7B%22age%22%3A10%7D%7D |
| `uuid`string—**REQUIRED**A UTF-8 encoded string of up to 92 characters used to identify the client.Example: myUniqueUserId |
| `signature`stringSignature used to verify that the request was signed with the secret key associated with the subscribe key.If Access Manager is enabled, either a valid authorization token or a signature are required. Check Access Manager documentation for details on how to compute the signature. |
| `timestamp`integerUnix epoch timestamp used as a nonce for signature computation. Must have no more than ± 60 seconds offset from NTP. Required if signature parameter is supplied. |

| Responses |
| --- |
| `200`SuccessSchema — OPTIONALstatus integer — OPTIONALmessage string — OPTIONALservice string — OPTIONAL | Schema—**OPTIONAL** | `status`integer—**OPTIONAL** | `message`string—**OPTIONAL** | `service`string—**OPTIONAL** |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL** |
| `message`string—**OPTIONAL** |
| `service`string—**OPTIONAL** |

sub_key
*
Type:
string
Your app's subscribe key from
[Admin Portal](https://admin.pubnub.com)
.
channel
*
Type:
string
The channel ID to perform the operation on.

In the context of Presence, this parameter relates to a channel for which the new state will be applied or the existing state will be returned.  Verify that channels are comprised of valid characters. You can use a single channel or multiple channels separated by a comma.
channel-group
Type:
string
Comma-separated list of channel group names to perform the operation on.

In the context of Presence, this parameter relates to channel group name(s) to which you subscribe. You may subscribe to channels, channels and channel groups, or just channel groups.

Note:
Wildcard patterns (e.g.,
group.*
) are not supported for channel groups. Use exact channel group names only.
auth
Type:
string
String which is either the auth key (Access Manager legacy) or a valid token (
[Access Manager](https://www.pubnub.com/docs/security/access-control/overview.md)
) used to authorize the operation if access control is enabled.
callback
Type:
string
The JSONP callback name to wrap the function in.
heartbeat
Type:
integer
Used to set the presence timeout period. It overrides the default value of
300
for Presence timeout.
state
Type:
string
When state is set, this value is an object with root keys associated with each channel you are setting state for. Each channel's state is an object. You must be present in a channel to set state for it.
uuid
*
Type:
string
A UTF-8 encoded string of up to 92 characters used to
[identify the client](https://www.pubnub.com/docs/architecture/core-concepts.md)
.
signature
Type:
string
Signature used to verify that the request was signed with the secret key associated with the subscribe key.

If Access Manager is enabled, either a valid authorization token or a signature are required.

Check
[Access Manager documentation](https://www.pubnub.com/docs/sdks/rest-api/access-manager-introduction.md)
for details on how to compute the signature.
timestamp
Type:
integer
Unix epoch timestamp used as a nonce for signature computation. Must have no more than ± 60 seconds offset from NTP.

Required if
signature
parameter is supplied.
status
Type:
integer
Example:
200
message
Type:
string
Example:
"OK"
service
Type:
string
Example:
"Presence"
Example Response

```
{
  "status": 200,
  "message": "OK",
  "service": "Presence"
}
```
