---
title: Commit Generation (POST)
description: Ensure only objects from a specified generation remain in the index by committing a previously marked generation.
slug: indexing/api/v1/commit-generation
docKind: endpoint
hub: indexing
tableOfContents: true
---
import ApiSection from "../../../../../components/ApiSection.astro";
import ApiEndpoint from "../../../../../components/ApiEndpoint.astro";
import { Aside } from "@astrojs/starlight/components";

<Aside type="note">
  This endpoint requires HMAC authentication. Refer to the [Authentication](/platform-foundations/api-principles/#authentication) documentation for details.
</Aside>

<ApiSection>
  <div slot="code">
    <ApiEndpoint method="POST" url="https://live.luigisbox.com/v1/content/commit" />
  </div>
## Overview

When synchronizing your catalog through periodic batch jobs, identifying objects that were deleted since the last sync can be difficult. Content Generations provide a straightforward way to remove this stale data.

By assigning a `generation` marker to all objects in your current batch, you can update your active catalog and then commit the generation. This tells Luigi's Box to delete any objects of the specified type that do *not* match the current generation marker.

### Synchronization workflow

1. **Mark:** Add a shared `generation` attribute, such as `1534199032554`, to all objects in your Content Update payload.
2. **Upload:** Send the payload via the Content Update API. Existing objects are updated and new ones are created.
3. **Commit:** Call this endpoint with the same generation marker and object `type`. All unmarked objects of this type will be deleted.

Committing is type-specific. If you use nested items, you must commit their respective types separately, for example `product`, `category`, and `brand`.

<Aside type="danger">
  **Use with caution:** To prevent unintentional deletes, the commit API makes sure that at least one object from the committed generation is present in the index.
</Aside>
</ApiSection>

<ApiSection>
## Send a Commit Request

This endpoint expects query parameters to specify the target type and the generation string. No JSON body is required.

### Query parameters

| Parameter | Type | Required | Description |
| :-- | :-- | :-- | :-- |
| `type` | String | ✓ | Object type to commit the generation for, such as `item`, `category`, or `article`. |
| `generation` | String | ✓ | The generation marker that was used during the Content Update, for example `1534199032554`. |

Authentication is required for all requests. You will need your dynamically generated HMAC signature.

<Aside type="danger">
  Your **Private Key** is a secret and should never be exposed in client-side code, such as frontend JavaScript. It should only be used on a secure server.
</Aside>

<Aside type="tip">
  Your API Keys can be found in the Luigi's Box application under "General settings" > "Integration settings".
</Aside>

  <div slot="code">
    <h4 class="code-section-title">Example: Request URL via cURL</h4>

```shell
host="https://live.luigisbox.com"
endpoint_path="/v1/content/commit"
query_string="type=item&generation=1534199032554"
request_url="${host}${endpoint_path}?${query_string}"
public_key="your_public_api_key"
private_key="your_private_api_key"
method="POST"
content_type="application/json; charset=utf-8"
date=$(date -u "+%a, %d %b %Y %H:%M:%S GMT")

string_to_sign="$(printf "${method}\n${content_type}\n${date}\n${endpoint_path}")"
signature=$(echo -n "${string_to_sign}" | openssl dgst -sha256 -hmac "${private_key}" -binary | base64)

curl -X ${method} "${request_url}" \
     -H "Content-Type: ${content_type}" \
     -H "Date: ${date}" \
     -H "Authorization: ApiAuth ${public_key}:${signature}"
```

  </div>
</ApiSection>

## Error handling

| HTTP Status | Description |
| :-- | :-- |
| **400 Bad Request** | The request structure is invalid, or the generation does not have any objects present in the index. Check the response body for details. |
| **403 Forbidden** | The request is not allowed for your site in Luigi's Box. |
| **429 Too Many Requests** | The rate limit has been exceeded. |
