Update product stock
PUT
https://api.zenoti.com/v1/products/{product_id}/stock
Updates the stock quantity for a product at a specific center.
Before you begin
Permission: Manage API Keys (under Administrator) — Required to access Zenoti APIs.
Endpoint
PUT /v1/products/{product_id}/stock
Base URL: https://api.zenoti.com
Request
Path parameters
Request body
Response
Success (200 OK)
{
"product_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"new_quantity": 50,
"error": null
}
Response fields
Example
curl --request PUT \
--url 'https://api.zenoti.com/v1/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/stock' \
--header 'Authorization: bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--data '{ "center_id": "a3614939-16c0-4a7b-bc33-a69b106d855c", "quantity": 50, "reason": "Stock replenishment" }'
const response = await fetch('https://api.zenoti.com/v1/products/{product_id}/stock', {
method: 'PUT',
headers: {
'Authorization': 'bearer {{access_token}}',
'Content-Type': 'application/json'
},
body: JSON.stringify({ center_id: 'a3614939-16c0-4a7b-bc33-a69b106d855c', quantity: 50, reason: 'Stock replenishment' })
});
const data = await response.json();
import requests
response = requests.put(
'https://api.zenoti.com/v1/products/{product_id}/stock',
headers={
'Authorization': 'bearer {{access_token}}',
},
json={'center_id': 'a3614939-16c0-4a7b-bc33-a69b106d855c', 'quantity': 50, 'reason': 'Stock replenishment'}
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var content = new StringContent(
JsonSerializer.Serialize(new { centerId = "a3614939-16c0-4a7b-bc33-a69b106d855c", quantity = 50, reason = "Stock replenishment" }),
Encoding.UTF8, "application/json");
var response = await client.PutAsync(
"https://api.zenoti.com/v1/products/{product_id}/stock", content);
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/products/{product_id}/stock')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
request['Content-Type'] = 'application/json'
request.body = { center_id: 'a3614939-16c0-4a7b-bc33-a69b106d855c', quantity: 50, reason: 'Stock replenishment' }.to_json
response = http.request(request)
data = JSON.parse(response.body)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenoti.com/v1/products/{product_id}/stock');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: bearer {{access_token}}',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['center_id' => 'a3614939-16c0-4a7b-bc33-a69b106d855c', 'quantity' => 50, 'reason' => 'Stock replenishment']));
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
Error codes