# ACCOUNT

## API Get Balance

&#x20;       You can check the user's credits, which have 2 type of accounting; Prepaid and Postpaid

### Sequence Diagram

![Sequence Diagram (API Balance)](https://1969967505-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1Zi-GfP5csjMyyZS2D%2F-M1yIhsflTgm2ZSSzXX-%2F-M1ywvXlT7rBSVbfwSEh%2Facc.png?alt=media\&token=a3238a5b-9caf-40da-bc1a-23fefe2596f1)

{% tabs %}
{% tab title="Request" %}
**You can start creating HTTP request as this following:**

| Header             | description                                                                                                |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| HTTP Request (URL) | <https://api-service.ants.co.th/account/balance>                                                           |
| HTTP Headers       | <p>Content-Type: application/json</p><p>Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</p> |
| HTTP Methods       | POST                                                                                                       |

**Request example (method : Post)**

```
HTTP Request (URL): https://api-service.ants.co.th/account/balance
```

{% endtab %}

{% tab title="Response" %}
**Response**

| Parameter | type   | description        |
| --------- | ------ | ------------------ |
| type      | string | Type of accounting |
| credit    | number | Amount of credits  |

**Response JSON format**

```
{
    "type": "postpaid",
    "credit": 167.
```

{% endtab %}
{% endtabs %}

### **Response Status**

Using API; your system will get the response in return of different status. So, the system will understand what the reason on particular activity is. In order to tackle and apply different solution at the right cause.

### **HTTP Status Code**

If successful, response header HTTP status code will be `200 OK` and the message logs will be returned. If you try to send a message without authorization, you will get a response with HTTP status code `401 Unauthorized`.

If you are using this method too many times in a short period, you will get status code `429 Too Many Requests`. This prevents misusing logs in cases where reports would be more appropriate.
