API reference · Products
Update product images (by product code)
Replaces the product's image list (up to 12) and, optionally, its variant images; works exactly like UpdateProductImages.
https://out.stockmount.com/api/Product/UpdateProductImagesByCode
The product is identified by ProductId; if ProductId is less than 1, by Code + ProductSourceId. UpdateProductImages and UpdateProductImagesByCode run the same code and accept the same fields; they behave identically.
Each call updates a single product; you cannot send several products in one call.
The image list is replaced as a whole: existing images that are not in the request are removed, new ones are added, and the product's image slots 1–12 are rewritten in request order. Unused slots are cleared.
If any item after the first has neither Url nor Base64, the call fails with 99999.
Base64 images are uploaded to the StockMount image server and the stored URL starts with http://. If the upload fails, the image is stored with an empty URL and no error is returned.
This call does not check image format or protocol. Some marketplaces reject non-http(s) URLs or .webp images when a listing is sent (70016, 70015); those errors appear during marketplace submission, not in this call.
The response does not reflect whether variant images were saved: Result: true can be returned even if a variant image could not be stored.
This call does not queue a marketplace update. The images are marked as manually edited, so later imports from the product source (XML/feed) do not overwrite them.
The application enforces no separate request-size limit for this endpoint. Base64 images make the request large; prefer Url where you can.
Accounts without an active Product package get error 70018; if the package cannot be verified, 99999 is returned.
Request fields
| Field | Type | Description |
|---|---|---|
ApiCode
required
|
string |
The API code returned by User/DoLogin.
|
ProductId
|
integer |
StockMount product ID. If less than 1, the product is looked up by Code + ProductSourceId.
|
Code
|
string |
Product code. Required when ProductId is not sent.
|
ProductSourceId
|
integer |
Product source ID (GetProductSources). Required when looking up by Code.
|
Images
required
|
object[] |
The product's new image list. At least one item is required and the first item must have Url or Base64. At most 12 images are used; the rest are ignored. Order is the array order; the first image is the main image. The Order field on items is not read.
|
Images[].
Url
|
string |
Image URL, up to 512 characters. If it starts with //, http: is prepended. Format and protocol are not checked by this call.
|
Images[].
Base64
|
string |
Used when Url is empty. Raw Base64 image data without a data: prefix. PNG and JPEG are recognised; anything else is saved with a .png extension.
|
Variants
|
object[] | Optional variant images. A listed variant with no image gets its image cleared. Variants not in the list are not touched. |
Variants[].
ProductVariantId
|
integer |
Variant ID. If omitted or 0, the variant is matched by Code.
|
Variants[].
Code
|
string |
Variant code. Used for matching when ProductVariantId is not set.
|
Variants[].
ImageUrl
|
string |
Variant image URL, up to 512 characters. If it contains XML-special characters such as & or <, the variant image is not saved and no error is returned.
|
Variants[].
ImageBase64
|
string |
Used when ImageUrl is empty. Raw Base64 image data without a data: prefix.
|
Response fields (Response)
| Field | Type | Description |
|---|---|---|
Response
|
integer |
Response is the ID of the updated product itself (a number).
|
Error codes for this endpoint
| Code | When |
|---|---|
00003 |
ProductId is less than 1 and Code is empty (ProductId is missing), Code is set but ProductSourceId is less than 1 (ProductSourceId is missing), or Images is empty or its first item is empty (Images is missing). |
70005 |
No product was found for Code + ProductSourceId. The text is in Message, not ErrorMessage (Product could not be found). |
70018 |
Your account has no active Product package. |
99999 |
Images could not be saved (Operation failed!), an item after the first is empty, Base64 is invalid, or an unexpected server error occurred. |
For session errors (00001, 00006) and every other code see error codes.
Related endpoints
Example request
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
}
curl -X POST 'https://out.stockmount.com/api/Product/UpdateProductImagesByCode' \
-H 'Content-Type: application/json' \
-d '{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
}'
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var json = """
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
}
""";
var response = await http.PostAsync(
"https://out.stockmount.com/api/Product/UpdateProductImagesByCode",
new StringContent(json, Encoding.UTF8, "application/json"));
var result = await response.Content.ReadAsStringAsync();
// Result == false ise ErrorCode ve ErrorMessage alanlarına bakın.
Console.WriteLine(result);
<?php
$body = <<<'JSON'
{
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
}
JSON;
$ch = curl_init('https://out.stockmount.com/api/Product/UpdateProductImagesByCode');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$result['Result']) {
echo $result['ErrorCode'] . ' ' . $result['ErrorMessage'];
}
import requests
payload = {
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
}
response = requests.post("https://out.stockmount.com/api/Product/UpdateProductImagesByCode", json=payload, timeout=60)
result = response.json()
if not result["Result"]:
print(result["ErrorCode"], result["ErrorMessage"])
const payload = {
"ApiCode": "API_CODE",
"Code": "TSHIRT-RED",
"ProductSourceId": 3051,
"Images": [
{
"Url": "https://cdn.example.com/p/184522-1.jpg"
},
{
"Base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
}
],
"Variants": [
{
"ProductVariantId": 9120344,
"ImageUrl": "https://cdn.example.com/p/184522-red-m.jpg"
}
]
};
const response = await fetch("https://out.stockmount.com/api/Product/UpdateProductImagesByCode", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const result = await response.json();
if (!result.Result) {
console.error(result.ErrorCode, result.ErrorMessage);
}
Example response
{
"Result": true,
"Response": 184522
}
Try it
The request goes straight from your browser to out.stockmount.com. The ApiCode is not stored by this site; it is kept only while this tab is open.
Get an ApiCode before sending requests.
This endpoint changes real data in your account.
Recent requests
Requests sent from this tab; click one to load its body again.