1) Introduction
The Trumeter Stock API provides secure, read-only access to distributor stock availability. It allows approved users to check stock levels for a specific item across configured warehouse regions.
- Check stock availability by item ID
- View stock across supported warehouse regions such as USA, UK, and MY
- Use secure token-based API authentication
- Track usage through quota headers
2) Getting Started
Step 1 – Request API Access
- Contact Trumeter to request Stock API access.
- Provide the distributor email address that should be linked to the API token.
- Trumeter will create an API token and assign a monthly quota.
Step 2 – Receive Your API Token
Your token will be provided by Trumeter. Keep it secure and do not share it publicly.
Use the token in the request header:
X-Authorization: Bearer <your_token_here>
Step 3 – Query Stock by Item ID
Send a GET request to the stock endpoint and include the item ID as a query parameter.
GET /api/getStock?item=020973-01
Step 4 – Review Quota Headers
Successful requests return quota details in response headers.
- X-Quota-Limit monthly quota limit
- X-Quota-Used quota used this month
- X-Quota-Remaining remaining quota
- X-Quota-Period-Start quota period start date
3) Using the API
Base URL:
https://stock.cloud.trumeter.com
Stock Lookup
curl -X GET "https://stock.cloud.trumeter.com/api/getStock?item=020973-01" \
-H "X-Authorization: Bearer <your_token_here>"
Python Example
import requests
token = "<your_token_here>"
item = "020973-01"
url = f"https://stock.cloud.trumeter.com/api/getStock?item={item}"
headers = {
"X-Authorization": f"Bearer {token}"
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
Successful Response
{
"data": {
"item": "020973-01",
"stock": {
"US": 0,
"GB": 1675,
"MY": 195
}
}
}
If a region does not have stock data for the item, it is also returned as 0.
4) Query Parameters
| Parameter | Required | Description | Example |
|---|---|---|---|
| item | Yes | The item ID to search for. | 020973-01 |
5) Error Responses
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHORIZED | Token is missing, invalid, inactive, or expired. |
| 422 | INVALID_REQUEST | The item query parameter is missing or invalid. |
| 404 | ITEM_NOT_FOUND | No stock record was found for the requested item. |
| 429 | QUOTA_EXCEEDED | The token has exceeded its monthly quota. |
| 503 | DATA_UNAVAILABLE | Stock data could not be loaded from storage. |
Example Error
{
"error": {
"code": "ITEM_NOT_FOUND",
"message": "No stock record found for item.",
"item": "UNKNOWN-ITEM"
}
}
6) Additional Notes
- The API is read-only.
- Each successful stock lookup consumes one quota unit.
- Quota usage resets monthly.
- Tokens must be kept private and should not be embedded in public websites.
- Item IDs are limited to 128 characters.