Home / API Reference / Discounts
Resource
Discounts
Discount codes clients can apply when they pay, with their limits and the services they cover.
The discount object
Every discount record carries these fields in this order, after object, which is always "discount".
| Field | Type | Description |
|---|---|---|
id | integer | |
uses | integer | How many times one client can use the code; 0 = no limit. The owner and staff are not limited. |
secret | integer | 0 = public (clients and agents can use it), 1 = secret (only the owner and staff can apply it). |
expires | string, up to 10 characters | YYYY-MM-DD. Clients can no longer use the code from this day on. |
code | string, up to 256 characters | |
fixed | integer | 0 = amount is a percent, 1 = amount is a fixed sum in the account currency. |
type | integer | 0 = taken off the purchase, 1 = added to the client's balance as extra credit. |
amount | decimal | The percent (fixed 0) or the sum in the account currency (fixed 1). |
services | string, up to 4096 characters | Comma-separated ids of the services the code is limited to (see Services); empty = any service. |
Example
{
"object": "discount",
"id": 42,
"uses": 1,
"secret": 1,
"expires": "2026-12-31",
"code": "SPRING10",
"fixed": 1,
"type": 1,
"amount": 25.5,
"services": "3,5"
} List discounts
GET /api/v1/discounts
Parameters
| Parameter | In | Description |
|---|---|---|
limit | query | Records per page, 1 to 1000 (default 100). |
offset | query | Records to skip (default 0). |
Returns
A list envelope of discount records (see Pagination).
Request
curl "https://www.bizstim.com/api/v1/discounts" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/discounts');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/discounts', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "list",
"total": 2,
"limit": 100,
"offset": 0,
"has_more": false,
"data": [
{
"object": "discount",
"id": 42,
"uses": 1,
"secret": 1,
"expires": "2026-12-31",
"code": "SPRING10",
"fixed": 1,
"type": 1,
"amount": 25.5,
"services": "3,5"
},
{
"object": "discount",
"id": 43,
"uses": 1,
"secret": 1,
"expires": "2026-12-31",
"code": "SPRING10",
"fixed": 1,
"type": 1,
"amount": 25.5,
"services": "3,5"
}
]
} Retrieve a discount
GET /api/v1/discounts/{id}
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Returns
One discount record, or 404 not_found when no record with that id exists on your account.
Request
curl "https://www.bizstim.com/api/v1/discounts/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/discounts/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/discounts/42', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "discount",
"id": 42,
"uses": 1,
"secret": 1,
"expires": "2026-12-31",
"code": "SPRING10",
"fixed": 1,
"type": 1,
"amount": 25.5,
"services": "3,5"
}