> This page is for version Experimental.
> For other versions, use one of these documentation indexes:
> - 2026-07 (default): https://developer-stage.shipbob.dev/2026-07/llms.txt
> - 2026-01: https://developer-stage.shipbob.dev/2026-01/llms.txt
> - 2025-07: https://developer-stage.shipbob.dev/2025-07/llms.txt
> - v2.0: https://developer-stage.shipbob.dev/v2.0/llms.txt
> - v1.0: https://developer-stage.shipbob.dev/v1.0/llms.txt
> - Experimental: https://developer-stage.shipbob.dev/experimental/llms.txt

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

#     Set B2B Reservation Quantity


PUT https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity
Content-Type: application/json

    Sets the quantity of an inventory item that is reserved for the B2B channel. The reservation drives the b2b_sellable_quantity and d2c_sellable_quantity fields returned by Get All Inventory Levels and Get Inventory Levels. The new value replaces the previous one. Send 0 to remove the reservation.

    The inventory item must belong to the caller. This operation requires feature flag PIX.GIS.B2bInventoryReservation to be enabled for the merchant. If the flag is off, or the inventory item does not belong to the caller, the response is 403. The two cases return the same response on purpose.


Reference: https://developer-stage.shipbob.dev/experimental/api/inventory/set-b-2-b-reservation-quantity

## Authentication

- `Authorization` header (bearer token, required) — Authentication using Personal Access Token (PAT) token
- `Authorization` header (bearer token, required) — OAuth2 authentication using JWT tokens

## Request

### Body (application/json)

This endpoint expects an Inventory.Put.Api.V4.Inventories.SetB2bReservationQuantity.SetB2bReservationQuantityRequest.

- `b2b_reservation_quantity` (integer, required) — Quantity to reserve for the B2B channel. Must be 0 or greater.
- `inventory_id` (integer, required) — Unique identifier of the inventory item. Must be greater than 0. The item must belong to the caller.

## Response

### 200

B2B reservation quantity updated

- `b2b_reservation_quantity` (integer, optional) — The B2B reservation quantity now stored for the inventory item
- `inventory_id` (integer, optional) — Unique identifier of the inventory item that was updated

## Errors

### 400 Bad Request Error

Invalid request. inventory_id must be greater than 0 and b2b_reservation_quantity must be 0 or greater

- `detail` (string, optional, nullable) — A human-readable explanation specific to this occurrence of the problem.
- `instance` (string, optional, nullable) — A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
- `status` (integer, optional, nullable) — The HTTP status code for this occurrence of the problem.
- `title` (string, optional, nullable) — A short, human-readable summary of the problem type.
- `type` (string, optional, nullable) — A URI reference that identifies the problem type. This URI should provide human-readable documentation for the problem.

### 401 Unauthorized Error

Unauthorized

- `detail` (string, optional, nullable) — A human-readable explanation specific to this occurrence of the problem.
- `instance` (string, optional, nullable) — A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
- `status` (integer, optional, nullable) — The HTTP status code for this occurrence of the problem.
- `title` (string, optional, nullable) — A short, human-readable summary of the problem type.
- `type` (string, optional, nullable) — A URI reference that identifies the problem type. This URI should provide human-readable documentation for the problem.

### 403 Forbidden Error

Forbidden. The B2B reservation feature is not enabled for the merchant, or the inventory item does not belong to the caller

- `detail` (string, optional, nullable) — A human-readable explanation specific to this occurrence of the problem.
- `instance` (string, optional, nullable) — A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
- `status` (integer, optional, nullable) — The HTTP status code for this occurrence of the problem.
- `title` (string, optional, nullable) — A short, human-readable summary of the problem type.
- `type` (string, optional, nullable) — A URI reference that identifies the problem type. This URI should provide human-readable documentation for the problem.

### 500 Internal Server Error

Internal Server Error

- `any`

## Examples

**Request**

```json
{
  "b2b_reservation_quantity": 50,
  "inventory_id": 123
}
```

**Response**

```json
{
  "b2b_reservation_quantity": 50,
  "inventory_id": 123
}
```

**SDK Code**

```python default
import requests

url = "https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity"

payload = {
    "b2b_reservation_quantity": 50,
    "inventory_id": 123
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript default
const url = 'https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"b2b_reservation_quantity":50,"inventory_id":123}'
};

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

```go default
package main

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

func main() {

	url := "https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity"

	payload := strings.NewReader("{\n  \"b2b_reservation_quantity\": 50,\n  \"inventory_id\": 123\n}")

	req, _ := http.NewRequest("PUT", 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 default
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"b2b_reservation_quantity\": 50,\n  \"inventory_id\": 123\n}"

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

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

HttpResponse<String> response = Unirest.put("https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"b2b_reservation_quantity\": 50,\n  \"inventory_id\": 123\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity', [
  'body' => '{
  "b2b_reservation_quantity": 50,
  "inventory_id": 123
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp default
using RestSharp;

var client = new RestClient("https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"b2b_reservation_quantity\": 50,\n  \"inventory_id\": 123\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift default
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "b2b_reservation_quantity": 50,
  "inventory_id": 123
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.shipbob.com/Experimental/inventory:setB2bReservationQuantity")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```