> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kategorien importieren

> Importieren Sie Ihre gesamte Produktkategorie-Hierarchie in Kameleoon, bevor Sie mit der Product Recommendation API Produktimporte ausführen.

Dieser Endpoint importiert alle Ihre Produktkategorien in Ihr Kameleoon-Konto.

Vor dem Hochladen von Produkten müssen Sie eine aktuelle Liste der Kategorien in die Kameleoon-Datenbank hochladen.
Die Daten werden als [JSON-Zeichenfolge](#beispiel-json-anfrage) gesendet, die den Anfragetext enthält. Sie müssen alle Kategorien in einer einzigen Anfrage senden.

### Liste der Abfrageparameter

| Parameter | Typ | Erforderlich | Beschreibung |
| - | - | - | - |
| `shop_id` | String | Ja | Store Key. Sie finden ihn in **Recommendations** > **Settings** > **Store settings** in der Kameleoon App. Kontaktieren Sie Ihren Customer Success Manager, falls erforderlich, um den Schlüssel zu erhalten. |
| `shop_secret` | String | Ja | Secret Key. Sie finden ihn in **Recommendations** > **Settings** > **Store settings** in der Kameleoon App. Kontaktieren Sie Ihren Customer Success Manager, falls erforderlich, um den Schlüssel zu erhalten. |
| `categories` | List | Ja | Eine Liste von Kategorieobjekten. In [dieser Tabelle](#liste-der-parameter-für-das-categories-objekt) finden Sie die für `categories` erforderlichen Parameter |
| `webhook` | String | Nein | Die Webhook-URL. Kameleoon sendet nach Abschluss des Imports eine POST-Anfrage an diese URL. |

> [!NOTE]
>
> Der `webhook` dient dazu, den Entwickler zu benachrichtigen, sobald eine Anfrage abgeschlossen wurde. Wenn alle im API-Aufruf angegebenen Kategorien importiert und vollständig verfügbar sind, sendet Kameleoon eine POST-Anfrage an den festgelegten Webhook.
>
> Kameleoon empfiehlt dringend, den `webhook` zu verwenden, wenn Sie eine große Anzahl von Kategorien importieren, da deren Verarbeitung in Kameleoon mehrere Minuten dauern kann.
>
> Wenn Sie Produkte über den [Endpoint zum Importieren von Produkten](https://docs.kameleoon.com/de/developer-docs/apis/product-recommendation-api-rest/all-endpoints/Import/import-product.md) importieren, stellt die Verwendung des Webhooks sicher, dass alle Kategorien vollständig verarbeitet wurden, bevor mit dem Produktimport begonnen wird. Da die Kategorien zunächst von Kameleoon verarbeitet werden müssen, werden alle Produkte ohne bekannte Kategorie während des Importvorgangs ignoriert.
>
> Beispiel für eine erfolgreiche Anfrage:
>
> ```json theme={null}
> {
> 	"status": "success"
> }
> ```
>
> Beispiel für eine erfolglose Anfrage:
>
> ```json theme={null}
> {
> 	"status": "error", 
> 	"message": "MESSAGE"
> }
> ```

## Liste der Parameter für das `categories`-Objekt

| Parameter | Typ | Erforderlich | Beschreibung |
| - | - | - | - |
| `id` | String | Ja | Eine eindeutige ID, die der Kategorie zugewiesen wird |
| `name` | String | Ja | Name der Kategorie |
| `parent` | String/NULL | Optional | Wenn die Kategorie hierarchisch ist, definiert dieses Feld eine übergeordnete Kategorie |
| `url` | String | Optional | Eine URL, die der Kategorie zugeordnet werden soll |
| `alias` | String | Optional | Ein Alias für die Kategorie |

## Beispiel-JSON-Anfrage

```json theme={null}
{
    "shop_id": "eehj3eu84299kg5ghw5a6743r8",
    "shop_secret": "pmd5362597thrgq8k256ep01t0",
    "categories": [
        {
            "id": "footwearID",
            "name": "footwear",
            "url": "https://example.com/footwear",
            "alias": "kicks"
        },
        {
            "id": "shoesID",
            "name": "shoes",
            "parent": "footwearID"
        },
        {
            "id": "bootsID",
            "name": "boots",
            "parent": "footwearID"
        }
    ]
}
```


## OpenAPI

````yaml product-recommendation.api.json POST /import/categories
openapi: 3.1.0
info:
  title: Kameleoon Product Recommendation API
  version: 1.0.0
  description: >-
    REST API for importing product, category, and order data into Kameleoon,
    initializing recommendation sessions, and retrieving product
    recommendations, collections, and search results.
servers:
  - url: https://api.products.kameleoon.com
security: []
paths:
  /import/categories:
    post:
      tags:
        - Import
      summary: Import categories
      description: >-
        Import your full product category hierarchy into Kameleoon before
        running product imports using the Product Recommendation API. You must
        send all categories in a single request.
      operationId: importCategories
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - shop_id
                - shop_secret
                - categories
              properties:
                shop_id:
                  type: string
                  description: >-
                    Store Key. Find this in **Recommendations** > **Settings** >
                    **Store settings** in the Kameleoon app. Contact your
                    Customer Success Manager for the key if necessary.
                shop_secret:
                  type: string
                  description: >-
                    Secret Key. Find this in **Recommendations** > **Settings**
                    > **Store settings** in the Kameleoon app. Contact your
                    Customer Success Manager for the key if necessary.
                categories:
                  type: array
                  items:
                    type: object
                    required:
                      - id
                      - name
                    properties:
                      id:
                        type: string
                        description: A unique ID assigned to the category.
                      name:
                        type: string
                        description: Name of the category.
                      parent:
                        type:
                          - string
                          - 'null'
                        description: >-
                          If the category is hierarchical, this field defines a
                          parent for this category.
                      url:
                        type: string
                        description: A URL to associate with the category.
                      alias:
                        type: string
                        description: An alias for the category.
                  description: A list of category objects.
                webhook:
                  type: string
                  description: >-
                    The webhook URL where a POST request is sent upon completion
                    of the import. Recommended for large imports, since
                    processing can take several minutes.
            example:
              shop_id: eehj3eu84299kg5ghw5a6743r8
              shop_secret: pmd5362597thrgq8k256ep01t0
              categories:
                - id: footwearID
                  name: footwear
                  url: https://example.com/footwear
                  alias: kicks
                - id: shoesID
                  name: shoes
                  parent: footwearID
                - id: bootsID
                  name: boots
                  parent: footwearID
      responses:
        '204':
          description: >-
            Import accepted. Verified against a live response on 2026-09-24:
            this endpoint returns an empty 204 response on success, not a JSON
            body — the `{"status": "success"}` shape only applies to the
            asynchronous `webhook` callback payload, if a `webhook` was
            provided.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                    description: Request outcome.
              example:
                status: success
        '400':
          description: >-
            The request was rejected, most commonly for invalid
            `shop_id`/`shop_secret` credentials. Verified against a live
            response on 2026-09-24.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                    description: Request outcome.
                  message:
                    type: string
                    description: Error details (for example, "Incorrect shop credentials").
              example:
                status: error
                message: Incorrect shop credentials

````