API
Türkçe

API reference · Products

Add a product

Adds a new product to a StockMount-type source and saves its variants, images and specs in the same call. The response is the new ProductId.

POST https://out.stockmount.com/api/Product/AddProduct
Changes data Product package required

Required fields are checked in this order: ProductSourceId, CurrencyId, Price (must be greater than 0), Code, Name, Category. The first missing one returns 00003 and ErrorMessage names it: ProductSourceId is missing, CurrencyId is missing, Price is missing, Code is missing, Name is missing, or just Category. If any variant has VariantValueN, the product must also have VariantNameN, otherwise VariantNameN is missing is returned.

If the source is not found in your account, 70002 (Invalid Product Source) is returned; if it is not a StockMount-type source, 70003 (Invalid Product Source Type). You can add products only to sources listed by GetProductSources.

Code is unique within the source and compared exactly. If a product with the same code already exists, nothing changes and the response is {"Result": true, "Message": "Product code already exists", "ErrorCode": "70004", "Response": <existing ProductId>}. So Result: true alone does not mean the product was added; also check ErrorCode. Codes of products deleted in the past with the retired DeleteProduct still count.

If you send UpdateProductByCode: true and the code exists in the source, the existing product is updated instead of returning 70004 (upsert). UpdateProduct rules then apply: omitted fields are cleared and images are not changed.

On success Response is the new ProductId. The new product gets status 1 (new) whatever its stock. ProductId, Status, Url, StoreId, CreationTime, Image, SoldCount and SetProductQuantityFromVariants are ignored by this call.

Images, variants and specs are saved after the product row is saved. Failures there are not reported; the call still returns Result: true. If an image upload fails, the image is stored with an empty URL. Invalid Base64 returns 99999, but the product has already been created at that point; repeating the same request then returns 70004. Check the result with GetProduct.

Variants are defined by VariantName1–VariantName6 on the product and VariantValue1–VariantValue6 on each variant (e.g. VariantName1: Color, VariantValue1: Black). The variant Code is the matching key for later updates. The product Quantity is not calculated from variant stock; send the total yourself.

This call does not run marketplace-specific checks: barcode format and special characters, mandatory brand, allowed VAT rates, webp images and catalog approval are not checked here. Those checks happen when the product is sent to a marketplace and their results appear in the StockMount panel. Codes 70012 and 70014–70017 are never returned by this call.

Length limits come from database fields and are not checked by the API; longer text is cut without an error. Error messages are in English.

Only the package error (70018) has a Turkish message.

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 Session code returned by DoLogin.
ProductSourceId required integer StockMount-type source that holds the product (GetProductSources). Returns 70002 if the source is not in your account and 70003 if it is not a StockMount-type source.
Code required string Product code (SKU). Unique within the source and compared exactly. Max 50 characters.
Name required string Product name. Max 400 characters.
Category required string Category name (not an ID). Created automatically if the source does not have it yet. See GetProductCategories for existing names.
Price required number Sale price. Must be greater than 0, otherwise 00003 (Price is missing) is returned. Stored with 2 decimals.
CurrencyId required integer Currency ID (GetCurrencies; e.g. 4 = TRY, 2 = USD, 3 = EUR). A value below 1 returns 00003. The API does not check that the ID exists, so send a valid one.
Quantity integer Stock quantity. Defaults to 0. Negative values are not rejected. For products with variants, send the total yourself; it is not calculated from variant stock.
MarketPrice number Market (list) price, usually higher than Price and used to show a discount. Defaults to 0.
TaxRate number VAT rate as a percentage (e.g. 20). The API does not enforce a list of allowed values. Stored as 0 when omitted.
Barcode string Product barcode. Max 30 characters. No format or special-character check is done.
Brand string Brand. Max 30 characters.
Model string Model. Max 30 characters.
Code2 string Secondary product code. Max 50 characters.
Mpn string Manufacturer part number (MPN). Max 50 characters.
Subtitle string Subtitle. Max 400 characters.
Description string Product description; may contain HTML. Unsafe HTML (e.g. scripts) is removed. Stored as empty when omitted.
UpdateProductDescription boolean Only matters when UpdateProductByCode turns the call into an update: false keeps the stored description. Default true.
DispatchPeriod integer Dispatch (handling) time in days. Defaults to -1 (not set).
Volume number Volume / volumetric weight (desi). Defaults to 0.
Width number Width. Defaults to 0.
Length number Length. Defaults to 0.
Height number Height. Defaults to 0.
Weight number Weight. Defaults to 0.
SellerNote string Seller note. Max 150 characters.
Price2 number Additional price field. Saved only when the product is created; UpdateProduct never changes it. Defaults to 0.
Price3 number Additional price field. Saved only when the product is created; UpdateProduct never changes it. Defaults to 0.
Price4 number Additional price field. Saved only when the product is created; UpdateProduct never changes it. Defaults to 0.
Price5 number Additional price field. Saved only when the product is created; UpdateProduct never changes it. Defaults to 0.
VariantName1 string Name of variant attribute 1 (e.g. Color). Max 30 characters. Required when any variant has VariantValue1; otherwise 00003 (VariantName1 is missing) is returned.
VariantName2 string Name of variant attribute 2 (e.g. Size). Max 30 characters. Required when any variant has VariantValue2; otherwise 00003 (VariantName2 is missing) is returned.
VariantName3 string Name of variant attribute 3 (e.g. Size). Max 30 characters. Required when any variant has VariantValue3; otherwise 00003 (VariantName3 is missing) is returned.
VariantName4 string Name of variant attribute 4 (e.g. Size). Max 30 characters. Required when any variant has VariantValue4; otherwise 00003 (VariantName4 is missing) is returned.
VariantName5 string Name of variant attribute 5 (e.g. Size). Max 30 characters. Required when any variant has VariantValue5; otherwise 00003 (VariantName5 is missing) is returned.
VariantName6 string Name of variant attribute 6 (e.g. Size). Max 30 characters. Required when any variant has VariantValue6; otherwise 00003 (VariantName6 is missing) is returned.
Images object[] Product images, up to 12 (extra items are ignored). The array order is the image order; the Order field is not used.
Images[]. Url string Image URL. Stored as sent; no format, protocol or webp check is done. A URL starting with // gets an http: prefix. Max 400 characters.
Images[]. Base64 string Used when Url is empty: the image is uploaded to StockMount's image server and stored with an http:// URL. Send raw Base64 without a data: prefix. PNG and JPEG are detected; anything else is saved with a .png extension.
Variants object[] Variant list. ProductVariantId, CurrencyId, MinSalePrice and Price2–Price5 are ignored.
Variants[]. Code string Variant code. Updates match variants by this code, so send a non-empty value that is unique within the product. Max 50 characters.
Variants[]. Barcode string Variant barcode. Leading and trailing spaces are trimmed. Max 30 characters.
Variants[]. Quantity integer Variant stock. Negative values are stored as 0.
Variants[]. Price number Variant price. Stored as 0 when omitted.
Variants[]. VariantValue1 string Value of variant attribute 1 (e.g. Black). Max 100 characters.
Variants[]. VariantValue2 string Value of variant attribute 2 (e.g. M). Max 100 characters.
Variants[]. VariantValue3 string Value of variant attribute 3 (e.g. M). Max 100 characters.
Variants[]. VariantValue4 string Value of variant attribute 4 (e.g. M). Max 100 characters.
Variants[]. VariantValue5 string Value of variant attribute 5 (e.g. M). Max 100 characters.
Variants[]. VariantValue6 string Value of variant attribute 6 (e.g. M). Max 100 characters.
Variants[]. ImageUrl string Variant image URL. Max 200 characters.
Variants[]. ImageBase64 string Used when ImageUrl is empty: the image is uploaded to StockMount's image server. Send raw Base64 without a data: prefix.
Variants[]. Code2 string Secondary variant code. Max 50 characters. If empty, the variant's position in the array (0, 1, 2…) is stored.
Variants[]. Mpn string Variant manufacturer part number. Max 50 characters.
Specs object[] Product specs (name–value pairs).
Specs[]. Name string Spec name (e.g. Material). Max 50 characters.
Specs[]. Value string Spec value (e.g. Cotton). Max 100 characters.
UpdateProductByCode boolean When true and Code already exists in the source, the existing product is updated instead of returning 70004 (upsert). Default false.

