# API Ping

Calling the ping command will keep your session ID active for another 15 minutes (unless it has already expired).

This command is only useful if you are using the *Authentication* command to get a session ID for authenticating your API requests. Session IDs expire after 15 minutes of inactivity (if no API request is made with the session ID for 15 minutes).

{% hint style="info" %}
Any API command using a session ID will cause your session ID to remain active for another 15 minutes.
{% endhint %}

You can call this API command once every 10 minutes or so to keep your session active. Should your session expire, your application needs to make a new authentication request to get a new session ID.

### **Command**

```
https://api.clickatell.com/http/ping?session_id=xxxxxxxxxxxx_
```

### **Parameters**

For this call you do not send through the usual authentication parameters. You will only send through the following parameter:

| Parameter    | Description     |
| ------------ | --------------- |
| `session_id` | Your session ID |

### **Examples**

#### **Bash**

```
session_id="place session ID here"
 
curl --data "session_id=$session_id" \
    'https://api.clickatell.com/http/ping'
```

#### **PHP**

{% code lineNumbers="true" %}

```
<?php
$session_id = urlencode("place username here");
 
echo file_get_contents("https://api.clickatell.com/http/ping"
    + "?session_id=$session_id");
?>
```

{% endcode %}

#### **Python**

{% code lineNumbers="true" %}

```
import urllib2, urllib
 
params = {
    "session_id": "place username here"
}
 
params = urllib.urlencode(params)
f = urllib2.urlopen("https://api.clickatell.com/http/ping", params)
print f.read()
```

{% endcode %}

### **API responses**

#### **Example response**

*Successful API response:*

```
OK: f6b9af2a2c9e5b18ee2d257e3def5d66
```

*Error response:*

```
ERR: 001, Authentication failed
```

#### **Format**

*Successful API response:*

```
OK: <session ID>
```

*Error response:*

```
ERR: <error code>, <error description>
```


---

# 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://help.clickatell.com/developers-api-reference/developers-archive/sms-http-s-api/api-ping.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.
