> For the complete documentation index, see [llms.txt](https://doc.antgst.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.antgst.com/introduction/authentication.md).

# Authentication

**API Key**

ANT APIs use API keys for authentication. An API key is a token that a client provides when making API calls. The key should be sent as a request body named `authSecret`

```http
POST /user/account/balance HTTP/1.1
Host: api.antgst.com
Content-Type: application/json
{
    "authSecret": "YOUR_API_KEY"
}
```

### 📘How do I get my API Key? <a href="#api-key" id="api-key"></a>

### **old:**

Log in to ANT Dashboard > SecurityCenter>AccessKeyManage and you will find it on that page.

<figure><img src="https://2101100196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsfCTZu6sIW1wdPHOrlJy%2Fuploads%2FyZSx6SZcGBozkp43ZWVn%2Fimage.png?alt=media&amp;token=0c9b5ca9-8d22-4402-b3ee-bcb2ffba6241" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2101100196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsfCTZu6sIW1wdPHOrlJy%2Fuploads%2FhEceXX1Zk1xDkvuj9Jc3%2Fimage.png?alt=media&amp;token=93b9a3b9-587b-4aac-b05d-e16b55bd2cc9" alt=""><figcaption><p>click</p></figcaption></figure>

### new:

<figure><img src="https://2101100196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsfCTZu6sIW1wdPHOrlJy%2Fuploads%2Fz1iNi5nF2Ea5gN2j1C5L%2Fimage.png?alt=media&amp;token=c5176834-1721-44b8-90ec-de237babf2b2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2101100196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsfCTZu6sIW1wdPHOrlJy%2Fuploads%2FJ4fnXcAcQbZa7qnqMtIi%2Fimage.png?alt=media&amp;token=9d20128c-d082-4fab-9786-0f93e84d6cbd" alt=""><figcaption></figcaption></figure>

### Test with cURL

[cURL](https://curl.se/) is a command-line tool and library for transferring data with URLs. Here is an example of how to retrieve your account balance authenticated with your API key:

```shell
curl --location --request POST 'https://api.antgst.com/user/account/balance' 
--header 'Content-Type: application/json' 
--data '{"authSecret": "YOUR_API_KEY"}'
```

It returns a response with HTTP status `200` if succeeded. Here is an example of the response body:

```json
{
    "msg": "SUCCESS",
    "code": 200,
    "result": {
        "smsBalance": -18.383,
        "voipBalance": 0.0,
        "currency": "CNY"
    }
}
```

Otherwise,  if the API key is invalid. Here is an example of the response body:

```json
{
    "msg": "auth secret error!",
    "code": -22
}
```
