---
schema_version: "1"
id: 319e2c520464b092f88e5571cc83142f102e72497945b2162cea32adce014630
title: Inventory
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/marketplace/references/generated-api-specs/marketplace-seller-inventory.md
canonical_url: https://developer.salesforce.com/docs/commerce/marketplace/references/marketplace-seller-inventory
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8c4f2b4538eceacbfd710cbf93ac00d5b7b6abf76f722665542fff7198e1a954
products:
  - Commerce Marketplace
  - Salesforce APIs
---
Inventory

# Inventory

Inventory is a way to group a seller’s stock. When correctly configured, there should only be 1 inventory per seller, with any others being ignored.

It is recommended that, when configuring the seller, the marketplace should set up the inventory with the correct external ID, but this configuration can be achieved by means of API integration.

**Version:** 1.0.0

## Servers

*   `https://login.salesforce.com`
*   `http://mydomainname.my.site.com`
*   `http://{{community-url}}`
*   `http://{{base-url}}`

## Security

*   `oauth2Auth` (http)
    *   HTTP scheme: oauth2
*   `bearerAuth` (http)
    *   HTTP scheme: bearer

## Operations

### GET Query

`GET /services/data/v51.0/query`

Operation ID: `Query`. Tags: Inventory. Security: bearerAuth.

To look up information about inventory, use the [Query](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm) resource of the main REST API from Salesforce and set the value of the `q` parameter to an SOQL query. The following examples are included in the query parameters section of this page, with corresponding examples in the responses section:

**Example 1 of 2**: `getInventoryBySellerId`

This call allows the seller’s inventory information to be searched. If you do not know the External ID of the inventory, this call can be used to search for this information.

**Example 2 of 2**: `getInventoryRecordsByInventoryId`

This call allows the listing of the stock of all SKUs within a specific inventory using the External ID. Depending on the quantity, the results may require pagination.

#### Parameters

*   `q` (query, string)
    
    _Example: getInventoryBySellerId_
    
    ```
    SELECT FIELDS(ALL) FROM Atonit_Mktplace__Inventory__c WHERE Atonit_Mktplace__Seller__r.Atonit_Mktplace__Slug__c= '{{seller-external-id}}' LIMIT 200
    ```
    
    _Example: getInventoryRecordsByInventoryId_
    
    ```
    SELECT Atonit_Mktplace__External_Id__c,Atonit_Mktplace__Inventory__r.Atonit_Mktplace__External_Id__c, Atonit_Mktplace__Product_Variant__r.Atonit_Mktplace__External_Id__c,Atonit_Mktplace__Quantity__c  FROM Atonit_Mktplace__Inventory_Record__c WHERE Atonit_Mktplace__Inventory__r.Atonit_Mktplace__External_Id__c= '{{seller-api-prefix}}-inventory' LIMIT 200
    ```
    

#### Responses

*   **200** OK
    
    Headers:
    
    *   `Date` (string)  
        Example: `Fri, 23 Apr 2021 19:04:51 GMT`.
    *   `Strict-Transport-Security` (string)  
        Example: `max-age=31536002; includeSubDomains`.
    *   `X-Content-Type-Options` (string)  
        Example: `nosniff`.
    *   `X-XSS-Protection` (string)  
        Example: `1; mode=block`.
    *   `X-Robots-Tag` (string)  
        Example: `none`.
    *   `Cache-Control` (string)  
        Example: `no-cache,must-revalidate,max-age=0,no-store,private`.
    *   `Sforce-Limit-Info` (string)  
        Example: `api-usage=1456/101002`.
    *   `Content-Type` (string)  
        Example: `application/json;charset=UTF-8`.
    *   `Vary` (string)  
        Example: `Accept-Encoding`.
    *   `Content-Encoding` (string)  
        Example: `gzip`.
    *   `Transfer-Encoding` (string)  
        Example: `chunked`.
    
    Media type: `application/json`. Schema: `object`.
    
    _Example: getInventoryBySellerId_
    
    ```
    {
      "totalSize": 1,
      "done": true,
      "records": [
        {
          "Id": "a0A5Y00001JJoqmUAD",
          "Name": "W-0000",
          "CreatedDate": "2021-03-22T21:39:57.000+0000",
          "LastModifiedDate": "2021-04-22T19:22:50.000+0000",
          "Atonit_Mktplace__Name__c": "atonit-vitta-inventory",
          "Atonit_Mktplace__Seller__c": "a0T5Y00000ZE4lFUAT",
          "Atonit_Mktplace__External_Id__c": "atonit-vitta-inventory"
        }
      ]
    }
    ```
    
    _Example: getInventoryRecordsByInventoryId_
    
    ```
    {
      "example": {
        "totalSize": 5,
        "done": true,
        "records": [
          {
            "Atonit_Mktplace__External_Id__c": "atonit-vitta-inventory-atonit-vitta-sku-1",
            "Atonit_Mktplace__Inventory__r": {
              "Atonit_Mktplace__External_Id__c": "atonit-vitta-inventory"
            },
            "Atonit_Mktplace__Product_Variant__r": {
              "Atonit_Mktplace__External_Id__c": "atonit-vitta-sku-1"
            },
            "Atonit_Mktplace__Quantity__c": 88
          }
        ]
      }
    }
    ```
    

