# SMS API authentication

You can authenticate an API request by sending your username, password and API ID as GET parameters by opening a URL in your browser as shown below\.If you would like to avoid sending your username and password with every API request, you can use a session ID. This command can be used to generate the session ID. The session ID will expire after 15 minutes of inactivity and you will have to call this API verification command again to create a new session ID. Alternatively, you can use the [Ping ](https://app.gitbook.com/o/-LOwpcFJ9FRYexVfsFMA/s/iqAyS03eZUmNUMNCqVBc/archive/sms-http-s-api/sms-api-authentication)command about every 10 minutes to ensure that the session ID is kept alive.

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

#### **Command** <a href="#command" id="command"></a>

```
https://api.clickatell.com/http/delmsg?user=xxxx&password=xxxx&api_id=xxxx&apimsgid=xxxx
```

#### **Parameters** <a href="#parameters" id="parameters"></a>

​

| `user`     | Your API username |
| ---------- | ----------------- |
| `password` | Your API password |
| `api_id`   | Your API ID       |

#### &#x20;**SMS SPI Authentication Examples** <a href="#sms-spi-authentication-examples" id="sms-spi-authentication-examples"></a>

**Bash**

{% code lineNumbers="true" %}

```
username="place username here"
password="place password here"
api_id="place password here"
 
curl --data "user=$username&password=$password&api_id=$api_id" \
    'https://api.clickatell.com/http/auth'
```

{% endcode %}

**PHP**

{% code lineNumbers="true" %}

```
<?php
$username = urlencode("place username here");
$password = urlencode("place password here");
$api_id   = urlencode("place password here");
 
echo file_get_contents("https://api.clickatell.com/http/auth?"
    + "user=$username&password=$password&api_id=$api_id");
?>
```

{% endcode %}

**Python**

{% code lineNumbers="true" %}

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

{% endcode %}

### **API Verification 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/sms-api-authentication.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.