Response fields (Response)

Field Type Description
Response integer The new product's ProductId. With 70004 it is the ID of the existing product that has the same code.

Error codes for this endpoint

CodeWhen
70002 ProductSourceId is not a source in your account (Invalid Product Source).
70003 The source is not a StockMount-type source (Invalid Product Source Type).
70004 A product with the same Code exists in the source. Result is true, Response is the existing ProductId, and nothing is changed.
70005 Products could not be read for the code check (internal read failure; Message: Product could not be retreived).
70018 Your account has no active Product package (ErrorMessage is Turkish: Ürün entegrasyonu için aktif Ürün Paketi gereklidir.).
99999 An unexpected error occurred. Also returned when the product cannot be saved or a Base64 image cannot be decoded (in the latter case the product may already exist).

For session errors (00001, 00006) and every other code see error codes.

Related endpoints

Example request

{
  "ApiCode": "API_CODE",
  "ProductSourceId": 1234,
  "Code": "TSHIRT-001",
  "Name": "Basic Pamuklu Tişört",
  "Category": "Tişört",
  "Price": 249.9,
  "MarketPrice": 299.9,
  "CurrencyId": 4,
  "TaxRate": 20,
  "Quantity": 30,
  "Barcode": "8690000000017",
  "Brand": "Örnek Marka",
  "Model": "BSC-01",
  "Description": "<p>%100 pamuk, regular fit.</p>",
  "DispatchPeriod": 2,
  "Volume": 1,
  "VariantName1": "Renk",
  "VariantName2": "Beden",
  "Images": [
    {
      "Url": "https://cdn.example.com/tshirt-001-1.jpg"
    },
    {
      "Url": "https://cdn.example.com/tshirt-001-2.jpg"
    }
  ],
  "Variants": [
    {
      "Code": "TSHIRT-001-BLK-M",
      "Barcode": "8690000000024",
      "Quantity": 10,
      "Price": 249.9,
      "VariantValue1": "Siyah",
      "VariantValue2": "M"
    },
    {
      "Code": "TSHIRT-001-BLK-L",
      "Barcode": "8690000000031",
      "Quantity": 20,
      "Price": 249.9,
      "VariantValue1": "Siyah",
      "VariantValue2": "L"
    }
  ],
  "Specs": [
    {
      "Name": "Materyal",
      "Value": "Pamuk"
    }
  ]
}

Example response

{
  "Result": true,
  "Response": 987654
}

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.

Use ↑ ↓ to move, Enter to open, Esc to close.

Connect to the Out API

DoLogin is called and the returned ApiCode is kept in this tab. Your API password is never sent to this site.