### GET Get Inventory by ID

`GET /services/data/v51.0/sobjects/Atonit_Mktplace__Inventory__c/Atonit_Mktplace__External_Id__c/{seller-api-prefix}-inventory`

Operation ID: `Get Inventory by ID`. Tags: Inventory. Security: bearerAuth.

This call will load all available inventory information using the External ID as the key

#### Parameters

*   `seller-api-prefix` (path, string, required)

#### Responses

*   **200** OK
    
    Headers:
    
    *   `Date` (string)  
        Example: `Fri, 23 Apr 2021 19:08:17 GMT`.
    *   `Strict-Transport-Security` (string)  
        Example: `max-age=31536002; includeSubDomains`.
    *   `X-Content-Type-Options` (string)  
        Example: `nosniff`.
    *   `X-XSS-Protection` (string)  
        Example: `1; mode=block`.
    *   `X-Robots-Tag` (string)  
        Example: `none`.
    *   `Cache-Control` (string)  
        Example: `no-cache,must-revalidate,max-age=0,no-store,private`.
    *   `Sforce-Limit-Info` (string)  
        Example: `api-usage=1458/101002`.
    *   `Last-Modified` (string)  
        Example: `Thu, 22 Apr 2021 19:22:50 GMT`.
    *   `Content-Type` (string)  
        Example: `application/json;charset=UTF-8`.
    *   `Vary` (string)  
        Example: `Accept-Encoding`.
    *   `Content-Encoding` (string)  
        Example: `gzip`.
    *   `Transfer-Encoding` (string)  
        Example: `chunked`.
    
    Media type: `application/json`. Schema: `object`.
    
    _Example_
    
    ```
    {
      "Id": "a0A5Y00001JJoqmUAD",
      "Name": "W-0000",
      "CreatedDate": "2021-03-22T21:39:57.000+0000",
      "LastModifiedDate": "2021-04-22T19:22:50.000+0000",
      "Atonit_Mktplace__Name__c": "atonit-vitta-inventory",
      "Atonit_Mktplace__Seller__c": "a0T5Y00000ZE4lFUAT",
      "Atonit_Mktplace__External_Id__c": "atonit-vitta-inventory"
    }
    ```
    

### PATCH Create or Update Inventory

`PATCH /services/data/v51.0/sobjects/Atonit_Mktplace__Inventory__c/Atonit_Mktplace__External_Id__c/{seller-api-prefix}-inventory`

Operation ID: `Create or Update Inventory`. Tags: Inventory. Security: bearerAuth.

This call allows you both to create and update the seller’s inventory. If an inventory already exists with the ID provided in the URL, it will be updated, otherwise it will be created. The rule for the ID is that it must start with the seller-api-prefix and contain only letters, numbers and `-`.

Take care at all times not to create more than 1 inventory for the seller, otherwise the integration will not work properly.

#### Parameters

*   `seller-api-prefix` (path, string, required)

#### Request body

Media type: `application/json`. Schema: `object`.

_Example_

```
{
  "Atonit_Mktplace__Name__c": "{{seller-api-prefix}}-inventory",
  "Atonit_Mktplace__Seller__r": {
    "Atonit_Mktplace__Slug__c": "{{seller-external-id}}"
  }
}
```

#### Responses

*   **200** Successful response
    
    Media type: `application/json`.
    

### GET Get Inventory Record by ID

`GET /services/data/v51.0/sobjects/Atonit_Mktplace__Inventory_Record__c/Atonit_Mktplace__External_Id__c/{seller-api-prefix}-inventory-{seller-api-prefix}-sku-1`

Operation ID: `Get Inventory Record by ID`. Tags: Inventory. Security: bearerAuth.

