## Search the distributor catalogs (tenant:trade:purchasing:read)

`POST /api/trade/v1/itsp/articles/search`

Module: Trade · operationId: `searchArticles` · Tag: ITSP · Auth: access token (`Authorization: Bearer <accessToken>`)

Searches the enabled distributors of the tenant (EGIS, Ingram Micro, Infinigate, Amazon) and
aggregates the offers per product. Articles that already exist in masterdata are marked
(`microtechStatus`); supplier addresses are filled in from masterdata. Connector failures are
reported in `warnings`.

### Request body

`application/json` (required)

- `query` (string, required)
- `enrichWithAi` (boolean): Accepted but not used by the search.
- `options` (SearchOptions)
  - `connectors` (array of string): Limit the search to these connectors (e.g. `egis`, `ingram`, `infinigate`, `amazon`).
  - `maxResults` (integer): Maximum number of articles.
  - `onlyInStock` (boolean): Only articles a distributor has in stock.

Example:

```json
{
  "options": {
    "connectors": [
      "egis",
      "ingram",
      "amazon"
    ],
    "maxResults": 20,
    "onlyInStock": true
  },
  "query": "Lenovo ThinkPad T14"
}
```

### Responses

- **200** Results (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).
- **502** A dependent service (DMS, masterdata, a distributor) failed or is unreachable. (`application/json`)
- **503** The configuration store is not available. (`application/json`)

Fields of the 200 answer:

- `articles` (array of NormalizedArticle): Articles found, merged across distributors.
  - `bestPurchasePrice` (number): Lowest purchase price of all supplier offers.
  - `canonicalMpn` (string): Manufacturer part number normalized for matching.
  - `currency` (string): Currency (ISO 4217).
  - `description` (string): Description of the article.
  - `descriptions` (array of object): Every text the catalogs have for the article.
    - `recommended` (boolean): The catalog flags the text as recommended.
    - `source` (string): Catalog of the text, e.g. `CNET`, `ICECAT`, `EGIS`.
    - `text` (string): The text.
    - `title` (string): Title of the text, e.g. `Marketing-Text (CNET)`.
    - `type` (string): `main`, `marketing`, `short_summary`, `long_summary` or `short_desc`. (one of `main`, `marketing`, `short_summary`, `long_summary`, `short_desc`)
  - `ean` (string): EAN (GTIN) of the article.
  - `existingArticleId` (string): Masterdata id of the existing article.
  - `existingArticleNumber` (string): Article number of the article that exists in masterdata already.
  - `features` (array of object): Technical features of the article.
    - `name` (string): Name of the feature.
    - `value` (string): Value of the feature.
  - `fldSerienNrKz` (boolean): Serial number tracked.
  - `height` (number): Height of the article.
  - `id` (string): Id of the article in the merged search result.
  - `imageUrl` (string): Link to a product image.
  - `inStock` (boolean): Stock confirmed without a quantity.
  - `length` (number): Length of the article.
  - `manufacturerCode` (string): Manufacturer code in masterdata.
  - `manufacturerId` (string): The catalog's id of the manufacturer.
  - `manufacturerName` (string): Name of the manufacturer.
  - `marketingText` (string): Marketing text of the article.
  - `microtechArticleNumber` (string): Article number of the article in the ERP, when it exists there.
  - `microtechStatus` (string): Whether the article exists in masterdata. (one of `NOT_FOUND`, `EXISTS`, `MULTIPLE_MATCHES`, `REQUIRES_MANUAL_MAPPING`)
  - `mpn` (string): Manufacturer part number.
  - `productGroup` (string): Name of the product group.
  - `productGroupNumber` (string): Number of the product group in masterdata.
  - `requiresManualMapping` (boolean): The manufacturer could not be mapped to masterdata automatically.
  - `searchTerm` (string): Search term (Suchbegriff) of the article.
  - `shortDescription` (string): Short description of the article.
  - `source` (string): Catalog the article came from; comma-separated when several had it.
  - `sourceArticleId` (string): The catalog's id of the article.
  - `sourceIdentifiers` (object): Connector → its article id.
  - `suppliers` (array of SupplierArticle): Supplier offers of the article.
    - `availableQuantity` (number): Quantity available at the distributor.
    - `currency` (string): Currency of the purchase price (ISO 4217).
    - `deliveryTimeDays` (integer): Delivery time in days.
    - `directOrderable` (boolean): The article can be ordered from the distributor through trade.
    - `distributorId` (string): EGIS id of the distributor.
    - `distributorName` (string): Name of the distributor.
    - `isDefault` (boolean): This supplier is the default supplier of the article.
    - `microtechAddressNo` (integer): Address number of the supplier in masterdata.
    - `purchasePrice` (number): Net purchase price.
    - `source` (string): Catalog of the offer (`egis`, `ingram`, …).
    - `supplierAddressId` (string): Masterdata address the distributor is assigned to.
    - `supplierAddressName` (string): Name of the masterdata supplier address of the distributor.
    - `supplierArticleNumber` (string): The distributor's article number.
  - `title` (string): Title of the article.
  - `totalAvailableQuantity` (number): Quantity available across all distributors.
  - `unit` (string): Unit of measure.
  - `weight` (number): Weight of the article.
  - `width` (number): Width of the article.
