> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.coi.co.il/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.coi.co.il/_mcp/server.

# Update prices and stock in bulk

POST https://www.your-store.co.il/api/v1/products/batch
Content-Type: application/json

Up to 500 products in one call - an ERP's or stock system's sync. Each item is answered on its own in `results`: one bad item does not stop the rest, so check every result. Requires `products:write`.

Reference: https://docs.coi.co.il/products/batch-update-products

## Authentication

- `Authorization` header (bearer token, required) — An API key from the store's admin: חנות > API ומפתחות. Send it as `Authorization: Bearer coi_sk_...` (or `X-Api-Key: coi_sk_...`). Never in the URL - `?apikey=` is refused with 400.

## Request

### Body (application/json)

This endpoint expects an object.

- `items` (list of BatchItem, required)

## Response

### 200

Per-item results. `updated` counts product rows changed.

- `ok` (boolean, optional)
- `data` (ProductsBatchPostResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 400 Bad Request Error

The request is not valid - a field of the wrong type, a missing field, a bad parameter.

- `ok` (false, optional)
- `error` (ErrorError, optional)

### 401 Unauthorized Error

Missing, invalid, revoked or expired API key. The same answer for all of them.

- `ok` (false, optional)
- `error` (ErrorError, optional)

### 403 Forbidden Error

The key lacks the permission (`insufficient_scope`), or the site's plan does not include the API (`plan_required`).

- `ok` (false, optional)
- `error` (ErrorError, optional)

### 429 Too Many Requests Error

More than 120 requests a minute with one key. Wait `Retry-After` seconds.

- `ok` (false, optional)
- `error` (ErrorError, optional)

## Types

### BatchItem

Identify the product by `id`, else `internalSku`, else `sku` (every product with that sku is updated). Then any of the fields.

- `id` (integer, optional)
- `internalSku` (string, optional)
- `sku` (string, optional)
- `price` (double, optional)
- `oldPrice` (double, optional)
- `deliveryPrice` (double, optional)
- `cost` (double, optional)
- `stock` (double, optional) — Sets the count.
- `stockAdjust` (double, optional) — Adds to the count; negative takes off. Not together with `stock`.

### ProductsBatchPostResponsesContentApplicationJsonSchemaData

- `updated` (integer, optional)
- `results` (list of ProductsBatchPostResponsesContentApplicationJsonSchemaDataResultsItems, optional)

### ErrorError

- `code` (string, optional) — Stable, machine-readable: `unauthorized`, `insufficient_scope`, `plan_required`, `invalid_field`, `invalid_parameter`, `invalid_json`, `json_required`, `not_found`, `method_not_allowed`, `nothing_to_update`, `plan_limit`, `email_taken`, `registration_disabled`, `rate_limited`, `too_many_failures`, `https_required`, `key_in_url`, `server_error`.
- `message` (string, optional) — What went wrong, in English, for a person.

### ProductsBatchPostResponsesContentApplicationJsonSchemaDataResultsItems

- `index` (integer, optional)
- `ok` (boolean, optional)
- `updated` (integer, optional)
- `error` (ProductsBatchPostResponsesContentApplicationJsonSchemaDataResultsItemsError, optional)

### ProductsBatchPostResponsesContentApplicationJsonSchemaDataResultsItemsError

- `code` (string, optional)
- `message` (string, optional)

## Examples

**Request**

```json
{
  "items": [
    {
      "sku": "CH-100",
      "price": 849,
      "stock": 10
    },
    {
      "internalSku": "ERP-55821",
      "stockAdjust": -2
    },
    {
      "id": 1647,
      "oldPrice": 0
    }
  ]
}
```

**Response**

```json
{
  "ok": true,
  "data": {
    "updated": 2,
    "results": [
      {
        "index": 0,
        "ok": true,
        "updated": 1
      },
      {
        "index": 1,
        "ok": true,
        "updated": 1
      },
      {
        "index": 2,
        "ok": false,
        "error": {
          "code": "not_found",
          "message": "No product of this site matches the identifier."
        }
      }
    ]
  }
}
```

**SDK Code**

```python Products_batchUpdateProducts_example
import requests

url = "https://www.your-store.co.il/api/v1/products/batch"

payload = { "items": [
        {
            "sku": "CH-100",
            "price": 849,
            "stock": 10
        },
        {
            "internalSku": "ERP-55821",
            "stockAdjust": -2
        },
        {
            "id": 1647,
            "oldPrice": 0
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Products_batchUpdateProducts_example
const url = 'https://www.your-store.co.il/api/v1/products/batch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"items":[{"sku":"CH-100","price":849,"stock":10},{"internalSku":"ERP-55821","stockAdjust":-2},{"id":1647,"oldPrice":0}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Products_batchUpdateProducts_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://www.your-store.co.il/api/v1/products/batch"

	payload := strings.NewReader("{\n  \"items\": [\n    {\n      \"sku\": \"CH-100\",\n      \"price\": 849,\n      \"stock\": 10\n    },\n    {\n      \"internalSku\": \"ERP-55821\",\n      \"stockAdjust\": -2\n    },\n    {\n      \"id\": 1647,\n      \"oldPrice\": 0\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Products_batchUpdateProducts_example
require 'uri'
require 'net/http'

url = URI("https://www.your-store.co.il/api/v1/products/batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"items\": [\n    {\n      \"sku\": \"CH-100\",\n      \"price\": 849,\n      \"stock\": 10\n    },\n    {\n      \"internalSku\": \"ERP-55821\",\n      \"stockAdjust\": -2\n    },\n    {\n      \"id\": 1647,\n      \"oldPrice\": 0\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Products_batchUpdateProducts_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://www.your-store.co.il/api/v1/products/batch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"items\": [\n    {\n      \"sku\": \"CH-100\",\n      \"price\": 849,\n      \"stock\": 10\n    },\n    {\n      \"internalSku\": \"ERP-55821\",\n      \"stockAdjust\": -2\n    },\n    {\n      \"id\": 1647,\n      \"oldPrice\": 0\n    }\n  ]\n}")
  .asString();
```

```php Products_batchUpdateProducts_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://www.your-store.co.il/api/v1/products/batch', [
  'body' => '{
  "items": [
    {
      "sku": "CH-100",
      "price": 849,
      "stock": 10
    },
    {
      "internalSku": "ERP-55821",
      "stockAdjust": -2
    },
    {
      "id": 1647,
      "oldPrice": 0
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Products_batchUpdateProducts_example
using RestSharp;

var client = new RestClient("https://www.your-store.co.il/api/v1/products/batch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"items\": [\n    {\n      \"sku\": \"CH-100\",\n      \"price\": 849,\n      \"stock\": 10\n    },\n    {\n      \"internalSku\": \"ERP-55821\",\n      \"stockAdjust\": -2\n    },\n    {\n      \"id\": 1647,\n      \"oldPrice\": 0\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Products_batchUpdateProducts_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["items": [
    [
      "sku": "CH-100",
      "price": 849,
      "stock": 10
    ],
    [
      "internalSku": "ERP-55821",
      "stockAdjust": -2
    ],
    [
      "id": 1647,
      "oldPrice": 0
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://www.your-store.co.il/api/v1/products/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```