Torgify Partner API v1.0
Seamlessly integrate third-party billing software, ERP systems, and order managers with Torgify marketplace.
Introduction
The Torgify Partner API allows pre-approved logistics, invoicing, and inventory partners to read listings, publish products, update inventory, and manage order statuses on behalf of connected sellers.
All actions are scoped specifically to the sellers who have securely authorized your partner account via a Connect Code.
Authentication
All Partner API calls must contain the following HTTP headers for secure credential validation:
| Header Name | Type | Description |
|---|---|---|
| X-Partner-Key | String | Your unique, permanent public key (e.g. tpk_4ef12...). |
| X-Partner-Secret | String | Your raw, private secret token generated by the admin dashboard. Do not expose this token! |
X-Partner-Secret in frontend code or client-side bundles.
Webhook Signatures
Torgify triggers automated webhook POST payloads to your registered Webhook URL for events like order.created. To ensure the authenticity of the webhook payload, you must compute and verify the signature hash.
Torgify includes an X-Torgify-Signature header in all webhook HTTP requests. This signature is generated as an HMAC-SHA256 hash using the raw JSON body string as the payload and your public X-Partner-Key as the secret key.
PHP Verification Example
<?php
$payload = file_get_contents('php://input');
$receivedSignature = $_SERVER['HTTP_X_TORGIFY_SIGNATURE'] ?? '';
$partnerKey = 'YOUR_X_PARTNER_KEY'; // Use as secret
$computedSignature = hash_hmac('sha256', $payload, $partnerKey);
if (hash_equals($computedSignature, $receivedSignature)) {
// Webhook is authentic! Process event safely.
$data = json_decode($payload, true);
http_response_code(200);
} else {
// Signature validation failed! Rejected.
http_response_code(401);
}
?>
const crypto = require('crypto');
// Express route example
app.post('/webhook', (req, res) => {
const payload = JSON.stringify(req.body);
const receivedSig = req.headers['x-torgify-signature'];
const partnerKey = 'YOUR_X_PARTNER_KEY';
const computedSig = crypto
.createHmac('sha256', partnerKey)
.update(payload)
.digest('hex');
if (computedSig === receivedSig) {
// Authentic webhook
res.sendStatus(200);
} else {
// Invalid signature
res.sendStatus(401);
}
});
GET Get Listings
Fetches all active listings and stock quantities for a specific connected seller.
Query Parameters / POST Payload
| Parameter | Type | Required | Description |
|---|---|---|---|
| seller_id | String | Yes | The unique ID of the connected seller. |
curl -X GET "https://torgify.com/php/api.php?action=partner_get_listings&seller_id=SELLER_ID" \ -H "X-Partner-Key: YOUR_PARTNER_KEY" \ -H "X-Partner-Secret: YOUR_PARTNER_SECRET"
fetch('/php/api.php?action=partner_get_listings&seller_id=SELLER_ID', {
headers: {
'X-Partner-Key': 'YOUR_PARTNER_KEY',
'X-Partner-Secret': 'YOUR_PARTNER_SECRET'
}
})
.then(res => res.json())
.then(data => console.log(data));
POST Add Listing
Adds a new product catalog listing on behalf of a connected seller. Added products will be pending moderator approval by default.
Required Payload Parameters (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| seller_id | String | Yes | Unique ID of connected seller. |
| title | String | Yes | Title/name of the product. |
| price | Number | Yes | Sale price in Rupees (INR). |
| stock | Number | No | Initial stock quantity. Use -1 for unlimited. |
| brand | String | No | Product brand label. |
curl -X POST "https://torgify.com/php/api.php?action=partner_add_listing" \
-H "X-Partner-Key: YOUR_PARTNER_KEY" \
-H "X-Partner-Secret: YOUR_PARTNER_SECRET" \
-H "Content-Type: application/json" \
-d '{
"seller_id": "SELLER_ID",
"title": "Fresh Apples Box",
"price": 450,
"stock": 25,
"brand": "ORGANIC-FARM"
}'
{
"seller_id": "848a609d-cb90-48b4-82ee-673e445025f8",
"title": "Fresh Apples Box",
"description": "Premium Quality Himachal Apples, 5Kg box",
"price": 450,
"mrp": 550,
"stock": 25,
"brand": "ORGANIC-FARM",
"price_unit": "Box",
"search_tags": "apples, fresh, fruit"
}
POST Update Listing
Modifies fields of an existing catalog product listing owned by the seller.
Payload Details (JSON)
{
"seller_id": "SELLER_ID",
"id": "LISTING_ID",
"price": 480,
"stock": 18,
"is_active": 1
}
POST Update Inventory (Bulk)
Fast-track inventory updater. Recommended for syncing stock and pricing from third-party POS / barcode scanners.
{
"seller_id": "SELLER_ID",
"items": [
{ "id": "listing_id_1", "stock": 45, "price": 120 },
{ "id": "listing_id_2", "stock": 0 }
]
}
curl -X POST "https://torgify.com/php/api.php?action=partner_update_inventory" \
-H "X-Partner-Key: YOUR_PARTNER_KEY" \
-H "X-Partner-Secret: YOUR_PARTNER_SECRET" \
-H "Content-Type: application/json" \
-d '{
"seller_id": "SELLER_ID",
"items": [
{ "id": "993fe01c-...", "stock": 100 }
]
}'
GET Get Orders
Fetches the recent 200 orders received by a connected seller.
POST Update Order Status
Updates an order status. Valid status state transitions are: confirmed, ready_for_pickup, collected, completed, and cancelled.
Payload Details (JSON)
{
"seller_id": "SELLER_ID",
"order_id": "ORDER_ID",
"status": "ready_for_pickup"
}
Webhook Signature Sandbox Simulator
Test the signature hashing locally! Enter a JSON payload and your key to see what signature will be outputted by Torgify.