Skip to content

Commit 01c1e3f

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-500: docs: add faq page for billing endpoint
1 parent a04de80 commit 01c1e3f

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@
410410

411411
## FAQ
412412

413+
* [Can I get my billing info via API request?](faq/can-i-get-my-billing-info-via-api-request.md)
413414
* [Can I use API in Python?](faq/can-i-use-api-in-python.md)
414415
* [Can I use API in NodeJS?](faq/can-i-use-api-in-nodejs.md)
415416
* [What are the Pro Models?](faq/pro-models.md)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
icon: circle-question
3+
---
4+
5+
# Can I get my billing info via API request?
6+
7+
Yes, you can query your account balance and other billing details through the AIML Billing API.
8+
9+
## Get account balance info
10+
11+
<mark style="color:green;">`GET`</mark> `https://billing.aimlapi.com/v1/billing/balance`
12+
13+
14+
15+
**Headers**
16+
17+
| Name | Value |
18+
| ------------- | ------------------ |
19+
| Authorization | `Bearer <token>` |
20+
| Content-Type | `application/json` |
21+
22+
**Body**
23+
24+
**-**
25+
26+
## Code Example
27+
28+
{% tabs %}
29+
{% tab title="HTTP" %}
30+
```http
31+
GET /v1/billing/balance HTTP/1.1
32+
Host: billing.aimlapi.com
33+
Authorization: Bearer <YOUR_AIMLAPI_KEY>
34+
Content-Type: application/json
35+
```
36+
{% endtab %}
37+
38+
{% tab title="cURL" %}
39+
```url
40+
curl https://billing.aimlapi.com/v1/billing/balance \
41+
-H "Authorization: Bearer <YOUR_AIMLAPI_KEY>" \
42+
-H "Content-Type: application/json"
43+
```
44+
{% endtab %}
45+
46+
{% tab title="Python" %}
47+
{% code overflow="wrap" %}
48+
```python
49+
import requests
50+
import json
51+
52+
def main():
53+
response = requests.get(
54+
"https://billing.aimlapi.com/v1/billing/balance",
55+
headers={
56+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
57+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
58+
"Content-Type": "application/json",
59+
})
60+
61+
data = response.json()
62+
print(json.dumps(data, indent=2, ensure_ascii=False))
63+
64+
if __name__ == "__main__":
65+
main()
66+
```
67+
{% endcode %}
68+
{% endtab %}
69+
70+
{% tab title="JavaScript" %}
71+
{% code overflow="wrap" %}
72+
```javascript
73+
async function main() {
74+
const response = await fetch("https://billing.aimlapi.com/v1/billing/balance", {
75+
headers: {
76+
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
77+
"Content-Type": "application/json",
78+
},
79+
});
80+
81+
const data = await response.json();
82+
console.log(JSON.stringify(data, null, 2));
83+
}
84+
85+
main();
86+
```
87+
{% endcode %}
88+
{% endtab %}
89+
{% endtabs %}
90+
91+
<details>
92+
93+
<summary>Response</summary>
94+
95+
{% code overflow="wrap" %}
96+
```json5
97+
{
98+
"balance": 551564495,
99+
"lowBalance": false,
100+
"lowBalanceThreshold": 10000,
101+
"lastUpdated": "2025-11-10T10:01:56.824Z",
102+
"autoDebitStatus": "disabled",
103+
"status": "current",
104+
"statusExplanation": "Balance is current and up to date"
105+
}
106+
```
107+
{% endcode %}
108+
109+
</details>

0 commit comments

Comments
 (0)