Rules
GARAN rules give all matching products a producer guarantee in years. Pro and Agency.
The API is built and tested. Hosting at api.garanify.com is in preparation; until then it runs locally. Keys are available on request.
List rules
GET /v1/shops/{shop}/rules
Key: Secret key
Parameters
| Name | In | Type | Description |
|---|---|---|---|
shoprequired | path | string | Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$ |
Request
curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY"import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const rules = await garanify.rules.list();<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$rules = $garanify->rules->list();import os, requests
res = requests.get(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
timeout=10,
)
res.raise_for_status()
data = res.json()Try it GET /v1/shops/{shop}/rules
Response 200 application/json
{
"data": [
{
"match": {
"brand": "Bosch"
},
"years": 5
},
{
"match": {
"category": "Coffee machines"
},
"years": 3
}
]
} Responses
200Rules in order. The first matching rule applies. ·RuleList401Key missing, invalid, expired or revoked. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem
Replace all rules
PUT /v1/shops/{shop}/rules
Key: Secret key
Replaces the ordered list of rules. Product values always win over rules. Pro and Agency; on Free, existing rules stay in effect but cannot be changed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
shoprequired | path | string | Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$ |
Body
| Name | Type | Description |
|---|---|---|
datarequired | Rule[] | 0–200 items |
data[].matchrequired | RuleMatch | All given conditions must match (case-insensitive). A category condition also matches parent categories. |
data[].yearsrequired | number | > 2, ≤ 99, × 0.5 |
Request
curl -X PUT "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules" \
-H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"data":[{"match":{"brand":"Bosch"},"years":5},{"match":{"category":"Coffee machines","tag":"premium"},"years":3}]}'import { Garanify } from '@garanify/sdk';
const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const rules = await garanify.rules.replace([
{
match: {
brand: 'Bosch'
},
years: 5
},
{
match: {
category: 'Coffee machines',
tag: 'premium'
},
years: 3
}
]);<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$rules = $garanify->rules->replace([
[
'match' => [
'brand' => 'Bosch',
],
'years' => 5,
],
[
'match' => [
'category' => 'Coffee machines',
'tag' => 'premium',
],
'years' => 3,
],
]);import os, requests
res = requests.put(
"https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/rules",
headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
json={
"data": [
{
"match": {
"brand": "Bosch",
},
"years": 5,
},
{
"match": {
"category": "Coffee machines",
"tag": "premium",
},
"years": 3,
},
],
},
timeout=10,
)
res.raise_for_status()
data = res.json()Try it PUT /v1/shops/{shop}/rules
Responses
200Stored rules. ·RuleList401Key missing, invalid, expired or revoked. ·Problem403Plan, key type or origin does not allow the request. ·Problem422The request does not match the schema. ·Problem429Too many requests. Wait `Retry-After` seconds. ·Problem