- `total` (integer): Number of articles found.
- `warnings` (array of ConnectorWarning): Connectors that failed or answered partly.
  - `code` (string): Machine-readable kind of the warning; empty for other failures (the message names them). Known values: `PRICES_UNAVAILABLE` (the connector could not answer prices and availability; its offers are missing, article data it read is still returned).
  - `connector` (string): The connector that did not answer fully.
  - `message` (string): What went wrong.

Example 200 answer:

```json
{
  "articles": [
    {
      "bestPurchasePrice": 1049,
      "canonicalMpn": "21MC0012GE",
      "currency": "EUR",
      "descriptions": [
        {
          "recommended": true,
          "source": "EGIS",
          "text": "Business-Notebook mit 14-Zoll-WUXGA-Display, Intel Core Ultra 7 155U, 32 GB RAM und 1 TB SSD.",
          "title": "Produktbeschreibung (EGIS)",
          "type": "main"
        }
      ],
      "ean": "0197529876543",
      "features": [
        {
          "name": "Bildschirmdiagonale",
          "value": "35,6 cm (14\")"
        },
        {
          "name": "Prozessor",
          "value": "Intel Core Ultra 7 155U"
        }
      ],
      "fldSerienNrKz": true,
      "id": "art-21MC0012GE",
      "inStock": true,
      "manufacturerCode": "LNV",
      "manufacturerName": "Lenovo",
      "microtechStatus": "NOT_FOUND",
      "mpn": "21MC0012GE",
      "productGroup": "Notebooks",
      "productGroupNumber": "120",
      "requiresManualMapping": false,
      "searchTerm": "THINKPAD T14 G5",
      "shortDescription": "Lenovo ThinkPad T14 Gen 5",
      "source": "egis,ingram",
      "sourceArticleId": "PCS512377",
      "sourceIdentifiers": {
        "egis": "PCS512377",
        "ingram": "7J0815"
      },
      "suppliers": [
        {
          "availableQuantity": 25,
          "currency": "EUR",
          "deliveryTimeDays": 1,
          "directOrderable": true,
          "distributorId": "70044",
          "distributorName": "Nordlicht IT-Distribution GmbH",
          "isDefault": true,
          "microtechAddressNo": 70001,
          "purchasePrice": 1049,
          "source": "egis",
          "supplierAddressId": "6d8f0a12-3c4e-4a5b-9d6f-7e8a9b0c1d01",
          "supplierAddressName": "Nordlicht IT-Distribution GmbH",
          "supplierArticleNumber": "NL-T14G5-32"
        },
        {
          "availableQuantity": 12,
          "currency": "EUR",
          "deliveryTimeDays": 2,
          "directOrderable": true,
          "distributorName": "Ingram Micro",
          "isDefault": false,
          "microtechAddressNo": 70010,
          "purchasePrice": 1067.5,
          "source": "ingram",
          "supplierAddressId": "6d8f0a12-3c4e-4a5b-9d6f-7e8a9b0c1d10",
          "supplierAddressName": "Ingram Micro Distribution GmbH",
          "supplierArticleNumber": "7J0815"
        }
      ],
      "title": "Lenovo ThinkPad T14 Gen 5, 14\" WUXGA, Core Ultra 7 155U, 32 GB, 1 TB SSD, Win 11 Pro",
      "totalAvailableQuantity": 37,
      "unit": "Stk",
      "weight": 1.37
    }
  ],
  "total": 1,
  "warnings": [
    {
      "code": "",
      "connector": "amazon",
      "message": "Amazon Business antwortet nicht (Zeitüberschreitung nach 10 s)."
    }
  ]
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/itsp/articles/search' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"options":{"connectors":["egis","ingram","amazon"],"maxResults":20,"onlyInStock":true},"query":"Lenovo ThinkPad T14"}'
```
