# Inventory Loader

## Parameters

### `merchantId`

{% hint style="danger" %}
**Required**
{% endhint %}

There is documentation on how to retrieve your `merchantId`  in the [Flat file feeds](/feed-transformer/feed-types/tab.md#common-required-parameters)section of the [Flat file feeds](/feed-transformer/feed-types/tab.md) page.

### `shippingGroupMap`

{% hint style="warning" %}
Required if the `merchant_shipping_group_name` field is present in the feed file being converted.
{% endhint %}

This parameter is a mapping of your account's shipping group names to their internal Amazon identifiers.&#x20;

To produce this mapping, use the `getDefinitionsProductType` endpoint of the Selling Partner API to retrieve your seller-account-specific product JSON schema. Make sure to use `PRODUCT` for the product type, the marketplace ID of the marketplace this feed will be sent to, and the same merchant ID that you're using when you submit the feed. If you're using `jlevers/selling-partner-api` to interact with the Selling Partner API, that would look like this:

```php
use SellingPartnerApi\SellingPartnerApi;
use SellingPartnerApi\Enums\Endpoint;

$connector = SellingPartnerApi::seller(
    clientId: 'amzn1.application-oa2-client.asdfqwertyuiop...',
    clientSecret: 'amzn1.oa2-cs.v1.1234567890asdfghjkl...',
    refreshToken: 'Atzr|IwEBIA...',
    endpoint: Endpoint::NA,  // Or Endpoint::EU, Endpoint::FE
);
$api = $connector->productTypeDefinitionsV20200901();
$response = $api->getDefinitionsProductType(
    productType: 'PRODUCT',
    marketplaceIds: ['ATVPDKIKX0DER'],
    sellerId: 'YOUR-MERCHANT-ID',
);
```

Then, pass the schema URL to `Converter::parseShippingGroups()`:

```php
use SellingPartnerApi\FeedTransformer\Transformer;

$productTypeDefinition = $response->dto();
$schemaUrl = $productTypeDefinition->schema->link->resource;
$shippingGroupMap = Transformer::parseShippingGroups($schemaUrl);
```

##

## Usage

To convert a `POST_FLAT_FILE_INVLOADER_DATA` feed to the newer `JSON_LISTINGS_FEED` format:

```php
use SellingPartnerApi\FeedTransformer\Transformer;
use SellingPartnerApi\FeedTransformer\FeedTypes\Invloader;

$feedFile = 'path/to/your/feed.tab';
$json = Transformer::fromFile(
    Invloader::$feedType,
    $feedFile,
    'ATVPDKIKX0DER',
    [
        'merchantId' => 'A2DI..........',
        'shippingGroupMap' => $shippingGroupMap
    ]
);

$jsonFeedPath = 'path/to/new/feed.json';
file_put_contents($jsonFeedPath, json_encode($json));
```

##

## Known columns

This is an exhaustive list of the columns we support for this feed type. If you are successfully passing feed files with additional columns, [let us know](mailto:hi@highsidelabs.co) and we'll add support for the ones we're missing.

* `sku`
* `price`
* `quantity`
* `product-id`
* `product-id-type`
* `add-delete`
* `will-ship-internationally` (this field will not throw an error, but has no corresponding field in the JSON schema, so no action will be taken related to this field)
* `expedited-shipping` (ditto `will-ship-internationally`)
* `standard-plus` (ditto `will-ship-internationally` and `expedited-shipping`)
* `minimum-seller-allowed-price`
* `maximum-seller-allowed-price`
* `handling-time`
* `fulfillment-center-id`
* `item-condition`
* `item-note`
* `business_price`
* `quantity_price_type`
* `quantity_price1`&#x20;
* `quantity_price2`
* `quantity_price3`
* `quantity_price4`
* `quantity_price5`
* `quantity_lower_bound1`
* `quantity_lower_bound2`
* `quantity_lower_bound3`
* `quantity_lower_bound4`
* `quantity_lower_bound5`
* Plus: any and all fields related to product details, such as hazmat and battery info, tax code, etc.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.highsidelabs.co/feed-transformer/feed-types/tab/invloader.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