This call will load all available stock information for an SKU using the External ID as the key

#### Parameters

*   `seller-api-prefix` (path, string, required)

#### Responses

*   **200** OK
    
    Headers:
    
    *   `Date` (string)  
        Example: `Fri, 23 Apr 2021 19:13:09 GMT`.
    *   `Strict-Transport-Security` (string)  
        Example: `max-age=31536002; includeSubDomains`.
    *   `X-Content-Type-Options` (string)  
        Example: `nosniff`.
    *   `X-XSS-Protection` (string)  
        Example: `1; mode=block`.
    *   `X-Robots-Tag` (string)  
        Example: `none`.
    *   `Cache-Control` (string)  
        Example: `no-cache,must-revalidate,max-age=0,no-store,private`.
    *   `Sforce-Limit-Info` (string)  
        Example: `api-usage=1461/101002`.
    *   `Last-Modified` (string)  
        Example: `Fri, 23 Apr 2021 19:10:19 GMT`.
    *   `Content-Type` (string)  
        Example: `application/json;charset=UTF-8`.
    *   `Vary` (string)  
        Example: `Accept-Encoding`.
    *   `Content-Encoding` (string)  
        Example: `gzip`.
    *   `Transfer-Encoding` (string)  
        Example: `chunked`.
    
    Media type: `application/json`. Schema: `object`.
    
    _Example_
    
    ```
    {
      "Id": "a095Y00001B5JLrQAN",
      "Name": "IR-0015",
      "CreatedDate": "2021-04-22T19:43:03.000+0000",
      "LastModifiedDate": "2021-04-23T19:10:19.000+0000",
      "Atonit_Mktplace__Inventory__c": "a0A5Y00001JJoqmUAD",
      "Atonit_Mktplace__Product_Variant__c": "a0L5Y00000oAUQDUA4",
      "Atonit_Mktplace__Quantity__c": 88,
      "Atonit_Mktplace__External_Id__c": "atonit-vitta-inventory-atonit-vitta-sku-1"
    }
    ```
    

### PATCH Create or Update Inventory Record

`PATCH /services/data/v51.0/sobjects/Atonit_Mktplace__Inventory_Record__c/Atonit_Mktplace__External_Id__c/{seller-api-prefix}-inventory-{seller-api-prefix}-sku-1`

Operation ID: `Create or Update Inventory Record`. Tags: Inventory. Security: bearerAuth.

This call allows you both to create and update an SKU in the seller’s inventory. If stock already exists with the ID provided in the URL, it will be updated, otherwise it will be created. The rule for the ID is that it must be in the format `<id-inventory>-<id-sku>`.

#### Parameters

*   `seller-api-prefix` (path, string, required)

#### Request body

Media type: `application/json`. Schema: `object`.

_Example_

```
{
  "Atonit_Mktplace__Inventory__r": {
    "Atonit_Mktplace__External_Id__c": "{{seller-api-prefix}}-inventory"
  },
  "Atonit_Mktplace__Product_Variant__r": {
    "Atonit_Mktplace__External_Id__c": "{{seller-api-prefix}}-sku-1"
  },
  "Atonit_Mktplace__Quantity__c": 88
}
```

#### Responses

*   **200** OK
    
    Headers:
    
    *   `Date` (string)  
        Example: `Fri, 23 Apr 2021 19:10:19 GMT`.
    *   `Strict-Transport-Security` (string)  
        Example: `max-age=31536002; includeSubDomains`.
    *   `X-Content-Type-Options` (string)  
        Example: `nosniff`.
    *   `X-XSS-Protection` (string)  
        Example: `1; mode=block`.
    *   `X-Robots-Tag` (string)  
        Example: `none`.
    *   `Cache-Control` (string)  
        Example: `no-cache,must-revalidate,max-age=0,no-store,private`.
    *   `Sforce-Limit-Info` (string)  
        Example: `api-usage=1459/101002`.
    *   `Location` (number)  
        Example: `/services/data/v51.0/sobjects/Atonit_Mktplace__Inventory_Record__c/a095Y00001B5JLrQAN`.
    *   `Content-Type` (string)  
        Example: `application/json;charset=UTF-8`.
    *   `Transfer-Encoding` (string)  
        Example: `chunked`.
    
    Media type: `application/json`. Schema: `object`.
    
    _Example_
    
    ```
    {
      "id": "a095Y00001B5JLrQAN",
      "success": true,
      "errors": [],
      "created": false
    }
    ```