Skip to content
Knowledge Base API

Products

Create, read, update, and delete products — including bulk operations.

On this page

Products API#

Use the Products API to create, read, update, and delete products in your knowledge base. Products power the AI chatbot's product recommendation capabilities.

Endpoints#

MethodPath
GET/knowledge-bases/{kbId}/products
GET/knowledge-bases/{kbId}/products/{id}
POST/knowledge-bases/{kbId}/products
PUT/knowledge-bases/{kbId}/products/{id}
DELETE/knowledge-bases/{kbId}/products/{id}
POST/knowledge-bases/{kbId}/products/bulk
POST/knowledge-bases/{kbId}/products/bulk-delete
POST/knowledge-bases/{kbId}/products/upsert
POST/knowledge-bases/{kbId}/products/reconcile

List Products#

Retrieves a paginated list of products in a knowledge base. Returns up to 100 products per page.

curl "https://api.infinichat.dev/knowledge-bases/{kbId}/products?limit=50" \
  -H "X-API-Key: api_your_api_key"

Get a Product#

Retrieves a single product by ID.

curl https://api.infinichat.dev/knowledge-bases/{kbId}/products/{id} \
  -H "X-API-Key: api_your_api_key"

Create a Product#

Creates a new product in the knowledge base. All fields except name are optional.

curl -X POST https://api.infinichat.dev/knowledge-bases/{kbId}/products \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Wireless Headphones",
    "description": "Noise-cancelling over-ear headphones",
    "price": { "amount": 299.99, "currency": "USD" },
    "category": "Electronics"
  }'

Update a Product#

Updates an existing product. Only include the fields you want to change.

curl -X PUT https://api.infinichat.dev/knowledge-bases/{kbId}/products/{id} \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "price": { "amount": 249.99, "currency": "USD" } }'

Delete a Product#

Permanently removes a product from the knowledge base.

This operation is permanent and cannot be undone. For bulk cleanups, run reconcile in dry-run mode first to preview which records will be removed.

curl -X DELETE https://api.infinichat.dev/knowledge-bases/{kbId}/products/{id} \
  -H "X-API-Key: api_your_api_key"

Bulk Create Products#

Creates multiple products in a single request. Accepts up to 100 products per call.

curl -X POST https://api.infinichat.dev/knowledge-bases/{kbId}/products/bulk \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "name": "Product A", "price": { "amount": 19.99, "currency": "USD" } },
      { "name": "Product B", "price": { "amount": 29.99, "currency": "USD" } }
    ]
  }'

Bulk Delete Products#

Deletes multiple products in a single request. Delete by Gydr id, or by your own key so you never have to store our ids.

curl -X POST https://api.infinichat.dev/knowledge-bases/{kbId}/products/bulk-delete \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["65f1a2b3c4d5e6f701234567", "65f1a2b3c4d5e6f701234568"] }'

Syncing from another system? Use upsert, not bulk create. Bulk create inserts unconditionally, so running it twice creates two copies of every row. Upsert matches on your own key and is safe to re-run.

Upsert Products#

Push a batch of up to 100 products, matching existing rows by your own key. Fields you omit are left untouched — your system can own sku and price while your team maintains everything else in the Console. Set matchBy to "sku" or "externalId"; there is no default.

customAttributes and metadata merge key by key. Arrays such as tags replace wholesale, so sending [] clears them. An unknown field is rejected by name rather than silently dropped.

curl -X POST https://api.infinichat.dev/knowledge-bases/{kbId}/products/upsert \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "matchBy": "sku",
    "items": [
      { "sku": "ABC-123", "price": { "amount": 49.9, "currency": "USD" } }
    ]
  }'

One bad row never fails the batch. Each result carries an outcome, and failures carry a stable code: MISSING_MATCH_KEY, DUPLICATE_IN_BATCH, AMBIGUOUS_MATCH, VALIDATION_FAILED, NOT_FOUND, WRITE_CONFLICT or LIMIT_EXCEEDED. A failed row is not charged.

Reconcile Products#

Supply your complete catalogue feed and the API deletes every stored product whose key is absent from it — the destructive complement to upsert. Several guards stand between a truncated upload and an emptied catalogue:

  • mode is required — there is no default. "dry-run" computes what would be deleted and returns the result without touching the data. "apply" performs the deletions.
  • confirm must equal the target knowledge-base id when applying. A copy-pasted call against the wrong knowledge base fails closed.
  • maxDeletionPercent (default 20, ceiling 50) — if the planned deletions exceed this percentage of the live catalogue, the entire call is aborted rather than partially applied. Raise it only when you know your feed is intentionally smaller than the stored catalogue.
curl -X POST https://api.infinichat.dev/knowledge-bases/{kbId}/products/reconcile \
  -H "X-API-Key: api_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "matchBy": "sku",
    "keys": ["ABC-001", "ABC-002", "ABC-003"],
    "mode": "dry-run"
  }'

We use cookies to run and improve Gydr.

Read our Cookie Policy