API Documentation
Integrate our Credit Billing System into your own projects. Follow this guide to securely connect and manage billing actions.
Introduction
Welcome to the API reference. Our API is built on REST principles and uses JSON for all requests and responses.
The base URL for all API endpoints is https://thoughtsit.com/api/v1.
Authentication
All API requests require authentication using an API Key. You must pass your site's unique API Key with every request. Keep your API key secure and do not share it in client-side code.
You can provide the API key in two ways:
- Header:
X-Billing-API-Key: YOUR_API_KEY(Recommended) - Query / Body Parameter:
api_key=YOUR_API_KEY
Check Credit Balance
Retrieve the current credit balance and active status of your site. This is useful for verifying if an action can be performed before attempting it.
Example Response (200 OK):
{
"site": "My E-commerce Store",
"has_credit": true,
"balance": 150.50
}
Deduct Credit
Deduct a specific amount of credits from a client's account when a billable action is performed (e.g., an order is placed).
Request Body Parameters:
| Parameter | Type | Description |
|---|---|---|
| amount | Numeric Optional | The amount of credit to deduct. If omitted, the system will automatically use the default Deduction Per Order amount configured by the administrator for your specific site. |
Example Request Body:
{
"amount": 5
}
Example Response (200 OK):
{
"success": true,
"balance": 145.50
}
Error Codes
If an error occurs, the API will return standard HTTP status codes along with a JSON response containing an error key detailing the issue.
Bad Request
API Key is required - You must provide your API Key via Header or request parameters.
Unauthorized
Invalid API Key - The provided API Key does not match any registered client site.
Forbidden
API access is disabled for this site - Your site's API access has been temporarily suspended or marked as inactive by the administrator.
Internal Server Error
Transaction failed - An unexpected error occurred while processing the credit deduction.
Changelog
Dynamic Deductions & API Access Control
Introduced dynamic site-specific configurations and improved access control.
- Dynamic Deduction: The
amountparameter in/deduct-creditis now optional. If omitted, it uses the specific deduction amount set by the admin for that site. - API Access Toggle: Admins can now toggle a site's status (Active/Inactive) independently of its credit balance.
- New 403 Error: Inactive sites will now receive a
403 Forbiddenresponse when attempting API calls.
July 21, 2026
Initial Release
Core API features launched.
- Added
/check-creditendpoint. - Added
/deduct-creditendpoint with a hardcoded default deduction of 2. - API Key authentication support via Header and Request Parameters.