API integration
The API integration allows vendors without a supported e-commerce platform to connect with a Garnet marketplace via a REST API. Vendors can push products, update prices and stock, submit tracking information, and receive orders via webhook.
Integration scope
- ✅ Product synchronization (push from vendor)
- ✅ Price and stock updates
- ✅ Order synchronization (webhook to vendor)
- ✅ Tracking synchronization (push from vendor)
Authentication
All API requests must include a Bearer token in the Authorization header. The API key is provided when the marketplace admin creates the integration in Garnet > Settings > Integrations > API.
Authorization: Bearer your_api_keyBase URL: https://api.garnetmarketplace.com
Quick start
Here is a full example: create a pineapple product, then update its stock.
Step 1 — Create the product:
Full curl command
bash
curl -X POST https://api.garnetmarketplace.com/products \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"externalId": "pineapple-001",
"title": "Fresh Pineapple",
"descriptionHtml": "<p>Sweet and juicy tropical pineapple, hand-picked at peak ripeness.</p>",
"productType": "Fruits",
"tags": ["tropical", "fresh", "fruit"],
"variants": [
{
"sku": "PINE-SINGLE",
"price": 4.99,
"inventoryQuantity": 120,
"weight": { "value": 900, "unit": "GRAMS" }
}
],
"images": [
{ "src": "https://images.unsplash.com/photo-1550258987-190a2d41a8ba?w=800", "alt": "Fresh pineapple" }
]
}'Response:
json
{ "productId": "gid://shopify/Product/123456789" }Step 2 — Update stock and price:
Full curl command
bash
curl -X PATCH https://api.garnetmarketplace.com/products \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '[
{ "sku": "PINE-SINGLE", "price": 3.99, "stock": 85 }
]'Response:
json
{ "updated": 1, "unknownSkus": [] }Reference
- Products: create products, then update their price and stock.
- Tracking: fulfill an order with its tracking number.
- Order webhooks: receive orders in the vendor's system.
Error responses
All endpoints return JSON errors in the following format:
json
{ "error": "Error message describing what went wrong" }| Status | Description |
|---|---|
| 400 | Invalid request (validation error) |
| 401 | Invalid or missing API key |
| 404 | Resource not found |
| 500 | Server error |